Skip to content

LiLi42-26/BookStore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BookStore - Full Stack Application

This is a production-ready full-stack bookstore platform built with modern web technologies.

Quick Start (Docker)

Prerequisites

  • Docker Desktop (or Docker Engine + Compose plugin)

Steps

  1. Create backend environment file:
cp backend/.env.example backend/.env
  1. Fill in OAuth credentials in backend/.env

  2. Start everything:

docker compose up --build

Services will be available at:

Local Development

Backend

cd backend
npm install
npm run dev

Frontend

cd frontend
npm install
npm run dev

Environment Variables

See .env.example files in backend/ and frontend/ directories.

Project Structure

BookStore/
├── Backend/              # Node.js/Express API
│   ├── models/          # Mongoose schemas
│   ├── controllers/     # Business logic
│   ├── routes/          # API endpoints
│   ├── middleware/      # Auth, validation, errors
│   ├── config/          # Database connection
│   └── utils/           # Helpers
├── Frontend/            # React + Vite SPA
│   ├── src/
│   │   ├── components/  # React components
│   │   ├── pages/       # Page components
│   │   ├── services/    # API client
│   │   ├── context/     # Auth context
│   │   └── utils/       # Utilities
│   └── public/          # Static assets
└── docker-compose.yml   # Docker orchestration

Technology Stack

  • Frontend: React 18, Vite, Tailwind CSS, Axios, React Router
  • Backend: Node.js 18, Express, Mongoose, Passport
  • Database: MongoDB 7
  • Deployment: Docker & Docker Compose
  • Web Server: Nginx

Features

  • User authentication (JWT + local)
  • OAuth login (Google, Discord, Facebook)
  • Role-based access control (Admin/Client)
  • Books catalog with search
  • Categories management
  • Order management
  • Rate limiting & security headers
  • File uploads support
  • Responsive UI

API Documentation

Authentication Endpoints

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login user
  • GET /api/auth/profile - Get current user
  • PUT /api/auth/profile - Update profile

Books Endpoints

  • GET /api/books - Get all books (with pagination & search)
  • GET /api/books/:id - Get book details
  • POST /api/books - Create book (admin only)
  • PUT /api/books/:id - Update book (admin only)
  • DELETE /api/books/:id - Delete book (admin only)

Categories Endpoints

  • GET /api/categories - Get all categories
  • POST /api/categories - Create category (admin only)
  • PUT /api/categories/:id - Update category (admin only)
  • DELETE /api/categories/:id - Delete category (admin only)

Orders Endpoints

  • POST /api/orders - Create order
  • GET /api/orders/my-orders - Get user's orders
  • GET /api/orders/:id - Get order details
  • GET /api/orders - Get all orders (admin only)
  • PUT /api/orders/:id/status - Update order status (admin only)

Demo Credentials

Security Features

  • Helmet.js for security headers
  • CORS protection
  • JWT token authentication
  • Rate limiting
  • Password hashing with bcryptjs
  • MongoDB data persistence
  • Environment variable configuration

Known Issues & Notes

  • Docker compose may fail if ports 4000, 5173, or 27017 are already in use
  • OAuth callbacks must match Backend URL exactly
  • Discord email fallback: <discord_id>@discord.local if not provided

Next Steps

  • Implement OAuth flow (Google, Discord, Facebook)
  • Add automated tests (unit + integration)
  • Add CI/CD pipeline (GitHub Actions)
  • Implement payment processing
  • Add image upload management
  • Add email notifications
  • Implement search and filtering

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages