How boli27/itarg2 works
1. This repository is a single Next.js application built with the App Router and TypeScript. It combines the public website, server-rendered pages, and API endpoints in one codebase rather than splitting frontend and backend into separate services.
2. The top-level user-facing routes live under src/app/ and map to the main business areas of the site: diplomados, tecnicos, sedes, preinscripcion, transparencia, plus the home page. There are also dynamic detail pages for items identified by [id], which suggests list/detail navigation for programs, locations, and news-like content.
3. The backend/API boundary is implemented with route handlers under src/app/api/. Each domain has its own REST-style endpoints, typically a collection route and an item route: diplomados, faqs, noticias, sedes, and tecnicos. preinscripcion appears to be a write-oriented endpoint for form submissions rather than content retrieval.
4. Data access is organized separately from the route handlers in src/lib/consults/. There is one consult module per domain (Diplomados, Faqs, Noticias, Sedes, Tecnicos), which likely encapsulates fetching, querying, or shaping data before it reaches either API responses or server-rendered pages. This is the main internal boundary between transport/UI and domain data.
5. src/lib/db.ts indicates a shared database or external data source connection layer. Even without the implementation, its presence means the API and consult modules likely depend on a common persistence abstraction instead of each route talking directly to storage.
6. src/lib/validateApiKey.ts is a cross-cutting security control. It suggests at least some API endpoints are protected by an API key check, which is important for distinguishing public content endpoints from internal or privileged operations.
7. The UI is split into reusable components under src/components/. Domain-specific views live alongside shared presentation pieces: noticias, preinscripcion, sedes, tecnicos, and transparencia, plus generic UI such as NavbarMT, Footer, PageHeader, FaqAccordion, NewSlider, and WhatsappFloat. This shows the app is assembled from reusable page sections rather than monolithic page files.
8. The most important data flow is: request enters a page or API route, the route uses consult modules and possibly db.ts, data is validated or filtered, and then the result is rendered into a page component or returned as JSON. The preinscription flow is the clearest write path: form component → /api/preinscripcion → validation/persistence layer.
9. Static assets and site-wide metadata support the public site experience. public/ holds images and other assets, while manifest.ts, robots.ts, and sitemap.ts indicate SEO and PWA-oriented metadata generation are part of the architecture.
10. Styling and build tooling are standard Next.js/Tailwind choices: tailwind.config.js, postcss.config.cjs, and src/app/globals.css drive the visual system. next.config.mjs, eslint.config.mjs, and the TypeScript config files define the framework/runtime boundaries for how the app is built and checked.
11. In architectural terms, this is best drawn as a modular monolith: one Next.js deployment with three clear layers—presentation pages/components, API route handlers, and shared data-access/validation utilities—backed by a common persistence layer and static public assets.
Main entry points: Diplomados.ts Consults · NewsCard.tsx Domain views · layout.tsx App shell · route.ts Preinscripción API
Components 28
Presentation
App Router pages and reusable UI components
- App shell · Root layout and providers for the Next.js app
src/app/layout.tsx - Home · Top-level public entry page
src/app/page.tsx - Diplomados · Program listing page for diplomas
src/app/diplomados/page.tsx - Diploma detail · Dynamic detail page for a diploma
src/app/diplomados/[id]/page.tsx - Técnicos · Technical programs listing page
src/app/tecnicos/page.tsx - Técnico detail · Dynamic detail page for a technical program
src/app/tecnicos/[id]/page.tsx - Sede detail · Dynamic detail page for a campus or site
src/app/sedes/[id]/page.tsx - Preinscripción · Public enrollment/pre-registration page
src/app/preinscripcion/page.tsx - Transparencia · Public transparency and institutional documents page
src/app/transparencia/page.tsx - Shared UI · Navbar, footer, headers, slider, FAQ, and floating actions
src/components/ui/NavbarMT.tsx - Domain views · Reusable view components for news, preinscription, sedes, tecnicos, and transparency
src/components/noticias/NewsCard.tsx
API
Route handlers for domain endpoints
- Diplomados API · Collection endpoint for diplomas
src/app/api/diplomados/route.ts - Diploma API · Item endpoint for a single diploma
src/app/api/diplomados/[id]/route.ts - Técnicos API · Collection endpoint for technical programs
src/app/api/tecnicos/route.ts - Técnico API · Item endpoint for a single technical program
src/app/api/tecnicos/[id]/route.ts - Sedes API · Collection endpoint for locations
src/app/api/sedes/route.ts - Sede API · Item endpoint for a single location
src/app/api/sedes/[id]/route.ts - FAQ API · FAQ collection endpoint
src/app/api/faqs/route.ts - FAQ item · FAQ item endpoint
src/app/api/faqs/[id]/route.ts - Noticias API · News collection endpoint
src/app/api/noticias/route.ts - News item · News item endpoint
src/app/api/noticias/[id]/route.ts - Preinscripción API · Write-oriented endpoint for form submissions
src/app/api/preinscripcion/route.ts
Data
Shared consult modules and persistence helpers
- Consults · Domain query and shaping modules for API and pages
src/lib/consults/Diplomados.ts - DB layer · Shared database or external data source connection
src/lib/db.ts - API key check · Cross-cutting API key validation helper
src/lib/validateApiKey.ts
Infrastructure
Global styles, metadata, and build/runtime config
- Global styles · App-wide CSS entrypoint
src/app/globals.css - Metadata · Manifest, robots, and sitemap generation
src/app/manifest.ts - Public assets · Images and other site assets
public/images
Connections 26
- App shell → Home: renders · Root shell wraps the public site
- App shell → Shared UI: uses · Global navigation and footer are shared across pages
- Home → Domain views: uses · Home page composes reusable feature blocks
- Diplomados → Consults: loads · Program listing is backed by shared consults
- Diploma detail → Consults: loads · Detail page fetches program data through consults
- Técnicos → Consults: loads · Technical program listing uses shared consults
- Técnico detail → Consults: loads · Technical detail page fetches through consults
- Sede detail → Consults: loads · Location detail page uses shared consults
- Preinscripción → Domain views: uses · Form page renders the preinscription component
- Transparencia → Domain views: uses · Transparency page renders institutional documents UI
- Domain views → Public assets: shows · Feature components present site assets and media
- Diplomados API → Consults: queries · Collection endpoint reads through consult layer
- Diploma API → Consults: queries · Item endpoint reads through consult layer
- Técnicos API → Consults: queries · Collection endpoint reads through consult layer
- Técnico API → Consults: queries · Item endpoint reads through consult layer
- Sedes API → Consults: queries · Collection endpoint reads through consult layer
- Sede API → Consults: queries · Item endpoint reads through consult layer
- FAQ API → Consults: queries · FAQ collection endpoint reads through consult layer
- FAQ item → Consults: queries · FAQ item endpoint reads through consult layer
- Noticias API → Consults: queries · News collection endpoint reads through consult layer
- News item → Consults: queries · News item endpoint reads through consult layer
- Preinscripción API → API key check: protects · Submission endpoint may enforce API key validation
- Consults → DB layer: reads · Consult modules depend on the shared persistence layer
- Preinscripción API → DB layer: writes · Form submissions persist through the shared data layer
- Metadata → Public assets: references · Metadata and sitemap support public assets and site indexing
- Global styles → Shared UI: styles · Global CSS supports shared UI components