- 📱 Responsive Design: Works seamlessly on desktop and mobile devices
- 🔐 User Authentication: Secure login with JWT tokens
- 🛒 Shopping Cart: Add books to cart, adjust quantities, and checkout
- ⭐ Reviews & Ratings: Read and write book reviews with star ratings
- 💰 Discounts: Special offers and discounts on selected books
- 🔍 Search & Filter: Find books by category, author, or rating
- 🌐 Multilingual: Support for English and Vietnamese
- 💵 Multi-currency: Support for USD and VND
- Docker and Docker Compose
- Git
-
Clone the repository
git clone https://github.com/yourusername/bookworm.git cd bookworm -
Set up environment variables
cp .env.example .env
Edit the
.envfile and set a secureSECRET_KEYfor JWT token generation:SECRET_KEY=your_secure_secret_key_here -
Build and start the containers
docker-compose up -d
This will start three containers:
- Frontend (React): http://localhost:5173
- Backend (FastAPI): http://localhost:8000
- Database (PostgreSQL)
-
Seed the database (optional)
To populate the database with sample data, set
SEED_ON_STARTUP=truein your.envfile before starting the containers, or run:docker-compose exec backend python -m scripts.seed_db -
Access the application
Open your browser and navigate to http://localhost:5173
bookworm/
├── frontend/ # React frontend
│ ├── src/ # Source code
│ ├── public/ # Static assets
│ └── Dockerfile # Frontend Docker configuration
├── backend/ # FastAPI backend
│ ├── api/ # API endpoints and business logic
│ ├── models/ # Database models
│ ├── scripts/ # Utility scripts
│ └── Dockerfile # Backend Docker configuration
├── docker-compose.yml # Docker Compose configuration
└── .env # Environment variables
The default Docker Compose setup mounts your local directories as volumes, so any changes you make to the code will be reflected in the running containers:
- Frontend changes will trigger automatic reloading thanks to Vite's hot module replacement
- Backend changes will be automatically reloaded by Uvicorn's
--reloadflag
Once the backend is running, you can access the auto-generated API documentation:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
docker-compose exec backend pytestdocker-compose exec frontend npm testFor production deployment, make the following changes:
- Set
ENVIRONMENT=productionin your.envfile - Set
COOKIE_SECURE=Trueto ensure cookies are only sent over HTTPS - Use a proper domain name and HTTPS certificates
- Consider using a managed database service instead of the Docker PostgreSQL container
- FastAPI - Modern, fast web framework for building APIs
- React - A JavaScript library for building user interfaces
- Tailwind CSS - Utility-first CSS framework
- DaisyUI - Tailwind CSS component library
- PostgreSQL - Advanced open source database
