A starter project for building RESTful APIs using FastAPI and PostgreSQL.
- FastAPI for high-performance APIs
- PostgreSQL database integration
- SQLAlchemy ORM
- User Authentication
- Logging
- Error Handling
- Caching
- Docker
fastapi-postgres/
├── .gitattributes
├── .gitignore
├── README.md
└── app/
├── __init__.py
├── main.py
├── mocks/
└── src/
├── routes/
│ ├── __init__.py
│ ├── items.py
│ └── users.py
└── schema/
├── __init__.py
├── items.py
└── users.py
- Python 3.8+
- PostgreSQL
-
Clone the repository:
git clone https://github.com/yourusername/fastapi-postgres.git cd fastapi-postgres -
Create a virtual environment using
pyenvand activate it:pyenv install 3.8.18 # or your preferred Python version pyenv virtualenv 3.8.18 fastapi-postgres-env pyenv activate fastapi-postgres-env -
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables (see
.env.example). -
Run database migrations (if applicable).
uvicorn app.main:app --reloadThe API will be available at http://localhost:8000.
docker-compose up --buildThis project is licensed under the MIT License.