How sudeepjoshi456/imageholidays works
Purpose and entry points
Image Holidays is a full-stack Next.js car-rental catalog for a Nepal travel agency. It supports public vehicle discovery and agency contact, plus a single-admin fleet-management workflow; bookings, payments, and customer accounts are intentionally absent. The App Router root is src/app/layout.tsx; public routes are grouped under src/app/(public)/, while administration begins at src/app/admin/page.tsx.
Public catalog experience
Public pages render the home/search, vehicle catalog, vehicle details, agency information, and contact surfaces. Catalog and detail routes use slugs as the public vehicle identity:
• src/app/(public)/page.tsx
• src/app/(public)/cars/page.tsx
• src/app/(public)/cars/[slug]/page.tsx
Shared catalog presentation is split into cards, filters, galleries, and hero search components under src/components/CarCard.tsx, src/components/CatalogFilters.tsx, and src/components/CarGallery.tsx.
Domain and persistence boundary
PostgreSQL is the system of record, accessed through Prisma. The schema and initial migration define the data model, while seeding provisions the sole admin and sample fleet. Server-side data access and derived car presentation logic are centralized in library modules:
• prisma/schema.prisma
• src/lib/prisma.ts
• src/lib/cars.ts
Deployment requires a hosted PostgreSQL provider and Prisma migrations; Prisma 7 uses the PostgreSQL driver adapter at runtime.
Admin fleet lifecycle
The protected admin area provides fleet overview, create/edit forms, deletion, and photo management. Admin mutations are implemented as server-side actions/validation rather than a separate CRUD API layer:
• src/app/admin/cars/new/page.tsx
• src/app/admin/cars/[id]/edit/page.tsx
• src/components/admin/CarForm.tsx
• src/lib/actions.ts
• src/lib/validations.ts
The control flow is: authenticate admin → access fleet/dashboard → submit validated create/update/delete action → persist through Prisma → refresh rendered catalog/admin state.
Authentication and authorization
NextAuth credentials authentication gates the single-admin workflow. The catch-all auth route exposes NextAuth handlers, auth configuration lives in the library layer, and middleware protects admin routes:
• src/app/api/auth/[...nextauth]/route.ts
• src/lib/auth.ts
• src/lib/login-action.ts
• src/middleware.ts
Credentials are seeded/configured from ADMIN_EMAIL and ADMIN_PASSWORD; AUTH_SECRET and AUTH_URL support session security and deployment origin configuration.
External service boundaries
Vercel Blob is isolated behind the upload route used by admin photo management; missing credentials produce upload errors without preventing seeded remote-image demos:
• src/app/api/upload/route.ts
• src/components/admin/PhotoManager.tsx
The contact workflow is a server action that sends through Resend when configured, otherwise logs demo submissions server-side:
• src/components/ContactForm.tsx
• src/lib/actions.ts
Runtime and deployment
The application runs on Next.js 16, TypeScript, and Tailwind CSS, targeting Vercel (vercel.json). Required runtime configuration connects PostgreSQL, NextAuth, agency contact CTA values, and optionally Vercel Blob and Resend. Database evolution is represented by prisma/migrations/, with initial/demo state created through prisma/seed.ts.
Main entry points: actions.ts Server actions · admin/page.tsx Fleet dashboard · prisma.ts Prisma client · cars/page.tsx Catalog pages
Components 21
Public catalog
- Catalog pages · Home, catalog, and slug-based vehicle details.
src/app/(public)/cars/page.tsx - Catalog UI · Cards, filters, galleries, and search.
src/components/CarCard.tsx - Car read model · Loads and derives public car presentation data.
src/lib/cars.ts - Contact form
src/components/ContactForm.tsx
Admin workflow
- Fleet dashboard · Fleet overview and lifecycle entry points.
src/app/admin/page.tsx - Car form · Creates and edits fleet records.
src/components/admin/CarForm.tsx - Photo manager
src/components/admin/PhotoManager.tsx - Server actions · Persists fleet changes and submits contact messages.
src/lib/actions.ts - Input validation
src/lib/validations.ts - Admin route guard
src/middleware.ts - NextAuth handlers
src/app/api/auth/[...nextauth]/route.ts - Credentials auth · Single-admin credentials and session configuration.
src/lib/auth.ts
Data & integrations
- Prisma client · Uses the PostgreSQL driver adapter at runtime.
src/lib/prisma.ts - PostgreSQL
prisma/schema.prisma - Migrations
- Seed data · Provisions the sole admin and demo fleet.
prisma/seed.ts - Blob upload route · Isolates Vercel Blob photo uploads.
src/app/api/upload/route.ts - Vercel Blob · Optional vehicle photo storage.
- Resend · Optional contact delivery; actions log demos when absent.
- Vercel
vercel.json
Other components
- Next.js App Router · Renders public and admin routes.
src/app/layout.tsx
Connections 23
- Next.js App Router → Catalog pages: renders
- Catalog pages → Catalog UI: composes
- Catalog pages → Car read model: loads cars
- Catalog UI → Car read model: displays
- Contact form → Server actions: submits
- Next.js App Router → Fleet dashboard: renders
- Admin route guard → Fleet dashboard: protects
- NextAuth handlers → Credentials auth: uses
- Credentials auth → Prisma client: verifies admin
- Fleet dashboard → Car form: hosts
- Fleet dashboard → Photo manager: hosts
- Car form → Input validation: validates
- Car form → Server actions: mutates
- Server actions → Input validation: validates
- Server actions → Prisma client: persists fleet
- Server actions → Resend: sends contact
- Photo manager → Blob upload route: uploads photos
- Blob upload route → Vercel Blob: stores
- Car read model → Prisma client: queries
- Prisma client → PostgreSQL: reads and writes
- Migrations → PostgreSQL: evolves schema
- Seed data → PostgreSQL: provisions
- Vercel → Next.js App Router: deploys