A simple REST API to manage games using FastAPI, SQLModel, and PostgreSQL (hosted on Azure).
- CRUD Operations: Create, Read, Update, and Delete games.
- SQLModel for database interactions.
- FastAPI for building RESTful APIs.
- PostgreSQL hosted on Azure.
- Python 3.8+
- PostgreSQL (Azure or Local)
- FastAPI & SQLModel
git clone https://github.com/RahulMule/fastapi-sqlmodel-demo
cd fastapi-sqlmodel-demopython -m venv .venv
source .venv/bin/activate # On Windows use: .venv\Scripts\activatepip install -r requirements.txtUpdate the database/db.py file with your PostgreSQL connection string:
DATABASE_URL = "postgresql://username:password@hostname:port/database_name"uvicorn app.main:app --reloadOnce running, you can explore the API with Swagger UI:
- 🚀 Open: http://127.0.0.1:8000/docs
POST /games/Request Body:
{
"title": "Elden Ring",
"genre": "RPG",
"platform": "PC",
"release_year": 2022
}GET /games/GET /games/{game_id}PUT /games/{game_id}Request Body:
{
"title": "Elden Ring: Shadow Edition",
"genre": "RPG",
"platform": "PC",
"release_year": 2023
}DELETE /games/{game_id}- FastAPI - High-performance web framework
- SQLModel - ORM for structured data
- PostgreSQL - Database hosted on Azure
- Uvicorn - ASGI server
- Fork the repo & create a new branch.
- Make changes and commit them.
- Open a Pull Request.
This project is licensed under the MIT License.
🚀 Happy Coding! 🎮