How steevanj/aforro_backend works
Aforro is a Django REST backend for catalog, store inventory, product discovery, and order management. Its key workflow accepts an order, validates requested items, locks and checks store inventory, persists the order and items, and—only on confirmation—deducts stock and schedules asynchronous confirmation. The graph also preserves search/autocomplete, cached inventory, and seed-data capabilities documented or represented in the repository. Evidence is limited to the README and indexed excerpts or references; undocumented route wiring and some cache/task configuration details are not inferred.
Main entry points: order_create.py Order creation · product_search.py Product search · urls.py Django REST API · models.py Store inventory
Components 20
Catalog and discovery
- Products and categories
products/models.py - Product serializers
products/serializers - Product search
search/views/product_search.py - Autocomplete
search/views/product_suggest.py - Search pagination
search/pagination.py - Search results
search/serializers.py
Stores and inventory
- Store inventory
stores/models.py - Inventory API
stores/views.py - Inventory cache keys
stores/cache.py - Seed data command
stores/management/commands/seed_data.py
Order processing
- Order creation
orders/views/order_create.py - Orders and items
orders/models.py - Order serializers
orders/serializers/order_item.py
Async and caching
- Order confirmation task
orders/tasks.py - Celery configuration
config/celery.py - Celery worker
Other components
- API client
- PostgreSQL
- Redis
- Django REST API
config/urls.py
Connections 26
- API client → Django REST API: sends requests
README.md - Django REST API → Order creation: routes order requests
- Order creation → Order serializers: validates and serializes
orders/views/order_create.py - Order creation → Store inventory: locks and updates
orders/views/order_create.py - Order creation → Orders and items: creates and fetches
orders/views/order_create.py - Order creation → Order confirmation task: schedules on commit
orders/views/order_create.py - Order confirmation task → Orders and items: loads order
orders/tasks.py - Order confirmation task → Celery worker: runs asynchronously
README.md - Order confirmation task → Celery configuration: uses app configuration
orders/tasks.py - Django REST API → Product search: routes search requests
- Product search → Products and categories: queries products
search/views/product_search.py - Product search → Store inventory: filters stock
search/views/product_search.py - Product search → Search pagination: paginates results
search/views/product_search.py - Product search → Search results: serializes results
search/views/product_search.py - Django REST API → Autocomplete: routes suggestions
- Autocomplete → Products and categories: queries products
search/views/product_suggest.py - Django REST API → Inventory API: serves inventory
- Inventory API → Store inventory: queries inventory
stores/views.py - Inventory API → Inventory cache keys: builds cache key
stores/views.py - Inventory API → Redis: reads and writes cache
README.md - Order creation → Redis: invalidates inventory cache
- Seed data command → Products and categories: creates catalog data
stores/management/commands/seed_data.py - Seed data command → Store inventory: creates stores and stock
stores/management/commands/seed_data.py - Orders and items → PostgreSQL: persists order records
README.md - Products and categories → PostgreSQL: persists catalog
README.md - Store inventory → PostgreSQL: persists inventory
README.md