This FastAPI template is designed to jumpstart your API development journey. It comes pre-configured with FastAPI, PostgreSQL, Async SQLAlchemy, and Async requests with AIOHTTP.
- Docker
- Docker-compose
- Python >= 3.6
- Pipenv
Add Project Path:
Add the project path to the PYTHONPATH
variable in the .env
file.
Start Pipenv Environment:
pipenv shell
Select Python Interpreter: Select the Python interpreter using the Visual Studio Code menu.
Start Docker Services: Start the postgres database and pgadmin:
docker-compose up -d
Connect to PgAdmin
- Open your web browser and go to
http://127.0.0.1:5050
- Log in using the default credentials (username:
admin@gmail.com
, password:admin
). - Create a new connection:
- Name: Choose a name for your connection.
- Port:
5432
- Database:
fastapi-template
- Username:
admin
- Password:
admin
Initialize Database: Start the database (if necessary):
python3 database/init_db.py
Start FastAPI Application: Start the FastAPI application:
uvicorn main:app --port 8080 --reload
Access the Application: Open your browser and navigate to:
- Localhost: http://127.0.0.1:8080/
- FastAPI Docs: http://127.0.0.1:8080/docs
- PgAdmin: http://127.0.0.1:5050