This project is an API for e-commerce clothing store built with Express.js and TypeScript.
This API was built for e-commerce clothing store so the users can authenticate and authorize themselves, fetch products available at the store, place orders and pay for them.
- Node.js - version 20.9.0
- Express.js - version 4.18.2
- TypeScript - version 5.2.2
- MongoDB
- Mongoose - version 8.0.0
- Express Validator - version 7.0.1
- Stripe - version 14.5.0
- User authentication with JWT
- User authorization based on roles
- Fetching available products
- Placing orders
- Stripe integration for handling payments
- Admin user can add new products to the store
- POST /auth/register | Register new user
- POST /auth/login | Log in user
- GET /auth/check-role | Authorize user
- POST /products/add | Add new product
- GET /products/get/:category | Get products from specific category
- PATCH /orders/add | Add new order
- GET /orders/get | Get all user's orders
- POST /checkout/create-checkout-session | Create Stripe checkout session
To get started with the project, follow the steps below:
- Clone the repository onto your device
- Open the repository in some code editor, for example VSCode and install the dependencies with:
npm install- Add .env file with the following variables: 'PORT', 'DB_URI', 'AUTH_TOKEN_SECRET', 'STRIPE_SECRET_KEY', 'CLIENT_DOMAIN' and fill them with your data
- Run the app on your localhost in the development mode with:
npm run devCreated by @bystrol - all rights reserved.