A modern, production-ready authentication web application built with Vite + React + TypeScript + Supabase, following global industry conventions for folder structure, tooling, testing, and scalability.
src/
βββ modules/
β βββ authentication/ # Authentication module
β β βββ components/ # Auth-specific components (forms, inputs, social login)
β β βββ configs/ # Content maps and error maps
β β βββ contexts/ # Auth context provider
β β βββ hooks/ # Auth custom hooks (useAuthSubmit)
β β βββ layouts/ # Auth layout wrapper
β β βββ pages/ # Auth pages
β β β βββ auth-sign-in.page.tsx
β β β βββ auth-sign-up.page.tsx
β β β βββ auth-forgot-password.page.tsx
β β β βββ auth-update-password.page.tsx
β β βββ schemas/ # Zod validation schemas
β β βββ services/ # Auth service (sign in/up, OAuth, reset)
β β
β βββ application/ # Application module
β βββ components/ # App components (header, sidebar, breadcrumb)
β βββ layouts/ # App layout wrapper
β βββ pages/ # App pages (dashboard)
β βββ types/ # App-specific types
β
βββ routes/
β βββ configs/ # Route paths and route definitions
β βββ core/ # Route builder, guards, wrappers, error boundary
β βββ hooks/ # Route-specific hooks
β βββ types/ # Route types
β βββ index.tsx # Router configuration
β
βββ components/
β βββ ui/ # shadcn/ui components (20+ components)
β βββ button.tsx, input.tsx, card.tsx, etc.
β βββ sidebar.tsx, breadcrumb.tsx, avatar.tsx
β βββ loader.tsx, spinner.tsx, skeleton.tsx
β
βββ contexts/ # Global contexts (theme)
βββ hooks/ # Global custom hooks (media query, mobile)
βββ lib/
β βββ supabase.ts # Supabase client configuration
β βββ utils.ts # Utility functions (cn, etc.)
β
βββ assets/ # Static assets (fonts)
βββ tests/ # Test setup and utilities
βββ App.tsx # Root app component
βββ main.tsx # Application entry point
cd codecraft-auth
pnpm install
.env file in the project rootVITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
.env filehttps://YOUR-PROJECT-ID.supabase.co/auth/v1/callbackThe authentication is handled automatically by Supabase Auth. No additional table setup is required for basic email/password authentication.
Start the development server:
pnpm dev
The app will be available at http://localhost:5173
Build for production:
pnpm build
Preview the production build:
pnpm preview
Run tests:
pnpm test
Run tests with UI:
pnpm test:ui
@/)/auth/sign-in - Sign in page (email/password + Google)/auth/sign-up - Sign up page with confirmation/auth/forgot-password - Password reset request page/auth/update-password - Password update page (after reset)/ - Redirects to dashboard/app/dashboard - User dashboard with sidebar (requires authentication)* - 404 Not Found page.page.tsx suffix, layouts use .layout.tsxroutes/configs/class-variance-authority for component variantssrc/modules/components/, pages/, services/, schemas/, hooks/, types/src/routes/configs/route-definitions.tsmodules/authentication/services/auth.service.ts with the new provider methodmodules/authentication/components/auth-social-login.tsxmodules/application/pages/)routes/configs/route-definitions.tsrequiresAuth: true in the route configUse shadcn/ui CLI to add more components:
pnpm dlx shadcn@latest add button
pnpm dlx shadcn@latest add input
pnpm dlx shadcn@latest add form
pnpm dlx shadcn@latest add dialog
pnpm dlx shadcn@latest add table
MIT