Production-ready Next.js 15 infrastructure for an electronic point-of-sale SaaS platform.
- Next.js 15 (App Router)
- TypeScript
- Tailwind CSS v4
- Supabase (
@supabase/ssr)
-
Install dependencies:
npm install
-
Copy environment variables:
cp .env.example .env.local
-
Add your Supabase project URL and anon key from the Supabase dashboard.
-
Run the development server:
npm run dev
-
Open http://localhost:3000.
app/
(auth)/login, signup # Public auth routes
(dashboard)/retailer, wholesaler, admin
components/
ui/ # Button, Input, Spinner
auth/ # Login & signup forms
dashboard/ # Shell & placeholders
lib/
supabase/ # Browser, server, middleware clients
auth/routes.ts # Role & route constants
utils/cn.ts
types/
hooks/
middleware.ts # Session refresh + role-based routing
- Users store
roleinuser_metadata(retailer|wholesaler|admin). - Middleware refreshes the Supabase session and enforces:
- Redirect authenticated users away from
/loginand/signup - Block unauthenticated access to dashboard routes
- Restrict dashboards by role
- Redirect authenticated users away from
Generate types from your existing project:
npx supabase gen types typescript --project-id <your-project-id> > types/database.ts| Command | Description |
|---|---|
npm run dev |
Start dev server |
npm run build |
Production build |
npm run start |
Start production server |
npm run lint |
ESLint |
npm run typecheck |
TypeScript check |