Welcome to the React FastAPI repository! This project serves as a full stack, modern web application template, combining powerful technologies like FastAPI, React, SQLModel, PostgreSQL, and Docker. With built-in GitHub Actions, automatic HTTPS, and more, this template is designed to help you build robust applications efficiently.
- FastAPI Backend: Build APIs quickly with FastAPI's modern features.
- React Frontend: Create interactive user interfaces with React.
- PostgreSQL Database: Utilize a powerful relational database for data management.
- SQLModel: Simplify database interactions with SQLModel.
- Docker Support: Easily containerize your application for consistent environments.
- Automatic HTTPS: Secure your application with automatic HTTPS using Let's Encrypt.
- GitHub Actions: Automate your workflows with CI/CD.
- OpenAPI & Swagger: Generate API documentation automatically.
- TypeScript Support: Enhance code quality with TypeScript.
- State Management: Manage application state effectively using TanStack Query and Router.
- Chakra UI: Build accessible React applications with Chakra UI.
This repository includes the following technologies:
- Backend: FastAPI, PostgreSQL, SQLModel, Python
- Frontend: React, TypeScript, Chakra UI
- Containerization: Docker
- Automation: GitHub Actions
- Security: Let's Encrypt, JWT
- API Documentation: OpenAPI, Swagger
- Data Management: TanStack Query, TanStack Router
To get started with the React FastAPI template, follow these steps:
Make sure you have the following installed:
Clone the repository to your local machine:
git clone https://github.com/RAAJSURIYAA/react-fastapi.git
cd react-fastapi
Create a .env
file in the root directory and add your configuration variables. Hereβs a sample:
DATABASE_URL=postgresql://user:password@localhost/dbname
SECRET_KEY=your_secret_key
To build and run the application using Docker, execute the following command:
docker-compose up --build
This command will set up the backend and frontend services, along with the PostgreSQL database.
Once the application is running, you can access it in your web browser:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000/docs
Hereβs an overview of the folder structure in this repository:
react-fastapi/
βββ backend/ # FastAPI backend
β βββ app/ # Application code
β βββ Dockerfile # Dockerfile for backend
β βββ requirements.txt # Python dependencies
β βββ main.py # Entry point for FastAPI
βββ frontend/ # React frontend
β βββ public/ # Public assets
β βββ src/ # Source code
β βββ Dockerfile # Dockerfile for frontend
β βββ package.json # Node.js dependencies
βββ docker-compose.yml # Docker Compose configuration
βββ .env # Environment variables
The backend API exposes several endpoints. You can explore them using the Swagger UI at http://localhost:8000/docs.
Here are some example endpoints:
GET /items/
: Retrieve all items.POST /items/
: Create a new item.GET /items/{item_id}
: Retrieve a specific item.PUT /items/{item_id}
: Update a specific item.DELETE /items/{item_id}
: Delete a specific item.
The frontend consists of various components that utilize Chakra UI for styling. You can find the main components in the src
directory.
To run the frontend separately, navigate to the frontend
directory and run:
npm install
npm start
We welcome contributions! To contribute to the React FastAPI project, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeature
). - Make your changes and commit them (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeature
). - Open a pull request.
Please ensure your code follows the project's coding standards and passes all tests.
This project is licensed under the MIT License. See the LICENSE file for details.
For the latest releases, visit here. You can download the latest version and execute it to get started.
Feel free to explore the code, make changes, and use this template for your projects!