Next.js App Router project that powers the CyberWorld authentication gateway. Supabase Auth provides login and registration, backed by the Supabase local development stack for testing.
- Node.js 20.9+ (project developed with Node 25 via
nvm) - Docker (required for the Supabase local stack)
- GitHub CLI authentication (for pushes)
npm installCopy the example file and fill in the Supabase keys once the local stack is running (step 3):
cp env.example .env.localThe local Supabase CLI will print the anon, service_role, and JWT secret. Paste them into .env.local.
The project uses the Supabase CLI (run via npx). The helper scripts keep everything in sync:
# start postgres, auth, studio, etc.
npm run supabase:start
# in a second terminal you can inspect the stack
npm run supabase:stop # when you are finishedOn the first run the CLI initialises supabase/config.toml and seeds the database with defaults. The auth site URL is set to http://127.0.0.1:3000 to match the Next.js dev server.
npm run devVisit http://localhost:3000 to view the gateway. The UI exposes:
/login– Supabase email/password login using server actions/register– registration flow that immediately signs the user in (no email confirmation locally)/dashboard– protected route guarded bymiddleware.ts
- With Supabase running, open
/registerand create a user. - You should land on
/dashboardand see your Supabase user ID/email. - Sign out to clear the auth cookies, then try
/dashboardagain to confirm the redirect back to/login.
You can inspect emails sent by Supabase (magic links, resets) at http://localhost:54324 via the bundled Inbucket UI.
The Supabase CLI is already initialised (supabase/ directory). Use the standard workflow when modelling product schemas:
npx supabase migration new add_product_schema
# edit the generated SQL then
npx supabase db reset # apply locally
npx supabase db diff -f schema.sql