https://github.com/redaezziani/manga-web-store-api
A modern, feature-rich REST API for managing a manga web store built with NestJS and TypeScript.
https://github.com/redaezziani/manga-web-store-api
docker expressjs jwt mariadb
Last synced: 3 months ago
JSON representation
A modern, feature-rich REST API for managing a manga web store built with NestJS and TypeScript.
- Host: GitHub
- URL: https://github.com/redaezziani/manga-web-store-api
- Owner: redaezziani
- Created: 2025-07-21T15:06:54.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-09-15T10:07:34.000Z (10 months ago)
- Last Synced: 2025-09-15T12:11:22.235Z (10 months ago)
- Topics: docker, expressjs, jwt, mariadb
- Language: TypeScript
- Homepage:
- Size: 449 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ Manga Web Store API
A modern, feature-rich REST API for managing a manga web store built with NestJS and TypeScript.
## ๐ท๏ธ Technology Stack











## โจ Features
### ๐ Authentication & Authorization
- **JWT-based authentication** with Passport.js
- **Role-based access control** (Admin, Moderator, User)
- **Email verification** system
- **Password reset** functionality
- **Login history** tracking with device/location info
- **Two-factor authentication** support
- **Account status management** (Active, Suspended, etc.)
### ๐ Manga Management
- **Manga catalog** with detailed information (title, author, description)
- **Category management** with multi-language support (EN/AR)
- **Volume management** with pricing, stock, and availability
- **Cover image** and preview image uploads
- **Advanced search** and filtering capabilities
### ๐ E-commerce Features
- **Shopping cart** functionality
- **Wishlist** system for favorite manga
- **Order management** with multiple status tracking
- **Review and rating** system for manga
- **Inventory management** with stock tracking
- **Discount system** for volumes
### ๐ Additional Features
- **Multi-language support** (English/Arabic)
- **File upload** integration with Cloudinary
- **Email notifications** via Resend
- **API documentation** with Swagger/OpenAPI
- **Pagination** for large datasets
- **Data validation** with class-validator
- **Comprehensive logging** and error handling
## ๐ Quick Start
### Prerequisites
- **Node.js** (v18 or higher)
- **npm** or **yarn**
- **Docker** and **Docker Compose**
- **MariaDB** (or use Docker Compose)
### Installation
1. **Clone the repository**
```bash
git clone https://github.com/redaezziani/manga-web-store-api.git
cd manga-web-store-api
```
2. **Install dependencies**
```bash
npm install --legacy-peer-deps
```
3. **Set up environment variables**
```bash
cp .env.example .env
# Edit .env with your configuration
```
4. **Start the database**
```bash
docker-compose up -d mariadb
```
5. **Set up the database**
```bash
npx prisma generate
npx prisma db push
npx prisma db seed
```
6. **Start the development server**
```bash
npm run start:dev
```
The API will be available at `http://localhost:7000`
## ๐ API Documentation
Once the server is running, you can access the interactive API documentation at:
- **Swagger UI**: `http://localhost:7000/api/docs`
## ๐ ๏ธ Development
### Available Scripts
```bash
# Development
npm run start:dev # Start with file watching
npm run start:debug # Start in debug mode
# Building
npm run build # Build the application
npm run start:prod # Start production build
# Testing
npm run test # Run unit tests
npm run test:watch # Run tests in watch mode
npm run test:cov # Run tests with coverage
npm run test:e2e # Run end-to-end tests
# Code Quality
npm run lint # Run ESLint
npm run format # Format code with Prettier
# Database
npx prisma generate # Generate Prisma client
npx prisma db push # Push schema to database
npx prisma db seed # Seed database with sample data
npx prisma studio # Open Prisma Studio
```
### Project Structure
```
src/
โโโ auth/ # Authentication module
โโโ cart/ # Shopping cart functionality
โโโ common/ # Shared utilities and services
โโโ database/ # Database configuration
โโโ integration/ # External service integrations
โโโ manga/ # Manga and category management
โโโ order/ # Order management
โโโ smtp/ # Email service
โโโ storage/ # File upload and storage
โโโ volume/ # Manga volume management
โโโ wishlist/ # User wishlist functionality
โโโ app.module.ts # Main application module
โโโ main.ts # Application entry point
```
## ๐ง Configuration
### Environment Variables
Create a `.env` file with the following variables:
```env
# Database
DATABASE_URL="mysql://user:password@localhost:3306/mangastore"
# JWT
JWT_SECRET="your-jwt-secret"
JWT_EXPIRES_IN="7d"
# Cloudinary (for file uploads)
CLOUDINARY_CLOUD_NAME="your-cloud-name"
CLOUDINARY_API_KEY="your-api-key"
CLOUDINARY_API_SECRET="your-api-secret"
# Email (Resend)
RESEND_API_KEY="your-resend-api-key"
FROM_EMAIL="noreply@yourdomain.com"
# Application
PORT=7000
```
## ๐ณ Docker Deployment
The project includes Docker Compose configuration for easy deployment:
```bash
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
```
## ๐งช Testing
The project uses Jest for testing. Test files are located alongside source files with `.spec.ts` extension.
```bash
# Run all tests
npm run test
# Run tests with coverage
npm run test:cov
# Run e2e tests
npm run test:e2e
```
## ๐ API Endpoints
### Authentication
- `POST /api/v1/auth/register` - User registration
- `POST /api/v1/auth/login` - User login
- `POST /api/v1/auth/refresh` - Refresh JWT token
- `POST /api/v1/auth/forgot-password` - Request password reset
### Manga Management
- `GET /api/v1/manga` - Get all manga with pagination
- `GET /api/v1/manga/:id` - Get manga by ID
- `POST /api/v1/manga` - Create new manga (Admin)
- `PUT /api/v1/manga/:id` - Update manga (Admin)
- `DELETE /api/v1/manga/:id` - Delete manga (Admin)
### Categories
- `GET /api/v1/manga/categories` - Get all categories
- `POST /api/v1/manga/categories` - Create category (Admin)
### Cart & Orders
- `GET /api/v1/cart` - Get user cart
- `POST /api/v1/cart/items` - Add item to cart
- `POST /api/v1/orders` - Create order from cart
- `GET /api/v1/orders` - Get user orders
For complete API documentation, visit the Swagger UI when the server is running.
## ๐ค Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
### Development Guidelines
- Follow TypeScript best practices
- Use ESLint and Prettier for code formatting
- Write tests for new features
- Update documentation when needed
- Follow conventional commit messages
## ๐ License
This project is licensed under the [UNLICENSED](LICENSE) license.
## ๐จโ๐ป Author
**Reda Ezziani**
- GitHub: [@redaezziani](https://github.com/redaezziani)
## ๐ Acknowledgments
- [NestJS](https://nestjs.com/) - A progressive Node.js framework
- [Prisma](https://www.prisma.io/) - Next-generation ORM for Node.js
- [MariaDB](https://mariadb.org/) - Reliable and performant database
- [Cloudinary](https://cloudinary.com/) - Image and video management
- [Resend](https://resend.com/) - Email delivery service
---
โญ **Star this repository if you find it helpful!**