How creadordesistemas/plantilla-blog-monetizable works
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: route.ts Admin APIs · db.ts DB layer · page.tsx Home · Navbar.tsx Public shell
Components 22
Public site
Customer-facing pages and shared presentation components.
- Home · Landing page that assembles the public hero and feature sections.
app/page.tsx - Blog · Public blog listing and article pages, including category views.
app/blog/page.tsx - Blog UI · Reusable cards, listings, comments, and view tracking for blog content.
components/BlogListing.tsx - Public shell · Shared navigation, footer, hero, newsletter, FAQ, and themed site chrome.
components/Navbar.tsx - Community · Public community entry point and teaser flow for members.
app/comunidad/page.tsx - Private area · 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 · Admin landing and dashboard surface for operational workflows.
app/admin/page.tsx - Blog admin · Admin area for creating and managing blog content.
app/admin/blog/page.tsx - Community admin · Admin tools for members and community operations.
app/admin/community/page.tsx - Newsletter admin · Admin interface for newsletter configuration and sends.
app/admin/newsletter/page.tsx - Settings · Operational settings and site configuration management.
app/admin/settings/page.tsx - Systems · System status and infrastructure-oriented admin view.
app/admin/systems/page.tsx
API boundary
Route handlers for public, admin, and member workflows.
- Admin APIs · Protected mutation endpoints for blog, community, newsletter, settings, and uploads.
app/api/admin/blog/route.ts - Public APIs · Public blog, contact, deletion, and newsletter endpoints.
app/api/blog/route.ts - Member APIs · Community login, profile, password setup, and session endpoints.
app/api/community/login/route.ts
Core services
Shared data access, security, and integration helpers.
- Actions · Server-side action entry point used by app routes and forms.
app/actions.ts - DB layer · Central data access boundary for Supabase-backed reads and writes.
services/db.ts - Supabase · Supabase client setup and connection configuration.
lib/supabase.ts - Security · Route protection and security helper layer.
middleware.ts
Content store
Repository-managed JSON content and configuration snapshots.
- JSON content · Repository-managed content and configuration snapshots for site and admin views.
data/settings.json
Platform
Deployment, static assets, and operational support files.
- App layout · Root app shell and global styles for the Next.js application.
app/layout.tsx - SEO static · Sitemap, robots, ads verification, and security disclosure assets.
app/sitemap.ts
Connections 26
- 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.