This is an eCommerce Backend written in NodeJS(ExpressJS) with TypeScript
Some of the things that I have used
Frontend: Not sure yet😢
Backend: NodeJS, ExpressJS, TypeScript, MongoDB, Mongoose, JWT
PS: For complete list of packages check out package.json😉
- AUTH - Register, Login, Logout, Forgot Password, Reset Password
- USER - Get user, update user, delete user, upload avatars
- PRODUCT - Create, get all, get single, update, delete product(s)
- Uses Refresh Token + Access Token mechanism for relatively better security
GET /api/v1/products
GET /api/products/${id}
Parameter | Type | Description |
---|---|---|
id |
string(ObjectId) |
Required. Id of product to fetch |
I might make a Swagger documentation in the future, if I can learn it sooner.
-
Coupon
-
Addresses
-
Order
-
Payment integration
-
Review
-
Wishlist
-
Learn Swagger, Testing and implement them
Install AmmaJaan with yarn (You can choose others as well but I used yarn)
# First of all clone the repo
git clone https://github.com/shivamvijaywargi/full-stack-eCommerce.git
# Now cd into the cloned repo
cd full-stack-eCommerce
# First we need to install dependencies
yarn
# Finally use this command to run the server in dev mode (For other commands check package.json)
yarn start:dev
To run this project, you will need to add the following environment variables to your .env file, please checkout the .env.example for a list of variables you will need😊
Contributions are always welcome!
See contributing.md
(In process) for ways to get started.
Please adhere to this project's code of conduct
.
- Improved my knowledge on building backend using TS
- Learned about Zod and how to create Zod schemas for validation
- How to create interfaces for mongoose schemas
- First time using formidable and it was a good experience
- Basic API security using express-rate-limit + helmet
- Need something out of built-in fs package, fs-extra is what you need😉
- Create user friendly URLs with Slug (Say NO to 63e722d56f4c46aa8c65a82f)
- Better logging using Winston + Morgan (A level up compared to console logs)
- PS: Do not block your only thread (IFKYK)
There are still a few things I still need to dive into which includes but not limited to
-
Use Zod in conjunction with Formidable to be able to create schema to check for fields as well.
-
Docker
-
ESLint
-
Prettier
-
Husky
-
Test with Jest
-
Used Zod for Schema validation where it was necessary to reduce something like
if (!name || !email || ....) { return next(new AppErr(...)) } if (name.length < 5) { return next(new AppErr(...)) }
-
Refactored routes to use router.route and chain them instead of router.get, router.post, and so on and so forth
router.route('/').post(createProduct).get(getAllProducts); router .route('/:id') .get(getProductById) .put(updateProductById) .delete(deleteProductById);
HTML, CSS, Javascript, ReactJS, NextJS, NodeJS, ExpressJS, MongoDB, TypeScript
If you have any feedback, please reach out to me at any of the links given below
Telegram | |
---|---|
First of all, thank you for reading through the README and now a request from my end. If you think there is some issue with the code or a piece of code can be improved, please feel free to open an issue, or if possible please submit a PR. I would be glad to learn things and improve myself.