E-Commerce's REST API backend for printing Arabic literature.
-
Tech stack:
- Full TypeScript
- Nodejs & Express.js
- Database:
- MongoDB & Mongoose
- Caching with
RedisValKey
- Docker Containerization
-
characteristics:
- Regression tests with Vitest.
- CI using Github actions testing
- JWT Authentication & Authorization
- Error Handling
- Data Validation with Yup and express-validator
- Security best practices from OWASP
- …and more
-
./github for Github actions.
-
./src:
-
app.ts is the main file for app logic, initializing middlewares and routes, and connecting to our MongoDB.
-
index.ts is the server file to run the app.
-
db.ts is the config file for MongoDB.
-
redis.ts is the config file for redis.
-
ecosystem.example.config.js is a template to generate PM2 config file ecosystem.config.js for process management and ENVs.
-
./config file to import all environment variables, and use a complex configuration structure if needed.
-
./components file contain app's solutions by self contained components with
-
model file for our mongoose models, representing app's data, using (*.model.ts) naming convention for every module.
-
service file for communicating(read/write) to our database, and make operations on data if needed, then return the data for ./controllers, using (*.service.ts) naming convention for every module.
-
controller file for coordinating HTTP request & responses, and set needed cookies and headers, using (*.controller.ts) naming convention for every module.
-
route file for establishing endpoints and controllers to every modules. Beside validating requests, and jwt authentication. Using (*.route.ts) naming convention for every module.
-
schema file for validation data for post and update methods by Yup. Using (*.schema.ts) naming convention for every module.
-
-
./interfaces file for types' declarations, using (*.interface.ts) naming convention for every module, beside __types__ for general types. Every interface has an Enum: ERROR_MSG for this interface error messages, and baseEntity for TypeORM.
-
./middlewares file for containing reused middlewares, which are used across the app, using (*.middleware.ts) naming convention for every module.
-
./utils file for containing reused functions and centralized error handling, which are used across the app.
-
./tests/e2e for E2E tests
-
-
.env.example as example for ENVs.
-
tsconfig.json for TypeScript config
-
vitest.config.ts for Vitest config
-
Dockerfile, compose.yaml and .dockerignore for containerization