How idraynar/activities-agenda works
Project type and purpose
• This is a full-stack web application (“Activities Agenda”) built with Next.js 15.
• It provides user registration, authentication, activity creation & reservation, plus an admin dashboard with analytics.
• Backend runs as Next.js API routes (serverless functions) with Prisma ORM and PostgreSQL.
• Frontend uses React components, TailwindCSS, client/server components, and Leaflet for maps.
File structure
• Top-level “app/” directory contains:
• app/page.tsx, global layouts, error handlers
• app/api/… – all RESTful API routes (activities, auth, dashboard stats, reservations, etc.)
• app/components/… – reusable React UI components
• app/dashboard/… – admin dashboard pages & components
• pages for login, register, profile, forgot/reset password
• “lib/” contains shared Node-side logic (lib/auth.ts, lib/prisma.ts).
• “prisma/” holds schema.prisma, migrations, seed script.
• “middleware.ts” implements Next.js middleware (e.g., authentication).
• Config files: next.config.js/ts, tailwind.config.js, sentry configs for error monitoring.
README for additional insights
• Confirms tech stack: Next.js SSR/SSG, React 19, TailwindCSS, HeadlessUI, Leaflet, NextAuth.js, Prisma, PostgreSQL, Sentry, SMTP/Gmail for emails.
• Describes user vs. admin flows, real-time reservations, dynamic metadata (SEO), performance optimizations.
Main components
a. Frontend
• Next.js pages & client components (React)
• UI components (app/components)
• Leaflet map module
• TailwindCSS styling
b. Backend
• Next.js API Routes (Serverless Functions)
• Authentication layer (NextAuth.js, middleware.ts)
• Business logic (lib/auth.ts)
• Validation & error handling
c. Database
• PostgreSQL (Neon) accessed via Prisma ORM
• Prisma migration & seed scripts
d. External Services
• SMTP/Gmail for email (forgot/reset password)
• Optional TMDB API (if used)
• Sentry for error monitoring (client, server, edge)
e. CI/CD & Deployment
• GitHub Actions (CI)
• Next.js build & deployment (Vercel or custom host)
Relationships and data flow
• User browser ⇄ Next.js React pages (SSR/SSG)
• React pages call API routes via fetch or Next.js internal calls
• API routes authenticate via NextAuth, then call lib/prisma to read/write PostgreSQL
• Prisma generates SQL queries to the database
• Reservation emails triggered via SMTP service
• Sentry captures errors at client/server
• Admin dashboard fetches stats from API → Prisma → DB
Architectural patterns & principles
• Monolithic full-stack “app” folder structure (separation of concerns: pages vs. components vs. API)
• Serverless functions for each API endpoint (scoped, stateless handlers)
• Prisma as repository/DAO layer
• NextAuth.js middleware for authentication & session management
• TailwindCSS for utility-first styling
• Component-based UI with HeadlessUI for accessibility
• -view module decoupled via Leaflet