How trbureiyan/devurityweb works
Purpose and entry points
DevurityWeb is a single Next.js platform for Devurity’s public presence and internal member operations: projects, content updates, profiles, membership administration, and QR attendance. App Router pages begin at app/page.tsx; global composition is in app/layout.tsx; request-wide authorization starts in middleware.ts.
Presentation and route boundary
Server-rendered public routes cover institutional content, projects, updates, gallery, and auth. Protected routes group internal role-specific areas: admin, content manager, project leader, and profile pages.
• app/projects/page.tsx
• app/updates/[slug]/page.tsx
• app/(protected)/admin/layout.tsx
• app/(protected)/profile/[id]/page.tsx
Client components provide interactive page behavior while routes remain the primary SSR/SEO boundary.
• components/projects/ProjectsPageClient.tsx
• components/updates/UpdatesPageClient.tsx
• components/admin/AdminDashboardClient.tsx
Authentication, authorization, and request security
Custom JWT authentication is verified in edge-compatible code; middleware applies RBAC before protected pages are reached. Auth route handlers implement login, refresh, registration approval/token flow, profile access, and password recovery. State is exposed to the UI through an auth context/hooks layer.
• middleware.ts
• lib/auth/middleware.ts
• lib/auth/jwt-edge.ts
• app/api/auth/login/route.ts
• contexts/AuthContext.tsx
Mutating flows are protected by double-submit CSRF, while login attempts are rate limited. ALTCHA challenge handling protects applicable public interactions.
• lib/csrf.ts
• lib/rateLimit.ts
• app/api/altcha/challenge/route.ts
API and business operations
Route handlers under app/api are the server boundary for browser mutations and client-driven reads. Domains include users/admin, projects, skills, updates, attendance, QR issuance, and contact.
• app/api/admin/users/[id]/role/route.ts
• app/api/projects/[id]/route.ts
• app/api/asistencia/route.ts
• app/api/qr-dinamico/route.ts
The attendance flow generates dynamic QR data, accepts attendance submissions, and supports administrative review/export.
• app/api/qr-dinamico/route.ts
• app/api/asistencia/route.ts
• app/api/admin/attendances/export/route.ts
Data-access architecture
Server Components and handlers consume domain data modules, which delegate persistence to repositories; repositories isolate Prisma/PostgreSQL access. This is the principal data boundary and keeps database queries out of UI and API orchestration.
• lib/data/projects.ts
• lib/data/updates.ts
• repositories/projects/projects.repositories.ts
• repositories/users/users.repositories.ts
• lib/postgresDriver.ts
Public data can be cached through Next server caching/tag mechanisms.
• lib/cache-tags.ts
• lib/data/landing.ts
Persistence, deployment, and integrations
PostgreSQL is modeled with Prisma, including seeded reference/domain data for roles, programs, skills, projects, and updates.
• prisma/schema.prisma
• prisma/seed.ts
• prisma/seeders/01-roles.ts
The runtime is Next.js 15/React 19 with TypeScript, deployed for Vercel serverless execution and edge middleware. Email-backed recovery and operational notifications are abstracted behind:
• lib/email.ts
• vercel.json
Main entry points: route.ts API route handlers · projects.ts Domain data modules · page.tsx App Router pages · ProjectsPageClient.tsx Client page components
Components 17
Next.js web app
- App Router pages · Public and protected SEO-facing routes.
app/page.tsx - Protected layouts
app/(protected)/admin/layout.tsx - Client page components
components/projects/ProjectsPageClient.tsx - Auth context
contexts/AuthContext.tsx
Identity & security
- Request middleware · Guards protected requests before pages load.
middleware.ts - Edge JWT auth
lib/auth/jwt-edge.ts - Auth handlers · Implements login, refresh, approval, profiles, and recovery.
app/api/auth/login/route.ts - CSRF, rate limit & ALTCHA
lib/csrf.ts
Server operations
- API route handlers · Serves auth, admin, projects, updates, attendance, QR, and contact operations.
app/api/projects/[id]/route.ts - QR attendance flow · Issues dynamic QR data and records attendance.
app/api/qr-dinamico/route.ts - Email service · Supports password recovery and operational notifications.
lib/email.ts
Data & persistence
- Domain data modules · Shared server reads for pages and handlers.
lib/data/projects.ts - Server cache tags
lib/cache-tags.ts - Repositories · Isolates database access from UI and API orchestration.
repositories/projects/projects.repositories.ts - Prisma data model
prisma/schema.prisma - PostgreSQL
lib/postgresDriver.ts
Other components
- Vercel runtime · Runs Next.js serverless handlers and edge middleware.
vercel.json
Connections 19
- Vercel runtime → Request middleware: edge execution
- Request middleware → Edge JWT auth: verifies JWT
- Request middleware → Protected layouts: permits roles
- App Router pages → Protected layouts: protected routes
- App Router pages → Client page components: hydrates
- Client page components → Auth context: reads session
- Client page components → API route handlers: client reads & mutations
- Auth context → Auth handlers: login & refresh
- Auth handlers → CSRF, rate limit & ALTCHA: rate limited
- API route handlers → CSRF, rate limit & ALTCHA: protects mutations
- API route handlers → QR attendance flow: attendance endpoints
- App Router pages → Domain data modules: server reads
- API route handlers → Domain data modules: domain operations
- Domain data modules → Server cache tags: tagged public data
- Domain data modules → Repositories: persists through
- Repositories → Prisma data model: queries via
- Prisma data model → PostgreSQL: models
- Auth handlers → Email service: recovery notifications
- QR attendance flow → Repositories: records & exports