This is a backend for Color Flix app. The users can either take pictures by using the camera or pick images from their gallery to get the palette. Their pictures then will be posted on their profile page and visible to other users. Other users can give feedbacks by like and comment on the posts.
- TypeScript
- Node, Express
- MongoDB, Mongoose
- Docker
- AWS S3
- JWT
- Redis
- USER
- POST
- COMMENT
- LIKE
The application uses JWT (access token and refresh token) for secure authentication. Besides, to increase the security, all users have a distinct salt string adding to their password. All passwords are encrypted and stored in database.
The code utilize pipeline MongoDB operations for reducing the runtime performance. Also, the database design implements 1-to-1, 1-to-many relationships.
Photos are posted and stored on AWS S3 service. They can be retrieved and showed by the return urls saved in MongoDB Atlas.
Reduce triple the times to GET information about post, like, and comment by implementing Redis cache in Controller.
The colors are generated from Flask Machine Learning server also developed by our team and then stored in the database with the post information.
Create a .env file for enviroment variables with the format below:
PORT=5000
COLORFLIX_DB_URI=
ACCESS_TOKEN_SECRET=
REFRESH_TOKEN_SECRET=
ACCESS_TOKEN_EXPIRATION=7d
REFRESH_TOKEN_EXPIRATION=30d
AWS_SECRET_ACCESS_KEY=
AWS_ACCESS_KEY_ID=
S3_REGION=
S3_BUCKET_NAME=colorflix-s3
FLASK_SERVER=http://0.0.0.0:8000/upload
You need a MongoDB Atlas cluster and an AWS S3 bucket to run the web app. The port number can be changed if you like. You also need to install and run our Color Flix Model server.
Install all dependencies for the web-app.
Run the web-app on the desired port (e.g. 5000).
The API document is written through Swagger and can be accessed at this page (Port number should be followed the one you run the app).