# creadordesistemas/activa-asesores-mejorado architecture

> Architecture diagram of the GitHub repository creadordesistemas/activa-asesores-mejorado, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/creadordesistemas/activa-asesores-mejorado
- Repository: https://github.com/creadordesistemas/activa-asesores-mejorado

## Overview

1. **Overall shape**
   - This is a **Next.js 14 App Router** site, not a monolithic SPA.
   - The repo is split into **server-rendered route segments** under `app/`, **shared UI components** under `components/ui`, and a small **backend/API surface** in `app/api`.
   - Most of the site is a **corporate/SEO content site** with many landing pages, plus a small admin/config area and contact/chat endpoints.

2. **Request entry and global shell**
   - `app/layout.js` is the root shell for every route, and the README indicates it provides the shared **Navbar + Footer**.
   - `app/globals.css` defines global styling and design tokens, while Tailwind is the main styling system.
   - Framework-level fallbacks exist in `app/error.js`, `app/loading.js`, and `app/not-found.js`, so the app relies on Next’s route boundaries for runtime behavior.

3. **Route composition model**
   - Each folder under `app/` is a route segment with its own page component, e.g. `/contacto`, `/quienes-somos`, `/aviso-legal`, and the larger content trees under `/energia` and `/gestiones`.
   - Most pages appear to be **independent content pages** rather than feature screens sharing a lot of client-side state.
   - This structure is well suited to an architecture diagram centered on **route groups** rather than app modules.

4. **Content clusters and SEO landing pages**
   - The repo contains a large `/energia` cluster with calculators, company pages, rates, and invoice-related pages.
   - There is also a `/gestiones` cluster for administrative energy procedures like supply changes and power increases.
   - These clusters look like **SEO-driven landing pages**: each page is likely self-contained, server-rendered, and optimized for search rather than built from a single dynamic data model.

5. **Shared UI layer**
   - `components/ui` holds reusable interface building blocks: `Navbar`, `Footer`, `LegalLayout`, `TestimonialsScroll`, `WhatsAppBubble`, `PhoneCTAClient`, `CookieBanner`, and `ContactForm`.
   - `LegalLayout` is the clearest boundary for repeated legal pages, indicating the legal pages share a common presentation pattern.
   - `Navbar` and `Footer` are the core structural components that frame all routes through the root layout.

6. **Client-side behavior**
   - Several components are clearly client-side interaction layers: `CookieBanner`, `PhoneCTAClient`, `WhatsAppBubble`, `TestimonialsScroll`, and likely `ContactForm`.
   - These components handle **session/UI concerns** such as consent, CTA interactions, sticky messaging, scrolling testimonials, and user input.
   - They sit on top of otherwise mostly static pages, so the site mixes **server-rendered content with lightweight client widgets**.

7. **Configuration and site-wide state**
   - `lib/config.json`, `lib/config-helper.js`, and `components/ui/ConfigContext.js` form a configuration layer for site settings.
   - This suggests some copy, contact details, or feature flags can be managed centrally and propagated to UI through context.
   - The presence of admin config endpoints reinforces that site configuration is a first-class concern, not hardcoded everywhere.

8. **Backend/API surface**
   - The app exposes route handlers in `app/api/contact/route.js`, `app/api/chat/route.js`, `app/api/admin/auth/route.js`, and `app/api/admin/config/route.js`.
   - In architectural terms, Next.js route handlers are the **backend boundary** for the frontend.
   - The contact/chat routes likely receive form or conversational payloads from the UI, while the admin routes handle protected configuration and authentication workflows.

9. **Persistence and external service boundary**
   - The repo includes `lib/supabase.js` plus `supabase/schema.sql`, which makes Supabase the explicit backend datastore/service.
   - That means the system boundary is: **browser → Next.js UI/API → Supabase** for authentication/configuration/data persistence where needed.
   - The admin routes are the likeliest consumers of this backend layer, especially for auth and configuration management.

10. **Administration area**
   - `app/admin/page.js` is a dedicated admin route, separate from the public marketing site.
   - Together with the admin API routes, this forms a small private operational surface for managing site settings or access.
   - In a diagram, this should be shown as a **distinct branch** from public content routes, even though it runs inside the same Next.js app.

11. **SEO, metadata, and discovery**
   - `app/sitemap.js`, `public/robots.txt`, and `public/llms.txt` indicate the repo is intentionally optimized for search and machine-readable discovery.
   - The README also notes per-page metadata, so each route likely owns its own title/description/OpenGraph metadata.
   - This is important architecturally because content routes are designed as **indexable landing pages**, not just navigable screens.

12. **Deployment/runtime context**
   - The README recommends **Vercel**, which fits the Next.js App Router model and route-handler API style.
   - The app is therefore best thought of as a **serverless-capable Next.js frontend with embedded API routes**, rather than a separate frontend and backend deployment.
   - Tailwind and Google Fonts are present, but they mainly affect presentation, not the core architecture.

