E-commerce API built using NodeJS & MongoDB
Live Swagger Documantetion : https://ecommerce-production-node-app.up.railway.app/api-docs/
git clone https://github.com/TarikSogukpinar/ecommerce.git
Node.js
cd ecommerce
npm install
npm run dev:production & npm run dev:development
Docker
cd ecommerce
docker-compose up
POST /api/auth/login
POST /api/auth/register
GET /api/auth/logout
GET /api/admin/getAllusers
GET /api/admin/getUserById/${userId}
PUT /api/admin/updateUserById/${userId}
DELETE /api/admin/deleteUserById/${userId}
POST /api/admin/createNewUser
POST /api/admin/updateUserRole/${userId}
POST /api/cart/addToCartItem/${userId}/${productId}
GET /api/cart/getUserCart/${userId}
DELETE /api/cart/deleteCartItem/${userId}/${productId}
DELETE /api/cart/deleteUserCart/${userId}
POST /api/category/createCategory
GET /api/category/searchCategory/${key}
GET /api/category/searchCategoryById/${categoryId}
PUT /api/category/updateCategoryById/${categoryId}
DELETE /api/category/deleteCategoryById/${categoryId}
POST /api/favorite/addFavorite/${userId}/${productId}
GET /api/favorite/getFavoriteProducts/${userId}
DELETE /api/favorite/deleteFavorite/${userId}/${productId}
POST /api/order/createOrder
GET /api/order/searchOrder/${orderStatus}
GET /api/order/getOrderById/${orderId}
PUT /api/order/updateOrder/${orderId}
PUT /api/order/cancelOrder/${orderId}
PUT /api/order/updateOrderStatus/${orderId}
POST /api/product/createProduct
PUT /api/product/updateProduct/${productId}
GET /api/product/getAllProducts
GET /api/product/searchProducts/${key}
DELETE /api/product/deleteProductById/${productId}
GET /api/product/getProductById/${productId}
GET /api/product/getCheapestFiveProducts
GET /api/product/getExpensiveFiveProducts
GET /api/product/getRecentlyAddedProducts
PUT /api/user/updatePassword/${userId}
POST /api/user/reset-password
DELETE /api/user/reset-password/${userId}
Other API services are still being developed
List of any major frameworks used to build the project.
Node JS - JS runtime environment
ExpressJS - The NodeJS framework used
MongoDB - NoSQL Database uses JSON-like documents with optional schemas
Mongoose - Object Data Modeling (ODM) library for MongoDB and NodeJS
Compression - NodeJS compression middleware
Joi - The most powerful schema description language and data validator for JavaScript.
Joi-password-complexity - Creates a Joi object that validates password complexity.
http-status-codes -Constants enumerating the HTTP status codes. Based on the Java Apache HttpStatus API.
Redis - Node-redis is a modern, high performance Redis client for Node.js.
Cors - NodeJS package for providing a Connect/Express middleware that can be used to enable CORS with various options
Express Mongo Sanitize - Express 4.x middleware which sanitizes user-supplied data to prevent MongoDB Operator Injection.
Dotenv - Loads environment variables from a . env file into process. env
Rate Limiter - Basic IP rate-limiting middleware for Express
Helmet Secure Express apps by setting various HTTP headers
JWT Compact URL-safe means of representing claims to be transferred between two parties
Moment JavaScript library which helps is parsing, validating, manipulating and displaying date/time in JavaScript in a very easy way
Multer NodeJS middleware for handling multipart/form-data
Nodemailer Easy as cake e-mail sending from your Node.js applications
Faker.js Generate massive amounts of fake (but realistic) data for testing and development.
Jest Delightful JavaScript Testing
supertest The motivation with this module is to provide a high-level abstraction for testing HTTP, while still allowing you to drop down to the lower-level API provided by superagent.
Winston A logger for just about everything.
uuidv4 uuidv4 creates v4 UUIDs.
PM2 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.
To run this project, you will need to add the following environment variables to your .env.development & .env.production file
MONGO_URI = yourmongodburl
PRIVATE_KEY = yourprivatesecretkey
REDIS_HOST = yourredishostconnectionurl
✅ Discount, Review, Support, Payment services will be written
- Tests will be written for all services
✅ Redis implementation will be done for a few services
✅ Swagger interface will be added and tested for all services
✅ Extend API's Functionality
- Logging will be added
✅ Some refactoring will be done & maybe bug fix
In this application, I think I have improved myself in writing APIs that provide different services, and I believe I have learned to use technologies such as Redis and Docker. I learned more about Express.js and the general Node.js architecture. I started to have a deeper knowledge of Mongo db and error handling. I had the opportunity to use many new npm packages.
If you have any feedback, please reach out to me at [email protected]