This is a full-stack web application consisting of:
- Backend (Python + FastAPI + PostgreSQL)
- Frontend (React.js)
project-root/
β
βββ backend/
β βββ app/
β β βββ models/ # SQLAlchemy models
β β βββ routes/ # API routes
β β βββ schemas/ # Pydantic schemas for request/response validation
β β βββ app_instance.py # App factory or shared app instance
β β βββ db.py # DB connection and session management
β β βββ Dockerfile # Docker image for FastAPI backend
β β βββ main.py # Main FastAPI app entry point
β βββ db/
β β βββ init/ # SQL scripts executed when the PostgreSQL DB is initialized
β βββ docker-compose.yml # Docker Compose config for backend and database
β βββ README.md
β
βββ frontend/
β βββ public/ # Static files
β βββ src/ # React source code
β βββ package.json # Frontend dependencies and scripts
β βββ README.md
β
βββ README.md # You're here!
- Docker + Docker Compose
cd backend
docker compose upThis will:
- Build the FastAPI backend container
- Start a PostgreSQL container
- Initialize the database using SQL files in
db/init/
The backend will be available at http://localhost:8000.
FastAPI docs: http://localhost:8000/docs
- Node.js (v18+ recommended)
- npm
cd frontend
npm install
npm startThe React app will be available at http://localhost:3000.
Backend:
- FastAPI
- SQLAlchemy
- PostgreSQL
- Docker
Frontend:
- React.js
- JavaScript
SQL files located in backend/db/init/ are executed automatically the first time the PostgreSQL container is started. These scripts typically:
- Create tables and schema
- Insert default or sample data
You can configure the database and app settings via environment variables in the docker-compose.yml. For local development, defaults are usually provided.