The project is a part of Integrify's Node.js backend module 2024.
We as a group, Woong, Roshan and Ganesh, simulated E-commerce API and try to provide a good collection of REST APIs between users and server transactions.
Each entity basically have a CRUD(Create, Read, Update, Delete) operations but also a special access only for ADMIN.
This is built with Typescript, Node, Express and MongoDB.
We have structured base entities
-
Users
-
Products
-
Categories
-
Orders
-
OrderItems
- node
^19.2.0
- npm
^9.2.0
Make sure you have npm installed globally.
$ git clone https://github.com/Woongsik/e-commerce-api.git
$ cd e-commerce-api
$ npm install # Install project dependencies
$ npm run start # Compile and launch on local environment
3. Navigate to http://localhost:8080
For security, this API should implement user authentication using JSON Web Tokens (JWT). Each user should have a unique username and password OR broker authentication. Certain admin endpoints may require special privileges for access.
-
Products
- Get list of all products with/without pagination(limit, offset)
- Get list of products, filtering (search) by: name, categories, size
- Get a product by product id
-
Categories
- Get list of all categories
- Get a category by category id
-
Users
- Sign up a new user (username, password, first name, last name, email, address)
- Sign in user with email/password
- Update user profile (first name, last name, email)
- Forget password request
- Change password (username, old password, new password)
-
Order
- Get list of all orders
- Get list of all user's order
- Get a user's order by order ID
-
Admin
- Change a User's role to Admin or Customer,
- Change a User's active to Active or Inactive
- Create a new category, update, remove
- Create a new product, update, remove
1. Welcoming email
- When new user is registered, welcoming email is sent
- [Mailersend](https://www.mailersend.com/)
2. Google account login
- User is able to use their google account to login/registeration
- Welcoming email generate an initial password for email/passowrd login
3. Email check if already in use
- Email address will be checked if it is in use already before sending all user info for registration
4. Admin check
- The Admin role will be given only accpeted/registered email
- ie.
```bash
admin@mail.com (just for testing purpose in the project)
```
For the testing, Jest, Supertest, MongoDB memory server are used.
Check test code in src/tests
$ npm run test
The API is live now hosted by RENDER Check the live link here https://fs17-backend-b5i2.onrender.com
- Some examples