This repository contains a small study case designed to explore FastAPI, asynchronous APIs, background tasks, validation, and service-oriented application structure.
The goal is to simulate how a real backend service would behave when dealing with APIs, background processing, validation layers, and basic authentication mechanisms.
- FastAPI REST API with two endpoints:
/healht: Service status check./weather: Returns mocked weather data by city.
- Query parameter support (
city,unit) to simulate dynamic response. - Mocked weather data instead of external API integration.
- Basic request validation using Pydantic models.
- JWT authentication via request headers (
Authorization: Bearer <token>) - Background task executing using Celery workers.
- Scheduled tasks using Celery Beat (hourly simulation of data fetching)
- Redis integration as Celery broker.
- Structured logging across modules.
- Basic business rule validation before returning responses.
- Error handling for invalid requests and authentication failures.
uv sync # Install dependencies
uv run src/main.py # Start the app (localhost:8000)
uv run celery -A src.tasks.celery_app worker --beat --pool=solo --loglevel=info # Start Celery- No real external weather API integration.
- No persistent database layer.
- Authentication is simplified (no refresh tokens or user system)
- Celery setup is minimal and intended only for study purposes.
This project uses a .env file to manage sensitive configuration values,
such as the JWT secret used for token encoding and decoding.
Since this is a study case, the .env file is not included in the repository.
To run the project locally, create a .env file in the root directory with the
following content:
KEY=your_encoded_jwt_secret_key_here
SECRET=the_same_secret_used_to_encode_jwt_token_hereThese values are required for JWT generation and validation to work correctly.
This project was developed as a personal study case to better understand FastAPI and common backend patterns in Python applications. It is intentionally simplified and focuses on learning core concepts rather than production readiness.