Zippi is a monorepo containing a Python/Flask backend and a TypeScript/Vite frontend that share no runtime code but are versioned together. The backend follows a domain-driven design with four explicit horizontal layers and vertical module slices. The frontend is a single Vite application that renders one of several portal surfaces depending on the authenticated user’s role.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/CRISTIANCAMACH34/Zippi/llms.txt
Use this file to discover all available pages before exploring further.
Monorepo Layout
Flask App Factory
The backend is bootstrapped viacreate_app() in backend/app/bootstrap/app_factory.py. This factory pattern keeps the Flask application object decoupled from the module-level import chain, which is important for migrations (flask db upgrade skips middleware and route registration) and for test isolation.
/health and /ready endpoints for load-balancer checks, and a /metrics endpoint that renders Prometheus-formatted output.
DDD Layering
Every module underbackend/app/modules/ follows the same four-layer structure. Dependencies flow strictly downward — presentation may call application, application calls domain and infrastructure, but domain knows nothing about HTTP or SQL.
| Layer | Responsibility | Example files |
|---|---|---|
| Presentation | HTTP routes, request parsing, response serialization, guards | routes.py, guards.py, controllers.py |
| Application | Use-case orchestration, transaction boundaries | services.py, use_cases.py |
| Domain | Business rules, entities, state machine, RBAC | rbac.py, entities.py, order_state_machine.py |
| Infrastructure | SQLAlchemy repositories, Redis, S3, external APIs | repositories.py, orm.py |
Module Registry
Therouter.py file is the definitive list of all API modules. Blueprints registered there:
| Blueprint | URL prefix | Module |
|---|---|---|
auth_bp | /api/v1/auth | Authentication and JWT |
customer_auth_bp | /api/v1/auth | Customer-facing auth |
business_bp | /api/v1/business | Business portal endpoints |
businesses_bp | /api/v1/businesses | Multi-brand management |
marketplace_public_bp | /api/v1 | Public marketplace (no auth) |
cashier_bp | /api/v1/cashier | Till and payment collection |
clients_bp | /api/v1/clients | Customer profiles |
couriers_bp | /api/v1/couriers | Courier fleet management |
dashboard_bp | /api/v1/dashboard | Operative dashboards |
customer_orders_bp | /api/v1/orders | Customer order creation |
db_orders_bp | /api/v1/orders | Admin order operations |
evidence_bp | /api/v1/orders | Delivery evidence |
incidents_bp | /api/v1/orders | Order-linked incidents |
payments_bp | /api/v1/orders | Payment registration |
payments_webhook_bp | /api/v1/payments | Wompi webhook receiver |
reports_bp | /api/v1/reports | Analytics and exports |
service_types_bp | /api/v1/service-types | Service type catalog |
city_ops_bp | /api/v1/city | City operations and dispatch |
onboarding_bp | /api/v1/onboarding | Business onboarding |
customer_bp | /api/v1/customer | Customer profile endpoints |
platform_bp | /api/v1/platform | Platform admin |
whatsapp_bp | /api/v1/whatsapp | WhatsApp Cloud API (optional) |
The WhatsApp blueprint is registered inside a
try/except ModuleNotFoundError block. If the whatsapp module dependencies are not installed, the API starts normally without WhatsApp routes and logs a warning.Database: MySQL + SQLAlchemy
All persistent state lives in MySQL 8. SQLAlchemy is used as the ORM with Alembic for schema migrations. Key connection settings come from.env:
pool_size, max_overflow, pool_pre_ping) and isolation-level settings from app_factory.py. All financial amounts are stored as integers (centavos) or DECIMAL — never float.
Every operational entity carries tenant discriminator columns (id_negocio, id_sucursal) and an audit trail. No query runs without a scope filter applied at the query level. See Multi-Tenant Scoping for the full enforcement model.
Async Workers: Redis + Celery
Background jobs — push notifications, WhatsApp outbound messages, Wompi webhook processing, order assignment timeouts — are processed by Celery workers connected to Redis as the message broker and result backend.Frontend Portal Structure
The frontend is a single Vite application. Portal surfaces are driven by thesurface field in the JWT payload, which is set server-side from ROLE_DEFINITIONS in rbac.py. The src/ directory is organized by functional area:
kitchen_app, cashier_app, waiter_app, courier_app) are rendered within the app router based on the authenticated role’s surface value. The frontend uses a permission helper that mirrors backend/app/modules/auth/domain/rbac.py for rendering decisions (show/hide buttons, routes). The backend re-validates every request regardless of what the frontend claims.
VITE_USE_MOCKS: Set
VITE_USE_MOCKS=true in frontend/.env to run the frontend with static in-memory mock data. This bypasses all API calls and is intended for UI development only. Mocks do not enforce permissions or tenant scoping.External Integrations
| Integration | Purpose | Config prefix |
|---|---|---|
| Wompi | Payment gateway (Colombia) — card, Nequi, PSE | WOMPI_* |
| WhatsApp Cloud API | Order intake and status notifications via Meta Graph v22.0 | WHATSAPP_* |
| AWS S3 | Evidence photo and document storage (optional; defaults to local filesystem) | AWS_* |
| SMTP | Transactional email | MAIL_* |
| LLM local | Optional fine-tuned model for the WhatsApp bot | LLM_LOCAL_* |