Goal: Build a public API that provides event data for different cities. Focus on querying, filtering, and handling real-world structured data.
- FastAPI
- PostgreSQL
- SQLAlchemy + Alembic (for DB models and migrations)
- Use or clean up an open dataset like:
- Events in the UK
- Or generate 300β500 rows using Faker or Mockaroo
- Event title
- Description
- Date & Time
- Location (city, venue)
- Category (music, art, tech, etc.)
- Ticket price
- GET /events/getall β list all events
- GET /events/{id} β get a single event
- GET /events/search?city=London&category=tech β filter events
- POST /events β add new event
- PUT /events/{id} β update event
- DELETE /events/{id} β delete event
- Clean schema design
- Filtering with query parameters
- Data sorting and pagination
- Relationships (e.g., one city has many events)
Β
city_events_api/
βββ app/
β βββ __init__.py
β βββ main.py # FastAPI app instance
β βββ config.py # DB and app settings
| βββ logs/
β β βββ app.log # app log file
β βββ models/
β β βββ __init__.py
β β βββ event.py # SQLAlchemy Event model
β βββ schemas/
β β βββ __init__.py
β β βββ event.py # Pydantic schemas
β βββ crud/
β β βββ __init__.py
β β βββ event.py # DB logic (CRUD operations)
β βββ api/
β β βββ __init__.py
β β βββ routes_event.py # API route definitions
β βββ db/
β β βββ __init__.py
β β βββ session.py # DB connection
β β βββ base.py # Base class for models
β βββ utils/
| βββ logger.py # app logger to log the events.
β βββ populate.py # Script to load fake or real data
βββ alembic/ # DB migrations
β βββ ...
βββ alembic.ini
βββ requirements.txt
βββ README.md