Prototype 2
This project is based on ReactJS in frontend, NodeJS in backend and MongoDB as a database. It contains complete authentication, user management system and subscription management.
- complete-authentication branch (v1.0.4) contains authentication & user management system.
- complete-authentication-subscription branch (v1.0.5) contains authentication, user management system and subscription management.
Nodejs and Express based api.
- Node version used 16.16.0
- NPM version used 8.11.0
- Create .env and .env.dev based on .env.example in the root directory.
- Run
npm installin terminal to install all packages. - Run
npm start,npm run start-devornpm run start-localfor environments .env, .env.dev and .env.local respectively.
- For M1/M2 based computer:
$ docker buildx build --platform linux/amd64 -t app .For Intel based computer:$ docker build -t app . - To try run container locally
$ docker run --rm -d -p 3000:8080 --name app-container app - To stop container
$ docker stop app-container
version: '3.8'
services:
db:
image: mongo
container_name: mongo
ports:
- '27017:27017'
networks:
- bhojan-network
volumes:
- ./data:/data/db
backend:
build: ./bhojan-be-prototype-2
container_name: backend
ports:
- '3001:3001'
env_file:
- ./bhojan-be-prototype-2/.env.docker
networks:
- bhojan-network
depends_on:
- db
frontend:
build: ./bhojan-fe-prototype-2
container_name: frontend
ports:
- '3000:3000'
env_file:
- ./bhojan-fe-prototype-2/.env.docker
networks:
- bhojan-network
stdin_open: true
tty: true
depends_on:
- backend
networks:
bhojan-network:
driver: bridge
https://www.youtube.com/watch?v=NZElg91l_ms
Bucket policy
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicRead", "Effect": "Allow", "Principal": "", "Action": [ "s3:GetObject", "s3:GetObjectVersion" ], "Resource": "arn:aws:s3:::bucket_name/" } ] }
CORS policy in bucket
[ { "AllowedHeaders": [ "" ], "AllowedMethods": [ "GET", "POST", "DELETE" ], "AllowedOrigins": [ "" ], "ExposeHeaders": [], "MaxAgeSeconds": 3000 } ]
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject" ], "Resource": "arn:aws:s3:::breadbutterstorage/*" } ] }
https://www.youtube.com/watch?v=1IjTYzOfSMc
$ npm install -g serverless
$ serverless config credentials --provider aws --key <KEY> --secret <SECRET>
$ serverless create -t aws-nodejs
$ npm install --save serverless-http
"pending", "accepted" and "declined"