A robust backend REST API for online stores, built with Express.js and TypeScript. This system leverages Supabase for database management and handles secure authentication via JWT, product inventory, shopping carts, and order processing.
Note: Payment integration is currently a work in progress.
- 🔐 Authentication: Secure user registration and login using JWT (JSON Web Tokens).
- 🏷️ Product Management: CRUD operations for managing inventory and product details.
- 🛒 Shopping Cart: Add, remove, and view items in the user's cart.
- 📦 Order Processing: Create and manage customer orders.
- 💳 Payment Integration: [In Progress] Integration for handling transactions.
- 🛡️ Middleware Protection: Role-based access control and input validation.
- Runtime: Node.js
- Framework: Express.js
- Language: TypeScript
- Database: Supabase (PostgreSQL)
- Authentication: JWT & Supabase Auth
E-Commerce-API/
├── config/ # Database and environment configuration
├── controllers/ # Request handlers for the API routes
├── middlewares/ # Auth and validation middlewares
├── models/ # Data models and schemas
├── routes/ # API route definitions
├── types/ # TypeScript type definitions
├── utils/ # Helper functions and utilities
├── server.ts # Entry point of the application
└── ...- Clone the repository
git clone https://github.com/Glory42/E-Commerce-API.git
cd E-Commerce-API- Install Dependencies
npm install- Run the server
# Development mode
npm run dev
# Build and start
npm run build
npm startCreate a .env file in the root directory and add the following variables:
PORT=3000
SUPABASE_URL=your_supabase_project_url
SUPABASE_KEY=your_supabase_anon_key
JWT_SECRET=your_jwt_secret_key
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/auth/register |
Register a new user |
POST |
/api/auth/login |
Login and receive JWT |
GET |
/api/products |
Fetch all products |
GET |
/api/products/:id |
Fetch single product details |
POST |
/api/cart |
Add item to cart |
GET |
/api/cart |
View user cart |
POST |
/api/orders |
Place a new order |
This project is licensed under the MIT License.
See the LICENSE file for more information.
If you have any questions, feel free to reach out to me at me@gorkemkaryol.dev.