Skip to content

DuongCoder04/Book_Store_Repo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BookStore

A fullstack online bookstore application with Vietnamese/English language support, built with React and Express.

Tech Stack

Client: React 19, TypeScript, Vite, Tailwind CSS 4, Zustand, React Router 7, i18next, Recharts

Server: Express 5, TypeScript, Prisma ORM, PostgreSQL, JWT Authentication, Zod, Swagger

Features

  • User authentication (register, login, JWT with refresh token)
  • Browse and search books by title, author, category
  • Book reviews and ratings
  • Shopping cart management
  • Order checkout with VietQR payment
  • Multi-language support (Vietnamese / English)
  • Admin dashboard with analytics
  • Admin management: books, categories, orders, users
  • Image upload for books
  • Responsive design

Database Schema

Main models: User, Book, Category, Review, Cart, Order, Address

Prerequisites

  • Node.js >= 18
  • PostgreSQL

Getting Started

1. Clone the repository

git clone https://github.com/DuongCoder04/Book_Store_Repo.git
cd Book_Store_Repo

2. Setup Server

cd server
npm install

Create a .env file in the project root:

# Database
DATABASE_URL="postgresql://postgres:password@localhost:5432/bookstore"

# JWT
JWT_ACCESS_SECRET="your-access-secret"
JWT_REFRESH_SECRET="your-refresh-secret"
JWT_ACCESS_EXPIRES_IN="15m"
JWT_REFRESH_EXPIRES_IN="7d"

# Server
PORT=5000
CLIENT_URL="http://localhost:5173"

# VietQR
VIETQR_BANK_ID="970422"
VIETQR_ACCOUNT_NO="your-account-no"
VIETQR_ACCOUNT_NAME="YOUR_NAME"
VIETQR_TEMPLATE="compact2"

Run database migrations and seed:

npx prisma migrate dev
npm run seed

Start the server:

npm run dev

Server runs at http://localhost:5000. API docs available at http://localhost:5000/api-docs.

3. Setup Client

cd client
npm install
npm run dev

Client runs at http://localhost:5173.

Project Structure

BookStore/
├── client/                 # React frontend
│   └── src/
│       ├── components/     # Reusable UI components
│       ├── features/       # Feature modules (auth, books, cart, admin...)
│       ├── hooks/          # Custom hooks
│       ├── lib/            # Axios config, utilities
│       ├── locales/        # i18n translation files
│       ├── routes/         # Route guards
│       └── store/          # Zustand stores
├── server/                 # Express backend
│   ├── prisma/             # Schema & migrations
│   └── src/
│       ├── controllers/    # Request handlers
│       ├── middlewares/    # Auth, validation, upload
│       ├── routes/         # API routes
│       ├── services/       # Business logic
│       ├── utils/          # JWT, password, pagination
│       └── validators/     # Zod schemas
└── .env                    # Environment variables (not committed)

API Endpoints

Resource Endpoints
Auth /api/auth/*
Books /api/books/*
Categories /api/categories/*
Cart /api/cart/*
Orders /api/orders/*
Reviews /api/reviews/*
Users /api/users/*
Payments /api/payments/*

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages