How jdcorderor/m-r-landing-page works
Project Type and Purpose
• This is a monolithic full-stack Next.js (App Router) application.
• Front-end and back-end live in the same codebase. The “app” directory contains React Server and Client Components for UI and file-based API route handlers under app/api.
• It exposes REST endpoints for “citas,” “comentarios,” and “servicios,” backed by a database connection in lib/db.ts.
Top-Level Structure
• app/
• UI pages, layouts, global CSS
• API route handlers under app/api/*
• hooks/
• Custom React hooks for client-side effects and data fetching
• lib/
• DB connection module
• public/
• Static assets (images)
• config files
• next.config.ts, tsconfig.json, eslint.config.mjs, postcss.config.mjs
Main Components
a. Client Browser
– UI layer consuming React Server/Client Components
– Invokes custom hooks for data fetching and side effects
b. Next.js Server
– Serves pages (SSR/SSG) and static assets
– Exposes API route handlers at /api/citas, /api/comentarios, /api/servicios
c. Database
– Connected via lib/db.ts (e.g., PostgreSQL, MongoDB)
d. Public Assets
– Served from public/images and global CSS
e. (Optional) Deployment Platform
– Vercel or any Node hosting
Component Interactions and Data Flow
1) Browser → Next.js Server Pages
• Requests initial HTML and React bundles
2) Browser (Client Components) → API Endpoints
• fetch(‘/api/servicios’) → Next.js Route Handler
3) API Handler → lib/db.ts → Database
• Perform CRUD operations
4) Next.js Server → Browser
• Returns JSON payloads to client
5) Next.js Server → Browser
• Serves static assets and optimized fonts
Architectural Patterns and Principles
• File-based routing (App Router): UI and API colocated by path
• Server and Client Components: default server, “use client” for interactivity
• Separation of concerns: UI in app/, data access in lib/, side-effects in hooks/
• Optimized asset delivery: public/, next/font