How essienjoy/voucher works
Purpose and Runtime
This is a Next.js App Router application for a voucher-oriented account portal. It exposes public marketing/authentication pages, authenticated account pages, and an admin dashboard. The runtime is TypeScript/React on Next.js, with global styling and root document concerns in app/layout.tsx and app/globals.css.
Route Entry Points
The public landing route is app/page.tsx, composed from reusable presentation components in app/_components/. Authentication routes are app/(auth)/login/page.tsx and app/(auth)/signup/page.tsx. Account routes are grouped under app/(account)/, including dashboard, profile, voucher listing, and voucher creation; the group layout is app/(account)/layout.tsx. Admin access begins at app/admin/dashboard/page.tsx.
Authentication and Session Boundary
Authentication is centralized in app/_lib/auth.ts, with login/signup UI in app/_components/LoginForm.tsx and app/_components/SignUpForm.tsx. Supabase integration is split by execution context: browser client creation in app/_lib/supabase/client.ts, server-side access in app/_lib/supabase/server.ts, and request/session proxy support in app/_lib/supabase/proxy.ts.
Request Protection and Routing Control
The top-level proxy.ts is the likely request interception boundary for session refresh and route protection, delegating Supabase-specific behavior to app/_lib/supabase/proxy.ts. This separates cross-cutting authentication enforcement from individual pages and account-layout rendering.
Account Portal Flow
Authenticated users enter the shared account shell through app/(account)/layout.tsx, which uses account-specific navigation/presentation from app/(account)/_components/Header.tsx. Primary user workflows are dashboard viewing (app/(account)/dashboard/page.tsx), profile management (app/(account)/profile/page.tsx), voucher browsing (app/(account)/voucher/page.tsx), and voucher creation (app/(account)/voucher/create/page.tsx).
Public UI and Auth Transitions
The landing page can assemble site chrome and marketing sections from app/_components/Header.tsx, app/_components/Hero.tsx, app/_components/About.tsx, and app/_components/Footer.tsx. Authentication forms transition users into the protected account area; app/_components/LogoutButton.tsx provides the inverse session-ending action.
External Services and Deployment
Supabase is the material external backend dependency for authentication and likely persisted application data, based on the dedicated client/server/proxy modules. Next.js supplies server rendering, route handling, and deployment compatibility; the README identifies Vercel as the intended deployment platform. next.config.ts is the framework configuration boundary.
Main entry points: layout.tsx Account shell · auth.ts Auth service · proxy.ts Request proxy · LoginForm.tsx Auth forms
Components 20
Next.js Web App
- Next.js runtime · Provides App Router rendering and route handling.
- Root layout & styles
app/layout.tsx - Next configuration
next.config.ts - Vercel · Intended deployment target.
Public & Auth
- Landing page
app/page.tsx - Marketing components · Header, hero, about, and footer compose the landing page.
- Login route
app/(auth)/login/page.tsx - Signup route
app/(auth)/signup/page.tsx - Auth forms · Login and signup interfaces.
app/_components/LoginForm.tsx
Account Portal
- Account shell · Shared authenticated portal layout and navigation.
app/(account)/layout.tsx - Account header
app/(account)/_components/Header.tsx - Account workflows · Dashboard, profile, voucher listing, and voucher creation.
app/(account)/dashboard/page.tsx - Admin dashboard
app/admin/dashboard/page.tsx - Logout control · Ends the active session.
app/_components/LogoutButton.tsx
Session & Backend
- Auth service · Centralizes authentication operations.
app/_lib/auth.ts - Request proxy · Refreshes sessions and enforces protected routing.
proxy.ts - Supabase proxy support
app/_lib/supabase/proxy.ts - Browser Supabase client
app/_lib/supabase/client.ts - Server Supabase client
app/_lib/supabase/server.ts - Supabase · Authentication and persisted application data.
Connections 23
- Next.js runtime → Root layout & styles: renders
- Next.js runtime → Landing page: routes
- Next.js runtime → Login route: routes
- Next.js runtime → Signup route: routes
- Next.js runtime → Account shell: renders protected routes
- Root layout & styles → Next configuration: configured by
- Landing page → Marketing components: composes
- Login route → Auth forms: uses
- Signup route → Auth forms: uses
- Auth forms → Auth service: authenticates through
- Auth service → Browser Supabase client: uses in browser
- Auth service → Server Supabase client: uses on server
- Browser Supabase client → Supabase: connects to
- Server Supabase client → Supabase: connects to
- Request proxy → Supabase proxy support: delegates session handling
- Supabase proxy support → Supabase: refreshes session with
- Request proxy → Account shell: protects
- Request proxy → Admin dashboard: protects
- Account shell → Account header: uses
- Account shell → Account workflows: hosts
- Account shell → Logout control: includes
- Logout control → Auth service: ends session via
- Next.js runtime → Vercel: deploys to