https://github.com/kader009/trendwave-backend
TrendWave backend site
https://github.com/kader009/trendwave-backend
authentication cookie express javascript jwt-authentication nodejs
Last synced: 3 months ago
JSON representation
TrendWave backend site
- Host: GitHub
- URL: https://github.com/kader009/trendwave-backend
- Owner: kader009
- Created: 2025-06-04T11:27:58.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-17T09:12:00.000Z (about 1 year ago)
- Last Synced: 2025-08-13T02:22:42.082Z (11 months ago)
- Topics: authentication, cookie, express, javascript, jwt-authentication, nodejs
- Language: JavaScript
- Homepage:
- Size: 53.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# TrendWave Backend
Backend server for the **TrendWave** project built with Node.js, Express, and MongoDB.
This backend handles API requests, user authentication, role-based access control, and database operations.
## Features
- JWT-based Authentication & Authorization
- Role-Based Access Control (RBAC)
- **Admin**: Full access to all features
- **Seller**: Can create and manage products
- **Customer**: Can browse, add wishlist, and buy products
- RESTful API structure
- MongoDB with Mongoose ODM
- Cookie-based token management (httpOnly & secure)
- Centralized error and validation handling
- Environment-based configuration with `.env` support
- CORS setup for cross-origin requests
---
## Tech Stack
- **Node.js**
- **Express.js**
- **MongoDB** (via Mongoose)
- **JWT** (JSON Web Tokens)
- **dotenv** – environment configuration
- **cors** – cross-origin support
- **cookie-parser** – to handle cookies
- **bcryptjs** – for password hashing
- **helmet** – for HTTP header security
---
## 👥 User Roles & Access
TrendWave supports three user roles with different access levels:
| Role | Permissions |
| -------- | ---------------------------------------------- |
| Admin | Full control over users, courses, and settings |
| Seller | Can create and manage products |
| Customer | Can browse, add wishlist, and buy products |
Each protected route uses middleware to verify the user's role and grant/deny access accordingly.
---
## Installation & Setup
### 🔧 Prerequisites
- Node.js (v21 or higher)
- MongoDB (local or MongoDB Atlas)
- Git (for cloning)
### Getting Started
```bash
# 1. Clone the repository
git clone https://github.com/kader009/trendwave-backend.git
```
```bash
# 2. Install all dependencies
npm install
```
```bash
# 3. Create your environment variables file (if you have)
cp .env.example .env
```
```bash
# 4. Start the development server
npm run dev
```