Main entry points: [`app/layout.js`](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/layout.js) (App shell), [`app/energia/page.js`](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/energia/page.js) (Energía hub), [`app/gestiones/alta-suministro-luz/page.js`](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/gestiones/alta-suministro-luz/page.js) (Gestiones hub), [`app/sitemap.js`](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/sitemap.js) (SEO discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public site"]
  node_public_home["Home<br/>landing page<br/>[page.js]"]
  node_public_info["Info pages<br/>content routes<br/>[page.js]"]
  node_public_contact["Contact<br/>[page.js]"]
  node_public_legal["Legal pages<br/>policy routes<br/>[page.js]"]
end

subgraph group_energy["Energy content"]
  node_energy_hub["Energía hub<br/>content hub<br/>[page.js]"]
  node_energy_calcs["Calculators<br/>energy tools<br/>[page.js]"]
  node_energy_companies["Company pages<br/>brand landing pages<br/>[page.js]"]
  node_energy_billing["Rates & bill<br/>energy pages<br/>[page.js]"]
  node_gestiones_hub["Gestiones hub<br/>procedure hub<br/>[page.js]"]
end

subgraph group_ops["Admin ops"]
  node_admin_console["Admin area<br/>admin page<br/>[page.js]"]
  node_admin_api["Admin API<br/>route handlers<br/>[route.js]"]
  node_public_api["Public API<br/>route handlers<br/>[route.js]"]
  node_persistence[("Supabase<br/>backend service<br/>[supabase.js]")]
end

subgraph group_shared["Shared platform"]
  node_app_shell["App shell<br/>next root layout<br/>[layout.js]"]
  node_global_styles["Global styles<br/>css tokens<br/>[globals.css]"]
  node_route_fallbacks["Route fallbacks<br/>next boundaries<br/>[error.js]"]
  node_ui_chrome["UI chrome<br/>shared components<br/>[Navbar.js]"]
  node_ui_widgets["UI widgets<br/>client widgets<br/>[CookieBanner.js]"]
  node_config_layer["Config layer<br/>site config<br/>[ConfigContext.js]"]
  node_seo_discovery["SEO discovery<br/>metadata files<br/>[sitemap.js]"]
end

node_app_shell -->|"frames"| node_ui_chrome
node_app_shell -->|"applies"| node_global_styles
node_app_shell -->|"bounds"| node_route_fallbacks
node_app_shell -->|"serves"| node_public_home
node_app_shell -->|"serves"| node_public_info
node_app_shell -->|"serves"| node_public_contact
node_app_shell -->|"serves"| node_public_legal
node_app_shell -->|"serves"| node_energy_hub
node_app_shell -->|"serves"| node_gestiones_hub
node_ui_chrome -->|"composes"| node_ui_widgets
node_ui_chrome -->|"reads"| node_config_layer
node_public_home -->|"uses"| node_ui_widgets
node_public_contact -->|"submits to"| node_public_api
node_public_info -->|"navigates"| node_public_legal
node_energy_hub -->|"branches to"| node_energy_calcs
node_energy_hub -->|"branches to"| node_energy_companies
node_energy_hub -->|"branches to"| node_energy_billing
node_energy_hub -->|"cross-links"| node_gestiones_hub
node_gestiones_hub -->|"uses"| node_ui_widgets
node_admin_console -->|"calls"| node_admin_api
node_admin_api -->|"persists"| node_persistence
node_public_api -->|"persists"| node_persistence
node_seo_discovery -->|"indexes"| node_public_home
node_seo_discovery -->|"indexes"| node_energy_hub
node_seo_discovery -->|"indexes"| node_gestiones_hub

click node_app_shell "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/layout.js"
click node_global_styles "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/globals.css"
click node_route_fallbacks "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/error.js"
click node_ui_chrome "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/components/ui/Navbar.js"
click node_ui_widgets "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/components/ui/CookieBanner.js"
click node_config_layer "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/components/ui/ConfigContext.js"
click node_seo_discovery "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/sitemap.js"
click node_public_home "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/page.js"
click node_public_info "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/quienes-somos/page.js"
click node_public_contact "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/contacto/page.js"
click node_public_legal "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/aviso-legal/page.js"
click node_energy_hub "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/energia/page.js"
click node_energy_calcs "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/energia/calculadora-consumo-luz/page.js"
click node_energy_companies "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/energia/companias/endesa-luz/page.js"
click node_energy_billing "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/energia/tarifas-luz-baratas/page.js"
click node_gestiones_hub "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/gestiones/alta-suministro-luz/page.js"
click node_admin_console "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/admin/page.js"
click node_admin_api "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/api/admin/auth/route.js"
click node_public_api "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/api/contact/route.js"
click node_persistence "https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/lib/supabase.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_public_home,node_public_info,node_public_contact,node_public_legal toneBlue
class node_energy_hub,node_energy_calcs,node_energy_companies,node_energy_billing,node_gestiones_hub toneAmber
class node_admin_console,node_admin_api,node_public_api,node_persistence toneMint
class node_app_shell,node_global_styles,node_route_fallbacks,node_ui_chrome,node_ui_widgets,node_config_layer,node_seo_discovery toneRose
```

## Components

### Public site

Marketing, informational, and legal routes exposed to visitors.

- [Home](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/page.js): landing page · Primary public landing page. · `app/page.js`
- [Info pages](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/quienes-somos/page.js): content routes · General informational pages such as about and service overview. · `app/quienes-somos/page.js`
- [Contact](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/contacto/page.js): contact page · Public contact route for user inquiries. · `app/contacto/page.js`
- [Legal pages](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/aviso-legal/page.js): policy routes · Shared legal and policy pages for compliance and trust. · `app/aviso-legal/page.js`

### Energy content

SEO landing-page clusters for energy services and utilities.

- [Energía hub](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/energia/page.js): content hub · Entry point for the energy content cluster. · `app/energia/page.js`
- [Calculators](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/energia/calculadora-consumo-luz/page.js): energy tools · Consumption and power calculators presented as focused landing pages. · `app/energia/calculadora-consumo-luz/page.js`
- [Company pages](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/energia/companias/endesa-luz/page.js): brand landing pages · Utility-company specific SEO pages under the energy cluster. · `app/energia/companias/endesa-luz/page.js`
- [Rates & bill](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/energia/tarifas-luz-baratas/page.js): energy pages · Tariff and invoice interpretation pages. · `app/energia/tarifas-luz-baratas/page.js`
- [Gestiones hub](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/gestiones/alta-suministro-luz/page.js): procedure hub · Administrative energy-procedure cluster for common service changes. · `app/gestiones/alta-suministro-luz/page.js`

### Admin ops

Private admin surface and backend endpoints.

- [Admin area](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/admin/page.js): admin page · Dedicated private admin route for operational management. · `app/admin/page.js`
- [Admin API](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/api/admin/auth/route.js): route handlers · Protected auth and configuration endpoints for the admin surface. · `app/api/admin/auth/route.js`
- [Public API](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/api/contact/route.js): route handlers · Contact and chat endpoints used by public-facing forms and assistants. · `app/api/contact/route.js`
- [Supabase](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/lib/supabase.js): backend service · External datastore and service boundary for auth and configuration. · `lib/supabase.js`

### Shared platform

Root shell, reusable UI, configuration, persistence, and discovery.

- [App shell](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/layout.js): next root layout · Global route shell that frames all pages with shared navigation and footer. · `app/layout.js`
- [Global styles](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/globals.css): css tokens · App-wide styling and design tokens. · `app/globals.css`
- [Route fallbacks](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/error.js): next boundaries · Framework-level error, loading, and not-found boundaries. · `app/error.js`
- [UI chrome](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/components/ui/Navbar.js): shared components · Shared structural components for navigation, footer, and legal page layout. · `components/ui/Navbar.js`
- [UI widgets](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/components/ui/CookieBanner.js): client widgets · Client-side interaction layers such as consent, CTAs, testimonials, and contact forms. · `components/ui/CookieBanner.js`
- [Config layer](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/components/ui/ConfigContext.js): site config · Centralized configuration and context used across the UI. · `components/ui/ConfigContext.js`
- [SEO discovery](https://github.com/creadordesistemas/activa-asesores-mejorado/blob/main/app/sitemap.js): metadata files · Sitemap and crawler-facing files for search and machine discovery. · `app/sitemap.js`

## Connections

- App shell → UI chrome: frames · Root layout provides the shared shell around routes.
- App shell → Global styles: applies · Global layout loads site-wide styles.
- App shell → Route fallbacks: bounds · Next route boundaries handle errors, loading, and 404s.
- App shell → Home: serves · Root shell wraps the public homepage.
- App shell → Info pages: serves · Root shell wraps informational routes.
- App shell → Contact: serves · Root shell wraps the contact page.
- App shell → Legal pages: serves · Root shell wraps compliance pages.
- App shell → Energía hub: serves · Root shell wraps the energy content cluster.
- App shell → Gestiones hub: serves · Root shell wraps the procedures cluster.
- UI chrome → UI widgets: composes · Shared shell is augmented by lightweight interaction widgets.
- UI chrome → Config layer: reads · UI chrome and widgets consume centralized site configuration.
- Home → UI widgets: uses · Homepage can mount engagement widgets and CTAs.
- Contact → Public API: submits to · Contact forms send payloads to public API routes.
- Info pages → Legal pages: navigates · Informational pages link into compliance pages and vice versa.
- Energía hub → Calculators: branches to · Energy hub leads into calculator pages.
- Energía hub → Company pages: branches to · Energy hub leads into company-specific landing pages.
- Energía hub → Rates & bill: branches to · Energy hub leads into tariff and billing pages.
- Energía hub → Gestiones hub: cross-links · Energy content connects to common administrative procedures.
- Gestiones hub → UI widgets: uses · Procedure pages can use the same CTA and contact widgets.
- Admin area → Admin API: calls · Admin UI depends on protected auth and config endpoints.
- Admin API → Supabase: persists · Admin workflows read and write configuration through Supabase.
- Public API → Supabase: persists · Public-facing form and chat data can flow to the backend boundary.
- SEO discovery → Home: indexes · Discovery files point search engines at public routes.
- SEO discovery → Energía hub: indexes · Discovery files cover the SEO landing-page clusters.
- SEO discovery → Gestiones hub: indexes · Discovery files include procedure landing pages.
