How digitales-2025/admin-viesglo works
Project Type and Purpose
• This is a full-stack administrative panel (MSM Consulting – Sistema de Gestión de Proyectos) built on Next.js (App Router), Tailwind, Shadcn/UI, TanStack Query/Table.
• It provides CRUD interfaces for clients, clinics, projects, certificates, medical records, user/role management, real-time MQTT features, reporting and analytics.
• There is also a DevOps subfolder with Jenkins pipelines, Dockerfiles, Ansible playbooks and Vault templates—so the repo contains both application code and infrastructure-as-code.
File Structure
• Top-level “src/app” holds the Next.js App Router pages and layouts, organized by route (auth, dashboard/admin, public).
• “src/shared” contains a component library (UI primitives, mqtt wrappers, hooks, services, stores, data schemas) shared across the app.
• “src/lib” provides low-level HTTP clients and type definitions for backend API contracts.
• “devops/” and “deploy/” contain CI/CD pipelines (Jenkinsfiles, Groovy scripts), Dockerfiles for dev/prod, Docker-Compose templates, Ansible playbooks for provisioning and service rollout, and Vault YAMLs for secret management.
• Configuration files at root: pnpm-lock.json, next.config.ts, tsconfig.json, lint/prettier, Git hooks.
README for Additional Insights
• Confirms stack: Node.js 18+, pnpm, Next.js 15, Tailwind v4, Shadcn, TanStack Query/Table.
• Mentions requirement of a database (MongoDB/PostgreSQL) and environment variables.
Main Components & Their Interactions
a. Browser (React client):
• Renders pages from Next.js, uses TanStack Query to call APIs and WebSocket/MQTT for real-time.
b. Next.js Server (Node.js):
• SSR/SSG of React pages, API routes or proxy to backend services, hosts static assets.
c. Backend API Service (separate microservice or next built-in API):
• Exposes REST/GraphQL endpoints for CRUD operations, implements business logic, communicates with database.
d. Database(s):
• MongoDB or PostgreSQL for persistent storage of projects, users, certificates, medical records.
e. MQTT Broker:
• Provides pub/sub real-time channels for notifications and live data (uses shared/mqtt wrappers).
f. CI/CD Pipeline & Infrastructure:
• Jenkins orchestrates build/test/deploy pipelines.
• Docker/Docker-Compose builds container images of the app.
• Ansible playbooks provision servers/containers and configure services.
• Vault for secret management.
Architectural Patterns & Design Principles
• Layered architecture: Presentation (Next.js pages) → Application (hooks/services/controllers) → Data (API clients, database).
• Component-based UI with Shadcn primitives and a shared component library.
• TanStack Query for data fetching/caching, promoting separation of concerns.
• MQTT integration via context providers and hooks—decouple real-time flows from business logic.
• Infrastructure-as-Code: Jenkinsfiles, Ansible, Dockerfiles, Vault.
Elements
• Components with clear labels: Browser, Next.js App, API Service, Database, MQTT Broker, Jenkins, Vault, Ansible, Docker Registry.
• Browser → Next.js (HTTP/SSR)
• Browser ↔ MQTT Broker (WebSocket/MQTT)
• Next.js → Backend API (REST/GraphQL)
• Backend API → Database (SQL/NoSQL)
• Jenkins → Docker Registry → Deployment Servers
• Ansible → Hosts for configuration
• Vault → Jenkins/Ansible for secret retrieval
• User-facing components (blue)
• Internal services (green)
• Infrastructure/DevOps (gray)
• Data stores (orange)
Putting It All Together
• Underneath, illustrate the DevOps pipeline: Jenkins pulling code, building Docker images, pushing to registry, Ansible deploying to servers, Vault providing secrets.