Welcome to the Full-Stack FastAPI and React template repository. This repository serves as a demo application for interns, showcasing how to set up and run a full-stack application with a FastAPI backend and a ReactJS frontend using ChakraUI.
The repository is organized into two main directories:
- frontend: Contains the ReactJS application.
- backend: Contains the FastAPI application and PostgreSQL database integration. Each directory has its own README file with detailed instructions specific to that part of the application.
To get started with this template, please follow the instructions in the respective directories:
- Docker and Docker Compose installed on your machine
- Node.js (version 14.x or higher) and npm (version 6.x or higher) for local frontend setup
- Python 3.8 or higher and Poetry for local backend setup
- PostgreSQL for database setup
- Navigate to the backend directory:
cd backend
- Install dependencies using Poetry:
poetry install
- Set up the database with the necessary tables:
poetry run bash ./prestart.sh
- Run the backend server with a specific IP address:
poetry run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
- Update configuration:
Ensure you update the necessary configurations in the
.env
file, particularly the database configuration.
- Navigate to the frontend directory:
cd frontend
- Install dependencies:
npm install
- Run the development server with a specific IP address:
npm run dev -- --host 0.0.0.0 --port 3000
- Configure API URL:
Ensure the API URL is correctly set in the
.env
file.
- Build and start the services:
docker-compose up --build
- Stop the services:
docker-compose down
- Ensure the
.env
files in bothfrontend
andbackend
directories are correctly configured. - The
docker-compose.yml
file defines the services for the frontend, backend, PostgreSQL, proxy manager, Adminer, and Nginx.