# creadordesistemas/plantilla-blog-monetizable architecture

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

- Interactive diagram: https://gitdiagram.com/creadordesistemas/plantilla-blog-monetizable
- Repository: https://github.com/creadordesistemas/plantilla-blog-monetizable

## Overview

1. **Overall shape**
   - This is a **Next.js App Router** application in **TypeScript** with a split between public site pages, an authenticated admin console, and JSON/DB-backed content services.
   - The repo is structured as a content platform: blog, community/members area, newsletter capture, legal pages, and SEO/monetization features.

2. **Public-facing site**
   - The public experience lives under `app/` routes such as `/`, `/blog`, `/blog/[slug]`, `/comunidad`, `/cookies`, `/privacidad`, `/terminos`, and `/gracias`.
   - These pages are assembled from reusable UI in `components/` like `Hero`, `AboutMe`, `FAQ`, `Newsletter`, `BlogListing`, `BlogCard`, `CommunityTeaser`, and shared shell elements like `Navbar`, `Footer`, and `ScrollToTop`.

3. **Admin subsystem**
   - The admin area is isolated under `app/admin/*` with pages for blog, community, newsletter, settings, and system status.
   - Its role is content and configuration management rather than customer-facing rendering; it acts as the operational boundary for editing posts, members, newsletter settings, site settings, and uploads.

4. **API boundary**
   - Most mutations and protected reads go through `app/api/*`.
   - There are separate API domains for admin operations (`app/api/admin/*`), public blog actions (`app/api/blog/*`), community auth/profile (`app/api/community/*`), newsletter subscription and admin sends (`app/api/newsletter/*` and `app/api/admin/newsletter/*`), contact/privacy deletion forms, and auxiliary actions like view tracking and comments.

5. **Data layer**
   - The repo uses a Supabase-backed data model, with schema assumptions documented in the README and reflected in `data/*.json` as local/config snapshots.
   - Core entities are: `blog`, `members`, `blog_comments`, `settings`, `community`, `newsletter_config`, and `stats`.
   - `lib/supabase.ts` and `services/db.ts` are the main data-access boundaries; they centralize how the app talks to Supabase.

6. **Content and configuration sources**
   - `data/settings.json`, `data/blog.json`, `data/community.json`, `data/newsletter.json`, `data/stats.json`, and `data/systems.json` represent structured app content/configuration used by the UI and admin screens.
   - The architecture suggests a mix of runtime database state and repository-managed defaults/seeds, with settings and content surfacing into the UI and SEO metadata.

7. **Community and private access flow**
   - Community access is split across public teaser pages and a private area under `app/comunidad/privado`.
   - Community login, logout, “me”, password setup, and profile update routes indicate a session-based member flow separate from admin auth.
   - `PrivateAreaClient.tsx` is the client-side entry point for gated member experiences.

8. **Authentication and route protection**
   - Admin authentication is handled through dedicated login/logout routes and protected by `middleware.ts`.
   - The README indicates JWT-based admin sessions; the middleware boundary is important because it protects `/admin` routes before page render.
   - Community auth is separate from admin auth, which keeps member access and site administration isolated.

9. **Media, uploads, and storage**
   - Blog/admin workflows support image uploads through `app/api/admin/upload`.
   - The README ties this to a public Supabase storage bucket (`blog-images`), so media assets are handled outside the page layer and then referenced by URL in posts and settings.

10. **Monetization and external integrations**
   - Google AdSense is wired into the public layout via `components/AdSenseUnit` and environment-driven client/slot IDs.
   - Newsletter delivery is integrated with Brevo via newsletter config and send/stats endpoints.
   - There is also a Google indexing helper in `lib/google-indexing.ts` and a token-generation script in `scripts/`, which points to SEO/search-console automation as a supporting subsystem.

11. **SEO, legal, and platform concerns**
   - `app/sitemap.ts`, `robots.txt`, and metadata-oriented components support search indexing and sharing.
   - Public legal pages and endpoints like contact and data deletion show that the app includes compliance-facing flows, not just content delivery.
   - `public/ads.txt` and `.well-known/security.txt` are static deployment artifacts that support ad verification and security disclosure.

