Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lostclus/weatherapp
My pet project
https://github.com/lostclus/weatherapp
demo django fastapi kafka micorservices python
Last synced: 4 days ago
JSON representation
My pet project
- Host: GitHub
- URL: https://github.com/lostclus/weatherapp
- Owner: lostclus
- License: bsd-2-clause
- Created: 2024-10-08T12:32:07.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-02T20:19:04.000Z (14 days ago)
- Last Synced: 2024-11-02T21:19:52.882Z (14 days ago)
- Topics: demo, django, fastapi, kafka, micorservices, python
- Language: Python
- Homepage:
- Size: 2.59 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WeatherApp
My pet project. Just a demo web application to demonstrate code and
technologies.Features:
- User registration and authentication
- User settings form
- CRUD on user locations
- Query weather data on selected location
- Under the hood it loads weather data from Open-Meteo API and store it in the local databaseTech stack on backend:
- Python
- Django, FastAPI
- Celery, ARQ
- PostgreSQL, Redis, Kafka, ClickHouseTech stack on frontend:
- TypeScript/React
- Material UIThis project use my open source Python libraries:
- aiosafeconsumer
- django-kafka-streamerCode quality:
- PEP8 (linted by black and ruff)
- Static typing (validated by mypy)
- Unit and integration tests (powered by pytest)Architecture: micro services. Services:
`core`
: Core service. Stack: Django, PostgreSQL, Celery. Provides user and locations
database and REST API. Stream data to Kafka.`loader`
: Data loader service. Stack: ARQ, Redis, Kafka. Provides asynchronous periodic
tasks to load weather data from public API and stream it to Kafka.`query`
: Weather data query service. Stack: FastAPI, Kafka, ClickHouse. Provides
weather database and REST API.`ui`
: User interface. Stack: TypeScript/React, Material UI.Development plan:
- [x] Implement authorization API in `core` service
- [x] Implement authorization in UI
- [x] Implement user settings API in `core` service
- [x] Implement user settings form in UI
- [x] Implement locations API (CRUD) in `core` service
- [x] Implement locations CRUD in UI
- [x] Implement streaming data from `core` service to Kafka
- [x] Implement consumer to sync locations data in `loader` service
- [x] Implement asynchronous tasks in `loader` to get weather data from public API
and stream it to Kafka
- [x] Implement consumer to sync weather data in `query` service
- [x] Implement weather API in `query` service
- [x] Implement weather explore page in UI
- [x] Implement weather dashboard UI
- [x] Implement weather aggregation API
- [x] Implement weather aggregation UI## Local Deploy
First install Docker Compose, then type:
docker compose build
docker compose run --rm core-migrate
docker compose run --rm query-migrate
docker compose up -d
docker compose run --rm core-stream
docker compose run --rm loader-streamAvailable URLs:
: Application user interface
: Admin interface
: core API documentation
: query API documentation
## Usage
Go to UI and create new user (sign-up). Type email and
password. No email confirmation is required. The first user created will have
superuser privileges and can login to the admin area. Then login (sign-in) and
use left side menu to navigate over site.## Other Console Commands
Run linters:
make lint
Run tests:
docker compose run --rm core-test
docker compose run --rm loader-test
docker compose run --rm query-testLoad more historical data:
docker compose run --rm loader-stream python -m weatherapp_loader.tasks.run stream-weather 2022-01-01