# ader999/nimypine architecture

> Architecture diagram of the GitHub repository ader999/nimypine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ader999/nimypine
- Repository: https://github.com/ader999/nimypine

## Overview

##### Project type and purpose
- This is a full-stack monolithic web application built on Django (Python 3.12, Django 5.1.4).
- Purpose: Provide MIPYMEs with tools to standardize production, manage costs/insumos, calculate lotes, run a resource marketplace, log ventas, manage equipos, and offer an AI-powered asistente.

##### File structure
- Top-level directories (each a Django app):
- asistente/       – Virtual assistant (api_urls.py, api_views.py, serializers, models)
- cuentas/         – User & company management (custom backends, forms, decorators, management commands)
- marketplace/     – Upload/share/purchase/download resources (models, views, forms)
- produccion/      – Production processes, insumos, formulaciones, ventas (models, serializers, signals)
- mipymes_project/ – Django project config (settings.py, urls.py, wsgi/asgi)
- Shared folders:
- templates/       – HTML templates organized per app
- static/          – CSS, JS, assets
- Configuration/deployment:
- Procfile, runtime.txt (Heroku/Railway), entrypoint.sh, requirements.txt, .env variables for SECRET_KEY, DATABASE_URL, DEBUG.

##### Key insights from README
- Features map directly to the apps above.
- Uses PostgreSQL in production, SQLite in dev.
- Auth via Django auth, role-based access.
- Future roadmap includes payment, notifications, analytics.

##### Detail
- How URL routing delegates to either a view (HTML) or an API view (JSON)
- User roles and where RBAC is enforced (e.g., cuentas/backends)
- Major flows: user login, data CRUD, file upload/download, assistant queries, marketplace transactions

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Client["Web Browser / Mobile Client"]:::ui

    %% Web Server Layer
    WebServer["Gunicorn / uWSGI\nDjango Web Server"]:::backend

    %% Presentation Layer
    Presentation["Templates & Static Assets"]:::ui
    StaticFiles["Static Files (CSS/JS)"]:::ui

    %% Django Monolith
    subgraph "Django Monolith"
        Router["URL Router\n(mipymes_project/urls.py)"]:::backend
        subgraph "Domain Modules"
            Asistente["Virtual Assistant App"]:::backend
            Cuentas["User & Company Management App"]:::backend
            Marketplace["Resource Marketplace App"]:::backend
            Produccion["Production Processes App"]:::backend
        end
    end

    %% Data Layer
    DB[(PostgreSQL Database)]:::db

    %% External Services
    Email["Email Service (SMTP/SendGrid)"]:::external
    ObjectStorage["Object Storage (S3/MinIO)"]:::external
    AIService["AI / NLP External Service"]:::external

    %% Connections
    Client --> WebServer
    WebServer --> Presentation
    WebServer --> StaticFiles
    WebServer --> Router
    Router --> Asistente
    Router --> Cuentas
    Router --> Marketplace
    Router --> Produccion

    Asistente --> DB
    Cuentas --> DB
    Marketplace --> DB
    Produccion --> DB

    Cuentas --> Email
    Marketplace --> ObjectStorage
    Asistente --> AIService

    %% Click Events
    click Asistente "https://github.com/ader999/nimypine/tree/main/asistente/"
    click Cuentas "https://github.com/ader999/nimypine/tree/main/cuentas/"
    click Marketplace "https://github.com/ader999/nimypine/tree/main/marketplace/"
    click Produccion "https://github.com/ader999/nimypine/tree/main/produccion/"
    click Router "https://github.com/ader999/nimypine/blob/main/mipymes_project/urls.py"
    click Presentation "https://github.com/ader999/nimypine/tree/main/templates/"
    click StaticFiles "https://github.com/ader999/nimypine/tree/main/static/"

    %% Styles
    classDef ui fill:#d4f8d4,stroke:#333,stroke-width:1px
    classDef backend fill:#cce0ff,stroke:#333,stroke-width:1px
    classDef external fill:#ffe0b3,stroke:#333,stroke-width:1px
    classDef db fill:#e0e0e0,stroke:#333,stroke-width:1px
```
