How jmina117/convivencias_vivo_v2 works
Project type and purpose
• This is a full-stack web application named “Convivencia.”
• Backend: Django REST API (apps: authentication + convivencia + core + middleware).
• Frontend: Svelte/SvelteKit SPA (built with Vite).
• Data store: SQL Server accessed via ODBC.
• Deployment: Production behind Apache + Waitress, Development via Django runserver + Vite dev server.
File structure
• Top‐level dirs:
• convivencia_backend/ (Django project)
• frontend/ (SvelteKit application)
• config/ (Apache config, deployment scripts, systemd service)
• docs/ (deployment guide)
• Backend “convivencia_backend”:
• config/ (settings.py, database.py, ASGI/WSGI, URLs)
• authentication/ (models, admin, API serializers, views, permissions)
• convivencia/ (business logic API, models, serializers, views, custom queries, management commands)
• core/ (caching, debugging middleware, static views)
• middleware/ (CSRF, URL cleaning, reverse proxies)
• Frontend “frontend”:
• src/routes/ (page + layout components by feature)
• src/lib/ (reusable UI components, stores, utils, theming)
• vite.config.* (build vs SPA production)
• Deployment files:
• config/apache-prod.conf (Apache vhost + proxy rules)
• config/production/systemd/convivencia-backend.service
• PS1 scripts (setup, dev, prod, check).
README insights
• Dev workflow: start.ps1 dev runs Django on 5001 & Vite on 5174.
• Prod workflow: start.ps1 prod uses Waitress on 5001 behind Apache.
• Dependencies: Python 3.13, Node.js, SQL Server + ODBC Driver.
Main components
a. End User (Browser)
b. Apache HTTPD (Prod) / Vite Dev Server (Dev)—reverse proxy + static host
c. Django Application (Waitress/Wsgi or Runserver), with sub-components:
• URL Router & Middleware
• Apps: authentication, convivencia, core
• Management Commands
d. SQL Server (ODBC)
e. Frontend SPA (SvelteKit)
f. Optional: File system (static assets), Logging, Monitoring
g. Environment and Deployment Scripts (setup.ps1, systemd)
Relationships and data flows
• Browser → Apache (HTTP GET static files, proxy “/api/” to Django) → Django
• Dev: Browser → Vite Dev Server (hot reload) & API calls → Django runserver
• Django → ODBC Driver → SQL Server
• Django middleware (CSRF, URL cleaning, reverse proxy logic) intercept requests
• Frontend stores manage auth tokens and cache; calls backend via REST endpoints
• Management commands (e.g., cache_manage, setup_auth) invoked from CLI
Architectural patterns & design principles
• Layered architecture: Presentation (SPA) / Application (Django views/serializers) / Data (models/queries)
• Modular apps in Django following Django-app pattern
• Separation of concerns: authentication vs business logic
• Custom query manager pattern for chart data
• CLI management commands for operational tasks
• Dev vs Prod environments abstracted by PS1 scripts and config files
Essential elements to capture
• Clear labels on components (e.g., “Authentication API,” “Chart Queries”)
• Annotations for environment‐specific behavior (dev vs prod servers)
• External dependencies (SQL Server ODBC driver, Node.js)
• Related files/configs near their runtime component