A minimal full-stack web application boilerplate for quick Proof-of-Concept development.
- Backend: Python FastAPI with SQLite database
- Frontend: React with TypeScript
- Authentication: Session-based with HTTP-only cookies
- Containerization: Docker Compose
- Session-based authentication (no JWT)
- User registration and login
- Protected routes
- Basic user CRUD operations
- Password hashing with bcrypt
- SQLAlchemy ORM
- CORS configured
- Hot reload for development
.
├── backend/
│ ├── app/
│ │ ├── api/ # API endpoints
│ │ ├── core/ # Security and dependencies
│ │ ├── db/ # Database configuration
│ │ ├── models/ # SQLAlchemy models
│ │ ├── schemas/ # Pydantic schemas
│ │ └── main.py # FastAPI application
│ ├── Dockerfile
│ └── requirements.txt
├── frontend/
│ ├── public/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── contexts/ # Auth context
│ │ ├── pages/ # Page components
│ │ ├── services/ # API services
│ │ ├── types/ # TypeScript types
│ │ ├── App.tsx
│ │ └── index.tsx
│ ├── Dockerfile
│ ├── Dockerfile.dev
│ ├── nginx.conf
│ └── package.json
├── docker-compose.yml
├── docker-compose.dev.yml
└── README.md
- Docker and Docker Compose installed
- Git
- Clone the repository:
git clone <repository-url>
cd boilerplate-react-python- Start the development environment:
docker-compose -f docker-compose.dev.yml up --build- Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Build and start the containers:
docker-compose up --build- Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
POST /auth/register- Register a new userPOST /auth/login- Login and create sessionPOST /auth/logout- Logout and clear sessionGET /auth/me- Get current user (protected)
GET /users/- Get all users (protected)GET /users/{id}- Get user by ID (protected)DELETE /users/{id}- Delete user (protected)
The backend uses FastAPI with hot reload enabled in development mode. Any changes to Python files will automatically restart the server.
The frontend uses Create React App with hot reload. Changes to React components will be reflected immediately.
SQLite database file (app.db) is created automatically on first run. It's stored in the backend volume.
PYTHONUNBUFFERED=1- Ensures Python output is sent straight to terminal
REACT_APP_API_URL- Backend API URL (default: http://localhost:8000)CHOKIDAR_USEPOLLING=true- Enables hot reload in Docker
- Change the SECRET_KEY in
backend/app/core/security.pyfor production use - Enable HTTPS and set
secure=Truefor cookies in production - Session tokens expire after 7 days
- Passwords are hashed using bcrypt
- Navigate to http://localhost:3000/register
- Enter email and password
- Click "Register"
- Navigate to http://localhost:3000/login
- Enter credentials
- Click "Login"
After logging in, you can access:
- Dashboard: http://localhost:3000/dashboard
- Users list: http://localhost:3000/users
docker-compose downOr for development:
docker-compose -f docker-compose.dev.yml downTo remove all containers, volumes, and images:
docker-compose down -v --rmi allThis boilerplate is designed to be minimal and easy to customize:
- Add new models in
backend/app/models/ - Add new API endpoints in
backend/app/api/ - Add new React pages in
frontend/src/pages/ - Add new components in
frontend/src/components/
- Check if port 8000 is already in use
- Check logs:
docker-compose logs backend
- Check if port 3000 is already in use
- Check logs:
docker-compose logs frontend
- Remove the volume and restart:
docker-compose down -v && docker-compose up
- Ensure the frontend URL is in the
allow_originslist inbackend/app/main.py
See LICENSE file for details.