12. **Security and deployment boundary**
   - `next.config.js`, `middleware.ts`, and `lib/security.ts` together define the security posture: route gating, headers, and runtime protections.
   - The project is designed for **Vercel** deployment with environment variables driving Supabase, auth, AdSense, and site URL configuration.
   - Docs under `docs/` provide operational guidance for deployment, admin usage, security, and schema setup, reinforcing that the architecture spans app code plus platform configuration.

Main entry points: [`app/api/admin/blog/route.ts`](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/api/admin/blog/route.ts) (Admin APIs), [`services/db.ts`](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/services/db.ts) (DB layer), [`app/page.tsx`](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/page.tsx) (Home), [`components/Navbar.tsx`](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/components/Navbar.tsx) (Public shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_public["Public site"]
  node_node_home["Home<br/>page<br/>[page.tsx]"]
  node_node_blog["Blog<br/>page<br/>[page.tsx]"]
  node_node_blog_components["Blog UI<br/>[BlogListing.tsx]"]
  node_node_public_shell["Public shell<br/>layout/ui<br/>[Navbar.tsx]"]
  node_node_community_public["Community<br/>page<br/>[page.tsx]"]
  node_node_private_area["Private area<br/>gated page<br/>[page.tsx]"]
end

subgraph group_group_admin["Admin console"]
  node_node_admin_dashboard["Admin home<br/>console<br/>[page.tsx]"]
  node_node_admin_blog["Blog admin<br/>admin page<br/>[page.tsx]"]
  node_node_admin_community["Community admin<br/>admin page<br/>[page.tsx]"]
  node_node_admin_newsletter["Newsletter admin<br/>admin page<br/>[page.tsx]"]
  node_node_admin_settings["Settings<br/>admin page<br/>[page.tsx]"]
  node_node_admin_systems["Systems<br/>admin page<br/>[page.tsx]"]
end

subgraph group_group_api["API boundary"]
  node_node_api_admin["Admin APIs<br/>route handlers<br/>[route.ts]"]
  node_node_api_public["Public APIs<br/>route handlers<br/>[route.ts]"]
  node_node_api_community["Member APIs<br/>route handlers<br/>[route.ts]"]
end

subgraph group_group_core["Core services"]
  node_node_app_actions["Actions<br/>[actions.ts]"]
  node_node_db["DB layer<br/>supabase access<br/>[db.ts]"]
  node_node_supabase["Supabase<br/>client/config<br/>[supabase.ts]"]
  node_node_security["Security<br/>middleware/helpers<br/>[middleware.ts]"]
end

subgraph group_group_data["Content store"]
  node_node_data[("JSON content<br/>content snapshots<br/>[settings.json]")]
end

subgraph group_group_platform["Platform"]
  node_node_layout["App layout<br/>shell<br/>[layout.tsx]"]
  node_node_seo_static["SEO static<br/>platform assets<br/>[sitemap.ts]"]
end

node_node_layout -->|"renders"| node_node_home
node_node_layout -->|"renders"| node_node_blog
node_node_layout -->|"renders"| node_node_community_public
node_node_public_shell -->|"composes"| node_node_home
node_node_public_shell -->|"composes"| node_node_blog
node_node_public_shell -->|"composes"| node_node_community_public
node_node_blog_components -->|"powers"| node_node_blog
node_node_blog_components -->|"reads/writes"| node_node_api_public
node_node_private_area -->|"authenticates"| node_node_api_community
node_node_admin_dashboard -->|"operates via"| node_node_api_admin
node_node_admin_blog -->|"operates via"| node_node_api_admin
node_node_admin_community -->|"operates via"| node_node_api_admin
node_node_admin_newsletter -->|"operates via"| node_node_api_admin
node_node_admin_settings -->|"operates via"| node_node_api_admin
node_node_admin_systems -->|"observes"| node_node_api_admin
node_node_api_admin -->|"persists"| node_node_db
node_node_api_public -->|"persists"| node_node_db
node_node_api_community -->|"persists"| node_node_db
node_node_db -->|"connects"| node_node_supabase
node_node_app_actions -->|"uses"| node_node_db
node_node_security -->|"protects"| node_node_admin_dashboard
node_node_security -->|"protects"| node_node_api_admin
node_node_security -->|"protects"| node_node_api_community
node_node_data -->|"feeds"| node_node_home
node_node_data -->|"feeds"| node_node_admin_settings
node_node_seo_static -->|"supports"| node_node_home

click node_node_home "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/page.tsx"
click node_node_blog "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/blog/page.tsx"
click node_node_blog_components "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/components/BlogListing.tsx"
click node_node_public_shell "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/components/Navbar.tsx"
click node_node_community_public "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/comunidad/page.tsx"
click node_node_private_area "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/comunidad/privado/page.tsx"
click node_node_admin_dashboard "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/page.tsx"
click node_node_admin_blog "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/blog/page.tsx"
click node_node_admin_community "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/community/page.tsx"
click node_node_admin_newsletter "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/newsletter/page.tsx"
click node_node_admin_settings "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/settings/page.tsx"
click node_node_admin_systems "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/systems/page.tsx"
click node_node_api_admin "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/api/admin/blog/route.ts"
click node_node_api_public "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/api/blog/route.ts"
click node_node_api_community "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/api/community/login/route.ts"
click node_node_app_actions "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/actions.ts"
click node_node_db "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/services/db.ts"
click node_node_supabase "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/lib/supabase.ts"
click node_node_security "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/middleware.ts"
click node_node_data "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/data/settings.json"
click node_node_layout "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/layout.tsx"
click node_node_seo_static "https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/sitemap.ts"

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_node_home,node_node_blog,node_node_blog_components,node_node_public_shell,node_node_community_public,node_node_private_area toneBlue
class node_node_admin_dashboard,node_node_admin_blog,node_node_admin_community,node_node_admin_newsletter,node_node_admin_settings,node_node_admin_systems toneAmber
class node_node_api_admin,node_node_api_public,node_node_api_community toneMint
class node_node_app_actions,node_node_db,node_node_supabase,node_node_security toneRose
class node_node_data toneIndigo
class node_node_layout,node_node_seo_static toneTeal
```

## Components

### Public site

Customer-facing pages and shared presentation components.

- [Home](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/page.tsx): page · Landing page that assembles the public hero and feature sections. · `app/page.tsx`
- [Blog](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/blog/page.tsx): page · Public blog listing and article pages, including category views. · `app/blog/page.tsx`
- [Blog UI](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/components/BlogListing.tsx): ui · Reusable cards, listings, comments, and view tracking for blog content. · `components/BlogListing.tsx`
- [Public shell](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/components/Navbar.tsx): layout/ui · Shared navigation, footer, hero, newsletter, FAQ, and themed site chrome. · `components/Navbar.tsx`
- [Community](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/comunidad/page.tsx): page · Public community entry point and teaser flow for members. · `app/comunidad/page.tsx`
- [Private area](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/comunidad/privado/page.tsx): gated page · Member-only community experience backed by a client-side gated entry. · `app/comunidad/privado/page.tsx`

### Admin console

Protected content management and operational screens.

- [Admin home](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/page.tsx): console · Admin landing and dashboard surface for operational workflows. · `app/admin/page.tsx`
- [Blog admin](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/blog/page.tsx): admin page · Admin area for creating and managing blog content. · `app/admin/blog/page.tsx`
- [Community admin](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/community/page.tsx): admin page · Admin tools for members and community operations. · `app/admin/community/page.tsx`
- [Newsletter admin](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/newsletter/page.tsx): admin page · Admin interface for newsletter configuration and sends. · `app/admin/newsletter/page.tsx`
- [Settings](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/settings/page.tsx): admin page · Operational settings and site configuration management. · `app/admin/settings/page.tsx`
- [Systems](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/admin/systems/page.tsx): admin page · System status and infrastructure-oriented admin view. · `app/admin/systems/page.tsx`

### API boundary

Route handlers for public, admin, and member workflows.

- [Admin APIs](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/api/admin/blog/route.ts): route handlers · Protected mutation endpoints for blog, community, newsletter, settings, and uploads. · `app/api/admin/blog/route.ts`
- [Public APIs](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/api/blog/route.ts): route handlers · Public blog, contact, deletion, and newsletter endpoints. · `app/api/blog/route.ts`
- [Member APIs](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/api/community/login/route.ts): route handlers · Community login, profile, password setup, and session endpoints. · `app/api/community/login/route.ts`

### Core services

Shared data access, security, and integration helpers.

- [Actions](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/actions.ts): server actions · Server-side action entry point used by app routes and forms. · `app/actions.ts`
- [DB layer](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/services/db.ts): supabase access · Central data access boundary for Supabase-backed reads and writes. · `services/db.ts`
- [Supabase](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/lib/supabase.ts): client/config · Supabase client setup and connection configuration. · `lib/supabase.ts`
- [Security](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/middleware.ts): middleware/helpers · Route protection and security helper layer. · `middleware.ts`

### Content store

Repository-managed JSON content and configuration snapshots.

- [JSON content](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/data/settings.json): content snapshots · Repository-managed content and configuration snapshots for site and admin views. · `data/settings.json`

### Platform

Deployment, static assets, and operational support files.

- [App layout](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/layout.tsx): shell · Root app shell and global styles for the Next.js application. · `app/layout.tsx`
- [SEO static](https://github.com/creadordesistemas/plantilla-blog-monetizable/blob/main/app/sitemap.ts): platform assets · Sitemap, robots, ads verification, and security disclosure assets. · `app/sitemap.ts`

## Connections

- App layout → Home: renders · Root layout wraps the public landing page.
- App layout → Blog: renders · Root layout wraps blog routes.
- App layout → Community: renders · Root layout wraps community routes.
- Public shell → Home: composes · Shared UI builds the home experience.
- Public shell → Blog: composes · Shared UI supports blog navigation and page chrome.
- Public shell → Community: composes · Shared UI frames the community teaser flow.
- Blog UI → Blog: powers · Blog UI components render listings, cards, comments, and tracking.
- Blog UI → Public APIs: reads/writes · Blog UI consumes public blog and comment endpoints.
- Private area → Member APIs: authenticates · Private member area depends on community session APIs.
- Admin home → Admin APIs: operates via · Admin console actions flow through protected admin APIs.
- Blog admin → Admin APIs: operates via · Blog admin uses admin CRUD and upload endpoints.
- Community admin → Admin APIs: operates via · Community admin uses protected member-management APIs.
- Newsletter admin → Admin APIs: operates via · Newsletter admin uses send and stats endpoints.
- Settings → Admin APIs: operates via · Settings screen persists configuration through admin APIs.
- Systems → Admin APIs: observes · Systems view consumes operational/admin data.
- Admin APIs → DB layer: persists · Protected admin handlers read and write through the DB boundary.
- Public APIs → DB layer: persists · Public content and form handlers use shared data access.
- Member APIs → DB layer: persists · Community auth and profile handlers use shared data access.
- DB layer → Supabase: connects · DB service delegates to Supabase client/config.
- Actions → DB layer: uses · Server actions share the DB access layer.
- Security → Admin home: protects · Middleware gates admin routes before render.
- Security → Admin APIs: protects · Middleware guards admin API boundary.
- Security → Member APIs: protects · Security helpers support member session boundaries.
- JSON content → Home: feeds · Structured content and settings drive public rendering.
- JSON content → Settings: feeds · Settings snapshots back the admin configuration screens.
- SEO static → Home: supports · Static platform assets support indexing and verification.
