A fullstack online bookstore application with Vietnamese/English language support, built with React and Express.
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
- 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
Main models: User, Book, Category, Review, Cart, Order, Address
- Node.js >= 18
- PostgreSQL
git clone https://github.com/DuongCoder04/Book_Store_Repo.git
cd Book_Store_Repocd server
npm installCreate 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 seedStart the server:
npm run devServer runs at http://localhost:5000. API docs available at http://localhost:5000/api-docs.
cd client
npm install
npm run devClient runs at http://localhost:5173.
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)
| 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/* |
MIT