This project demonstrates how to set up a FastAPI application with PostgreSQL and pgAdmin using Docker Compose. It provides a backend API built with FastAPI, a PostgreSQL database, and a pgAdmin interface for database management.
- FastAPI: A modern, fast (high-performance) web framework for building APIs with Python.
- PostgreSQL: A powerful, open-source object-relational database system.
- pgAdmin: A web-based GUI for managing PostgreSQL databases.
- Docker Compose: Simplifies the process of setting up and managing multi-container Docker applications.
- Docker and Docker Compose installed on your system.
- Python (if you want to manage dependencies locally).
-
Clone the repository:
git clone <repository-url> cd <repository-folder>
-
Copy the example environment file and configure it:
cp .env.example .env
Update the
.envfile with your desired configuration. -
Build and start the Docker containers:
docker compose up --build
-
Access the application:
- FastAPI: http://localhost:8000
- Swagger UI: http://localhost:8000/docs
- pgAdmin: http://localhost:5050
.
├── backend/
│ ├── Dockerfile # Dockerfile for the FastAPI backend
│ ├── requirements.txt # Python dependencies
│ └── app/
│ └── main.py # FastAPI application entry point
├── docs/
│ ├── sql_commands.sql # SQL commands for database setup
│ └── screenshots/ # Screenshots for documentation
├── docker-compose.yml # Docker Compose configuration
└── README.md # Project documentation
- To stop the containers:
docker compose down
- To rebuild the containers after making changes:
docker compose up --build
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Feel free to open issues or submit pull requests.