Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Eakan-Git/Bookworm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

208 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📚 Bookworm

Bookworm Logo

A Modern Online Bookstore

Built with React, FastAPI, and PostgreSQL

React 19 TypeScript 5 FastAPI 0.115 PostgreSQL 16 Docker Compose


🌟 Features

  • 📱 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

🚀 Getting Started

Prerequisites

  • Docker and Docker Compose
  • Git

Quick Start

  1. Clone the repository

    git clone https://github.com/yourusername/bookworm.git
    cd bookworm
  2. Set up environment variables

    cp .env.example .env

    Edit the .env file and set a secure SECRET_KEY for JWT token generation:

    SECRET_KEY=your_secure_secret_key_here
    
  3. Build and start the containers

    docker-compose up -d

    This will start three containers:

  4. Seed the database (optional)

    To populate the database with sample data, set SEED_ON_STARTUP=true in your .env file before starting the containers, or run:

    docker-compose exec backend python -m scripts.seed_db
  5. Access the application

    Open your browser and navigate to http://localhost:5173

🛠️ Development

Project Structure

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

Running in Development Mode

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 --reload flag

API Documentation

Once the backend is running, you can access the auto-generated API documentation:

🧪 Testing

Running Backend Tests

docker-compose exec backend pytest

Running Frontend Tests

docker-compose exec frontend npm test

🚢 Deployment

For production deployment, make the following changes:

  1. Set ENVIRONMENT=production in your .env file
  2. Set COOKIE_SECURE=True to ensure cookies are only sent over HTTPS
  3. Use a proper domain name and HTTPS certificates
  4. Consider using a managed database service instead of the Docker PostgreSQL container

🙏 Acknowledgements

  • 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

About

ReactJS + FastAPI bookshop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors