How joebuildsstuff/my-nextjs-supabase-starter-app works
Project type and purpose
• This is a full-stack web application boilerplate built on Next.js (App Router) with TailwindCSS for styling, Shadcn/UI for pre-built UI components, and Supabase for auth, database, and serverless functions.
• Purpose: Provide a production-ready starter that demonstrates protected routes, dark-mode theming, form templates, and several table implementations (basic, advanced, complex) all backed by Supabase.
File structure
• Top-level config and scripts: next.config.ts, tailwind.config.ts, eslint.config.mjs, jest.config.js
• src/app holds all Next.js App Router pages and layouts, split into two primary routing groups:
• (Auth) for login, magic-link and OAuth callbacks
• (Workspace) for authenticated workspace pages (canvas, forms, tables, ui-stuff)
• src/actions for server-side actions (e.g., user signup, auth)
• src/components for shared UI components (Shadcn/UI wrappers, layout elements, theme provider)
• src/hooks for custom React hooks (use-toast, use-mobile, useTheme)
• src/lib / src/utils for shared code: Supabase client/middleware, store (zustand) for canvas, general helpers
• public for static assets
• Root-level .cursor, .env.example, README.md, package.json, pnpm-lock.yaml
Key points from README
• Authentication: Supabase OAuth & magic links with session & secure redirects
• Theming: next-themes via ThemeProvider + ModeToggle
• Data tables: three levels of complexity with server- and client-side Supabase queries
• Forms: React Hook Form + Zod validation templates for profile, settings, notifications
• Utilities: Radix UI, cmdk, clsx, zod, react-hook-form, date-fns, embla-carousel, recharts, sonner, tailwindcss-animate
Main components & relationships
• Client (Next.js React pages & components)
– Routes: Auth pages → public
– Routes: Workspace pages → protected
– Shared UI: ThemeProvider, navigation, sidebars (components)
– Canvas module: React components + Zustand store + Supabase functions (for saving)
– Tables & Forms: React components + React Hook Form + Zod + Supabase queries
• Server (Next.js server handlers + Supabase edge functions)
– middleware.ts: checks session cookie, redirects unauthenticated requests to login
– src/actions/auth.ts: server actions for sign-in/up
– Supabase database: tables for users, payments, invoices, etc.
– Supabase Edge Functions (in .cursor/rules for migrations & policies)
• External services
– Supabase Auth (OAuth providers, magic links)
– Supabase Database (Postgres)
– Supabase Edge Functions (optionally deployed via CLI)
Architectural patterns & design principles
• Next.js App Router: server-components + client-components for optimized data fetching
• Protected routes via middleware and session cookies
• Separation of concerns:
• UI (presentational) vs. state (Zustand, React Hook Form) vs. data layer (Supabase client in utils)
• Feature grouping: each workspace feature (canvas, forms, tables) self-contained under (Workspace)
• Progressive complexity in tables: blueprint for incremental feature adoption