| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
MEAN STAR is a starter application that helps you to easily start your project development with MEAN Stack technology. This project is mainly focused on the Security, integrated OpenID Connect OAuth 2.0 Authorization Code PKCE Flow and jwks jwt verification. It uses the AppAuth-JS which provides the very generic facility to integrate Authorization Code PKCE Flow with any Single-page Application(SPA) technology and with Any OpenID Connect Provider.
There are so many OpenID Connect Provider. For Example: auth0, okta, keyclock, google, onelogin, gluu, etc...
Currently I am using auth0.com. It is a good OpenID Connect provider. You can create free developer accound and test.
https://mean-star.herokuapp.com.
cd client
npm icd server
npm iInstall npm i -g nodemon for developement.
Set your OP(OpenID Connect Provider) Client configuration the environments.ts.
export const environment = {
production: false,
apiURL: 'http://localhost:3000',
// OP Server configuration
clientId: '<your_client_id>',
opServer: '<your_op_server_url>',
opServerUserInfoEndpoint: '/userinfo',
opServerExtraParamsInAuthRequest: {
audience: '<your_op_server_url>/api/v2/'
},
redirectURI: 'http://localhost:4200/callback',
logoutRedirectURI: 'http://localhost:4200',
scope: 'openid email profile',
};
For auth0.com, you need to set extra params to get Access Token in JWT form. Please check here for solution. Every OpenID Connect provider has it's own configurations style so you may need to find out for JWT Access Token.
We need JWT Access Token so that we can use the JWKS Public key verification as Node JS Server side.
Use environments.prod.ts for production environment setup.
Rename the from .env.sample to .env.
PORT=3000 DB_URL=mongodb://localhost:27017/mean OP_SERVER_URL=<your_op_server_url> USERINFO_ENDPOINT=<your_op_server_user_endpoint_path> CORS_ORIGIN=http://localhost:4200
Set PRODUCTION=true for production.
npm startnpm startFor development,
npm run devFor development
docker-compose build
docker-compose upIf you want to stop docker then press ctrl + c + c, docker-compose down.
There are many ways to deploy the application.
PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
Follow the below steps for production:
Clone or move your code to server and install node_modules.
Install PM2
npm i -g pm2Make an angular production build.
cd client
ng build --prodMove client/dist/client folder to server/ so that node application serve it.
cp -R client/dist/client server/Start PM2 service. which runs your application in the background.
export PRODUCTION=true # or you can add this in .env
pm2 start index.jsAngular is a front-end client application and deploy the client application on standard HTTP Server has several benefits. Please check here for more details.
Follow Below steps to deploy on Nginx:
cd client
ng build --prodDocker makes our task very easy. You need to install docker and docker compose on server.
Follow below steps for deploy using docker
docker-compose builddocker-compose upFirst create a new App using Heroku dashboard and then follow the below step to build and deploy image on Heroku
heroku container:login heroku container:push [image-name] -a [your-app-name] heroku container:release [image-name] -a [your-app-name]
| Back | FazBrowse Home | New Git URL |