Professional Bookstore API built with Node.js, TypeScript, and Clean Architecture.
864
A professional, high-performance Bookstore system featuring a hybrid RESTful API and MVC architecture, built with Node.js, Express, and TypeScript. This project implements Clean Modular Architecture, robust production security, and a fully automated CI/CD Pipeline.
Click the image to visit the live home page.
Click the image to test the API endpoints live.
| Backend & UI | Database & Validation | DevOps & CI/CD | Security & Performance |
|---|---|---|---|
_id to id transformation via a custom global plugin.express-rate-limit to prevent DDoS attacks.Promise.all for high performance.For a detailed interactive guide and to test the endpoints live, please visit our Swagger Documentationā .
POST /api/auth/register - Register a new user.POST /api/auth/login - Authenticate user and receive a JWT.GET /api/users - List all users (Admin only).GET /api/users/{id} - Get user details (Owner or Admin).PUT /api/users/{id} - Update user profile.DELETE /api/users/{id} - Delete user account.GET /password/forgot-password - Render forgot password view.POST /password/forgot-password - Send reset password link via email.GET /password/reset-password/{id}/{token} - Render reset password form.POST /password/reset-password/{id}/{token} - Set a new password in the database.GET /api/authors - Get all authors with pagination.POST /api/authors - Create a new author (Admin only).GET /api/authors/{id} - Get author by ID.PUT /api/authors/{id} - Update author details (Admin only).DELETE /api/authors/{id} - Delete author by ID (Admin only).GET /api/books - Get all books (with Pagination & Price Filtering).POST /api/books - Create a new book (Admin only).GET /api/books/{id} - Get book details (Populated with Author).PUT /api/books/{id} - Update book details (Admin only).DELETE /api/books/{id} - Delete book by ID (Admin only).POST /api/upload - Upload a single image using Multer.To run this project locally, you need to set up the following environment variables. Create a .env file in the root directory and populate it with your values:
# APPLICATION CONFIGURATION
PORT=5001
NODE_ENV=development
BASE_URL=http://localhost:5001
# DATABASE CONFIGURATION
MONGO_URI_DEV=mongodb://localhost/bookStoreDB
MONGO_URI_PRO=your_production_mongodb_uri
# SECURITY & AUTHENTICATION
JWT_SECRET_KEY=your_super_secret_key
JWT_EXPIRES_IN=30d
PASSWORD_RESET_EXPIRES_IN=10m
# FRONTEND INTEGRATION (CORS)
CLIENT_URL=http://localhost:3000
# PAGINATION SETTINGS
BOOKS_PER_PAGE=2
AUTHORS_PER_PAGE=2
USERS_PER_PAGE=5
# NODEMAILER CONFIGURATION (SMTP)
[email protected]
USER_PASS=your_app_specific_password
src/
āāā index.ts # Entry point & Express app configuration
āāā models/ # Centralized Mongoose Schemas (User, Book, Author)
āāā modules/ # Feature-based modular logic
ā āāā auth/ # Login, Register & JWT Logic
ā āāā user/ # User management & Administration
ā āāā book/ # Catalog management & Price filtering
ā āāā author/ # Author profiles & Data seeding
ā āāā password/ # MVC Password recovery workflow
ā āāā upload/ # File storage & Multer integration
ā āāā docs/ # Integrated Swagger YAML definitions per module
āāā shared/ # Cross-cutting concerns & Infrastructure
ā āāā config/ # DB Connection & Swagger JSDoc Setup
ā āāā helpers/ # Query, Response, and Mongoose utility functions
ā āāā middlewares/ # Auth guards, Error handling, and Logger
ā āāā types/ # Global TypeScript interfaces & Express extensions
ā āāā validations/ # Shared Zod validation schemas
āāā styles/ # Tailwind input CSS
āāā views/ # EJS Templates for MVC views (Welcome & Password Reset)
āāā public/ # Static assets (Compiled CSS & Uploaded images)
Launch the entire environment (API + Database) with a single command:
docker-compose up -d
npm run dev # Start API only
npm run mvc # Start API + Tailwind + Views
Developed with precision by Hossam Gouda
Front-End Engineer focused on building scalable and maintainable user interfaces.
Content type
Image
Digest
sha256:3e7dd1614ā¦
Size
72.1 MB
Last updated
4 months ago
docker pull hossamgezo/bookstore-api:v2