How smalldjangoking/fishmarket works
Project Type and Purpose
• This is a full-stack, monolithic Django web application (“FishMarket”) serving as an online seafood store.
• It exposes a browser-based UI (mainapp, cart, checkout, users apps), integrates with external services (Nova Poshta API for delivery, SMTP for email), runs asynchronous tasks (Celery), and offers a Telegram Bot for store managers.
File-Structure Analysis
• Root & Config
• manage.py, Dockerfile, docker-compose.yml, .env – orchestration & environment
• FishMarket/FishMarket – Django project settings (asgi.py, wsgi.py, celery.py, settings.py, urls.py)
• Django Apps
• mainapp – public listing, search, product pages
• cart – shopping-cart logic, bucket view templates, context processors
• checkout – order placement, Nova Poshta integration, checkout UI, delivery forms
• users – login/signup/email confirmation, profile, address & history
• novapost – scheduled tasks & helpers to sync delivery data via Nova Poshta API
• telegram – Aiogram-based Bot for managers: order status, notifications, commands
• Asynchronous
• celery.py in project root sets up Celery; tasks.py in novapost and telegram apps
• Static & Templates
• static/css/js per app + global static/ templates/base & includes
• Dependencies & Build
• Pipfile / requirements.txt, Docker, docker-compose to wire web server, DB, broker.
Key Insights from README
• Core features: browse & sort products, guest checkout vs. authenticated, discount & order history, Nova Poshta delivery options, manager tools via Django Admin & Telegram Bot.
• Tech stack: Python, Django, HTML/CSS/JS, jQuery, Aiogram, Celery.
a. Main Components
• Clients (Browsers: mobile & desktop)
• Django Web Server (Gunicorn/Uvicorn via ASGI/WSGI)
• Relational Database (PostgreSQL/MySQL)
• Message Broker (Redis or RabbitMQ)
• Celery Workers
• External Services:
– Nova Poshta REST API
– SMTP Email Service
– Telegram API (via Aiogram Bot)
• Static-File Store / CDN (optional)
b. Relationships & Data Flows
• HTTP(S) requests: Clients → Django Web Server → (views → models) → Database
• Django → External APIs:
– checkout app calls Nova Poshta for shipping info
– users app sends verification emails via SMTP
• Asynchronous
– Django enqueues tasks → Message Broker → Celery Workers
– novapost sync task fetches & updates delivery locations daily
– telegram tasks send real-time notifications & handle manager commands
• Django Admin & Telegram Bot both read/write orders in the Database
c. Architectural Patterns & Principles
• MVC (Django’s MTV): Templates (views) ↔ Models ↔ URL routes/controllers
• Modular apps: each domain feature in its own Django app
• CQRS-style separation of synchronous web traffic vs. asynchronous tasks
• External-Service Integration via well-defined adapters/helpers
d. Key Technologies
• Django (apps, ORM, templates, URL routing)
• Celery & Broker (task queue)
• Aiogram (Telegram Bot)
• Nova Poshta API helper module (novapost/novapost.py)
• Docker & docker-compose (containerization)