Skip to content

About

Simple ticket-api project using docker-compose, redis, rabbitmq, fastAPI, alembic, SQLAlchemy, mySQL, pydantic

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Structure

app/ - application code routes/ - HTTP endpoints services/ - business logic models.py - database models schemas.py - request/response validation tests/ - automated tests

requirements.txt - python dependencies dockerfile - how to build the API container (starts app using uvicorn) docker-compose.yml - defines the environment (runs whole backend ecosystem: API service, MySQL db, redis, rabbitMQ, all connected via internal docker network)

hostnames: db - MySQL redis - Redis rabbitmq - RabbitMQ (we don't use localhost)

.env - config (db credentials, service hostnames) out of code

mysql_data - volume for persistent db storage (prevents losing data when container restarts)

The services/ folder is meant for: business rules. complex operations, cross-table logic, external integrations (Redis, RabbitMQ, etc.), reusable logic across routes

Redis: to cache events RabbitMQ: to process orders asynchronously

How to run

(from inside ticket-api)

docker compose down # if you want to restart
docker compose up --build

When you change database models

(e.g. you change things in models.py)

Run ./scripts/dev_migrate.sh which will use alembic to generate and apply a migration

Restart containers: docker compose up

How to test/debug

Go to localhost:8000/docs for the swagger UI

Check /openapi.json for the open api file generated by FastAPI

About

Simple ticket-api project using docker-compose, redis, rabbitmq, fastAPI, alembic, SQLAlchemy, mySQL, pydantic

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages