How prok0l/nakormi works
Project type and purpose
• This is a two-part Python system:
• A Django-based REST API server (“nakormi_back”) that manages users, points, feeds, and core business logic.
• A Telegram Bot service (“nakormi_bot”) that interacts with end users via the Telegram API and forwards requests to the backend.
• The README confirms this: you install dependencies for each, configure .env files, run the Django server, then launch the bot.
File structure
• Top-level directories:
• nakormi_back/ – a standard Django project (apps: feed, main, point, user).
• nakormi_bot/ – an event-driven bot with modules for handlers, middlewares, entities, services, keyboards, phrases, etc.
• Deployment artifacts:
• docker-compose.yaml orchestrates at least the backend + database.
• Two Dockerfiles for backend and bot.
• Look for patterns:
• Django uses MVC (Models, Views, Serializers, URLs).
• Bot follows a command/handler pattern with a service layer (services/api) that calls the backend.
README for additional insights
• Environment variables: database connectivity for backend; API address and secrets for the bot.
• Startup steps: migrate and run Django, then launch the bot as a Python module.
a. Main components
• Telegram End User (people chatting in Telegram)
• Telegram API (external service)
• Bot Service (nakormi_bot)
• REST API Server (nakormi_back)
• Database (PostgreSQL or similar)
• (Optionally) Docker-Compose / Kubernetes orchestrator
b. Relationships & data flows
1. User → Telegram API → Bot Service → Backend API → Database
2. Bot Service ← Backend API responses ← Database
3. Bot Service → Telegram API → User
4. Backend API’s Django apps interact internally (feed, point, user, main)
c. Architectural patterns & design principles
• Backend: Monolithic Django REST app with clearly separated apps (each app has models, serializers, views, URLs).
• Bot: Modular handler-based design, with a thin “service” layer that wraps HTTP calls to the API.
• Use of environment-based configuration, Docker for immutability, and a clear client-server boundary.
d. Key technologies & frameworks
• Python 3.x, Django, Django REST Framework
• Telegram Bot API (via python-telegram-bot or similar)
• Docker & docker-compose
• PostgreSQL (or any RDBMS configured via .env)