Arkive

Phase 1 Supabase auth shell complete

As of
Version1.0.0 Β· completed
Kindplan
Length664 words, about 3 min
Tagsplanliving-planphase-1api-guardrlssupabasedrizzlepostgresqlapi

Milestone: A real login screen that works. Protected routes. A profile in the database. The security skeleton everything else hangs on. Learning payoff: Supabase auth, cookie sessions, Next.js middleware, server vs browser client separation. Completed: May 2026

#TaskComplexityLearningStatus
1.1Create Supabase project; enable email/password authπŸŸ’πŸ”βœ…
1.2Install Supabase client packages in packages/coreπŸŸ’πŸ”βœ…
1.3Implement createBrowserClient() helper in packages/core/supabase/browser.tsπŸŸ‘πŸ”βœ…
1.4Implement createServerClient() helper in packages/core/supabase/server.tsπŸŸ‘πŸ”βœ…
1.5Implement admin/service-role client in packages/core/supabase/admin.ts β€” server onlyπŸ”΄πŸ”βœ…
1.6Write profiles table schema in packages/core using Drizzle; add id, email, createdAtπŸŸ‘πŸ—„οΈβœ…
1.7Set up drizzle.config.ts in packages/core; configure migrations folderπŸŸ‘πŸ—„οΈβœ…
1.8Add a root pnpm db:migrate script that discovers and runs all package migrations in orderπŸ”΄πŸ—„οΈ πŸ“¦βœ…
1.9Enable RLS on profiles; add the canonical user-owns-rows policyπŸ”΄πŸ” πŸ—„οΈβœ…
1.10Implement withRLS(userId, fn) helper in packages/core/db/rls.tsπŸ”΄πŸ” πŸ—„οΈβœ…
1.11Implement Next.js proxy in apps/web β€” session refresh, redirect unauthenticated users, exclude /api/*πŸ”΄πŸ§© πŸ”βœ…
1.12Build login page UI with Mantine form componentsπŸŸ’πŸŽ¨βœ…
1.13Build sign-up page UI with email/passwordπŸŸ’πŸŽ¨βœ…
1.14Add Mantine provider, Notifications, and PostCSS config (see Β§20.4)πŸŸ‘πŸŽ¨βœ…
1.15Implement post-login redirect to /dashboardπŸŸ’πŸ§©βœ…
1.16Build a minimal dashboard shell layout (sidebar navigation placeholder, header)🟒🧩 πŸŽ¨βœ…
1.17Implement sign-out functionalityπŸŸ’πŸ”βœ…
1.18Verify session persists across page reloads; verify redirect works for unauthenticated usersπŸŸ’βœ…

Phase 1 Exit Criteria: βœ… All met.

  • You can sign up, log in, and see a dashboard
  • Unauthenticated access to /dashboard redirects to login
  • RLS is enabled on profiles

Implementation notes:

  • Next.js 16 renamed middleware β†’ proxy. File: middleware.ts β†’ proxy.ts. Export: export function middleware β†’ export function proxy. The config export is unchanged. This affects how session refresh and route protection work at the edge.
  • Profile creation via Postgres trigger, not API route. Trigger on_auth_user_created on auth.users calls create_profile_for_new_user(). The function must reference public.profiles (fully qualified) because triggers run in the auth schema context. This approach handles all auth providers (email, OAuth, magic link) without per-provider app-level code, and cannot fail silently after auth succeeds.
  • CSS modules only. No inline styles. No Mantine style props. packages/eslint-plugin-sidekick with a no-mantine-style-props rule enforces this. Mantine behavioral props (withBorder, shadow, navbar={{ width, breakpoint }}) are allowed; pure style props (h, px, fw, c, mt, size, color, justify, gap) are banned.
  • 4 Supabase clients. A fourth client, createProxyClient(request, response), was added for the Edge runtime. It reads cookies from the incoming request/response directly and never imports next/headers (which is Node.js-only). Used exclusively in proxy.ts.
  • packages/copy added. Centralized string copy shared across all apps. Never hardcode user-visible strings in source files β€” import from packages/copy instead.
  • useNavigation hook added. Always calls router.push() + router.refresh() together. Prevents forgetting the refresh step after auth actions that change server-rendered state.
  • export const dynamic = 'force-dynamic' required. Must be set on all route groups that touch Supabase (e.g. (app)/layout.tsx, (auth)/layout.tsx). Prevents Next.js from pre-rendering server-rendered auth-dependent routes at build time.
  • dotenv-cli pattern for env loading. .env.local lives at the repo root only. All scripts that need env vars prefix with dotenv -e ../../.env.local --. Node.js --env-file flag is blocked as a security measure by Node.js itself.
  • GraphQL + Relay deferred to post-MVP. REST is sufficient for MVP. Relay + App Router friction is unresolved upstream. withApiGuard maps cleanly to REST. Can add GraphQL later without a full rewrite.
  • API versioning (/api/v1/) deferred to post-MVP. Current routes are at /api/. Versioning adds URL complexity for no current benefit β€” MVP has one client and breaking changes can be coordinated directly.
  • DATABASE_DIRECT_URL (port 5432) for migrations only; DATABASE_URL (port 6543) for runtime. DATABASE_DIRECT_URL is NOT needed in Vercel β€” migrations run locally, never on Vercel.
  • Supabase renamed keys in 2025. NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY replaces the old NEXT_PUBLIC_SUPABASE_ANON_KEY. SUPABASE_SECRET_KEY replaces the old SUPABASE_SERVICE_ROLE_KEY.

Arkive

Index

Notes, decisions, and progress on my journey as I build Project Sidekick β€” built in the open; written as it happens.

Tags (121)

View

197 entries.

As ofTitleKind
2026-09-20Pre 2 foundation hardeningplan pre-2 foundation security database testingplan
2026-09-19A graph pattern not a graph databasesystem-design global-tagging-and-llinking postgresql graphspec
2026-09-19Actual stateglossary terminologyglossary
2026-09-19Agent guideai-coding agent gateway agent-guidance rls supabase drizzle api react prettierguidance
2026-09-19Algorithm of lifeglossary terminology nextjsglossary
2026-09-19Alter egosystem-design prd features taxila alter-ego factory aiprd
2026-09-19Anatomy of a core drive entrysystem-design prd features core-driveprd
2026-09-19API firstsystem-design api clispec
2026-09-19API route fail openopportunity phase-2 api security eslint severity-lowopportunity
2026-09-19API versioningsystem-design apispec
2026-09-19App runtime for Drizzlesystem-design database drizzle postgresqlspec
2026-09-19App runtime role for Drizzledecisions technical architecture-decision rls supabase drizzledecision
2026-09-19Approve buildssystem-design monorepo nextjs pnpmspec
2026-09-19Architectural driverssystem-design offlinespec
2026-09-19Architecture invariantsai-coding architecture invariants agent-guidance api nextjsguidance
2026-09-19Asynchronoussystem-design rag embedding embeddingsspec
2026-09-19Atomicsystem-design rag embedding embeddingsspec
2026-09-19Authenticationsystem-design security taxila api authentication pwa mobile clispec
2026-09-19Background jobssystem-design vercel background-jobsspec
2026-09-19Backlogged unplannedplan living-plan backlog taxila zinsser alter-ego parrot rls supabaseplan
2026-09-19Be a better version of yourselfprd value-proposition specificationprd
2026-09-19Best practicesai-coding-harness agent-guidance drizzle api react pnpm css offline embeddings soft-deleteguidance
2026-09-19Build for today designed for futuresystem-design offlinespec
2026-09-19Bundle everythingsystem-design monorepospec
2026-09-19Capacitorsystem-design native-apps nextjs mobile offlinespec
2026-09-19Centralizedsystem-design feature-systemspec
2026-09-19Centralizedsystem-design observability api authenticationspec
2026-09-19Centralized and client agnosticsystem-design security rls api authentication clispec
2026-09-19Centralized copydecisions technical architecture-decision authentication typescript clidecision
2026-09-19Centralized copysystem-design contentspec
2026-09-19Checkpoint aplan phase-0 checkpoint nextjs typescript turborepo pnpm cliplan
2026-09-19Checkpoint bplan phase-0 checkpoint eslint prettier turborepo pnpmplan
2026-09-19Checkpoint cplan phase-0 checkpoint nextjs pnpmplan
2026-09-19Checkpoint dplan phase-0 checkpoint api-guard rls supabase drizzle api authenticationplan
2026-09-19CLIsystem-design cli apispec
2026-09-19Commands and environmentai-coding commands environment agent-guidance prettier pnpm cliguidance
2026-09-19Context assemblersystem-design ai war-room factory api-guardspec
2026-09-19Coresystem-design feature-systemspec
2026-09-19Core drive vs Taxilasystem-design prd features taxila core-driveprd
2026-09-19Corepacksystem-design monorepo pnpmspec
2026-09-19CSS modulessystem-design css eslint mantinespec
2026-09-19Database and securityai-coding database security agent-guidance api-guard rls drizzle api react repository-patternguidance
2026-09-19DB access chokepointopportunity phase-2 database rls architecture severity-highopportunity
2026-09-19Dependency flowsystem-design monorepo clispec
2026-09-19Design constraintssystem-design global-tagging-and-llinking rls offline soft-deletespec
2026-09-19dotenv CLIdecisions technical architecture-decision clidecision
2026-09-19dotenv CLIsystem-design config clispec
2026-09-19Driving forces and key featuressystem-design api offlinespec
2026-09-19Edge runtimedecisions technical architecture-decision supabase api nextjsdecision
2026-09-19Edge runtimesystem-design security supabasespec
2026-09-19Embedding status fieldsystem-design rag embedding typescript embeddingsspec
2026-09-19Enforced conventionssystem-designspec
2026-09-19Env vars in turbo JSONdecisions technical architecture-decision turborepo verceldecision
2026-09-19Env vars in turbo JSONsystem-design monorepo turborepo vercelspec
2026-09-19Environment contract driftopportunity phase-2 configuration security developer-experience severity-mediumopportunity
2026-09-19Error handlingsystem-design observability api-guard rls supabase api nextjs react aispec
2026-09-19ESLint plugin boundariessystem-design code-quality-checks eslintspec
2026-09-19ESLint rules to use tsupdecisions technical architecture-decision nextjs eslintdecision
2026-09-19Essential and ideal stateglossary terminologyglossary
2026-09-19Evolvabilitysystem-design rls offlinespec
2026-09-19Factorysystem-design prd features factoryprd
2026-09-19Feature package workai-coding features monorepo agent-guidance feature-systemguidance
2026-09-19Flat configdecisions technical architecture-decision typescript eslintdecision
2026-09-19Flat configsystem-design code-quality-checks eslintspec
2026-09-19Force dynamicdecisions technical architecture-decision supabase authentication nextjsdecision
2026-09-19Force dynamicsystem-design nextjs supabasespec
2026-09-19Global tags and metadatasystem-design global-tagging-and-llinking taxila zinsser alter-ego war-room factory core-drivespec
2026-09-19GraphQL and Relaysystem-design api graphql relayspec
2026-09-19GraphQL Relaydecisions technical architecture-decision api-guard rls supabase drizzle api authentication nextjsdecision
2026-09-19Historic stateglossary terminologyglossary
2026-09-19Idempotent APIsystem-design api idempotencyspec
2026-09-19Independent deploymentssystem-design feature-systemspec
2026-09-19Informationglossary terminologyglossary
2026-09-19Installation at workspace levelsystem-design code-quality-checks typescript pnpmspec
2026-09-19Instrumentationsystem-design observability vercel embeddingsspec
2026-09-19Interaction modelprd ux specificationprd
2026-09-19Isolationsystem-design feature-systemspec
2026-09-19Lifecycle and traceabilityprd governance planningguidance
2026-09-19Living implementation planplan living-plan taxila zinsser alter-ego war-room factory parrot core-driveplan
2026-09-19Make right behavior easierprd value-proposition specificationprd
2026-09-19Mantinesystem-design css mantinespec
2026-09-19Many clients and many consumerssystem-design api pwa ai rag clispec
2026-09-19May become part of Taxilasystem-design core-drive taxilaspec
2026-09-19Middlewaresystem-design security api authenticationspec
2026-09-19Migrationsystem-design database drizzle pnpmspec
2026-09-19Model router contractsystem-design ai model-routing provider-agnostic embeddingsspec
2026-09-19Model routingprd feature vercel ai embedding model-routingprd
2026-09-19Module resolution bundlerdecisions technical architecture-decision nextjs typescriptdecision
2026-09-19Module resolution bundlersystem-design code-quality-checks typescriptspec
2026-09-19Narrow the gapprd value-proposition specificationprd
2026-09-19Never mutate outside API layersystem-design apispec
2026-09-19No API versioningdecisions technical architecture-decision api-guard api nextjs clidecision
2026-09-19No utility stylesdecisions technical architecture-decision eslint mantine cssdecision
2026-09-19Non syncable tablessystem-design database offlinespec
2026-09-19Notesai-coding-harness agent-guidance nextjs eslint pnpm cssguidance
2026-09-19Observabilitysystem-design api-guard api authentication vercel observabilityspec
2026-09-19Observablesystem-design rag embedding embeddings observabilityspec
2026-09-19Offline readysystem-design api pwa offline soft-delete idempotencyspec
2026-09-19Package boundary enforcementopportunity phase-2 monorepo eslint architecture severity-mediumopportunity
2026-09-19Parrotsystem-design prd features parrotprd
2026-09-19Phase 0 foundation and toolingplan phase-0 api nextjs typescript eslint turborepo pnpmguidance
2026-09-19Phase 0 foundation tooling completeplan living-plan phase-0 nextjs typescript eslint prettier turborepo pnpmplan
2026-09-19Phase 1 Supabase and auth shellplan phase-1 rls supabase drizzle postgresql authentication nextjsguidance
2026-09-19Phase 1 Supabase auth shell completeReadingplan living-plan phase-1 api-guard rls supabase drizzle postgresql apiplan
2026-09-19Phase 1.1 DB level RLS soft delete enforcement completeplan living-plan phase-1.1 rls supabase drizzle postgresql pnpm soft-deleteplan
2026-09-19Phase 1.1 DB RLS enforcementplan phase-1-1 rls database supabase drizzle postgresql api typescriptguidance
2026-09-19Phase 10 observability hardeningplan living-plan phase-10 api-guard rls api authentication nextjs offlineplan
2026-09-19Phase 11 dogfooding friends family access optionalplan living-plan phase-11plan
2026-09-19Phase 12 billing SaaS readiness optional pathplan living-plan phase-12 api offlineplan
2026-09-19Phase 2 core infrastructure API guard feature systemplan living-plan phase-2 api-guard rls api authentication feature-systemplan
2026-09-19Phase 3 graph store metadata serviceplan living-plan phase-3 api-guard rls postgresql api offline graphplan
2026-09-19Phase 4 Taxila v1 knowledge managementplan living-plan phase-4 taxila api-guard rls drizzle api authenticationplan
2026-09-19Phase 5 Zinsser v1 writing editor firstplan living-plan phase-5 taxila zinsser api mantine ai embeddingsplan
2026-09-19Phase 6 core drive AI layer alter egoplan living-plan phase-6 taxila zinsser alter-ego war-room factory core-driveplan
2026-09-19Phase 7 war room factory v1plan living-plan phase-7 war-room factory core-drive rls api offlineplan
2026-09-19Phase 8 PWA iOS shellplan living-plan phase-8 taxila alter-ego nextjs vercel pwa mobileplan
2026-09-19Phase 9 API keys CLIplan living-plan phase-9 taxila api-guard rls api authentication cliplan
2026-09-19Pooler client configurationopportunity phase-2 database supabase drizzle severity-mediumopportunity
2026-09-19Portable documentation vaultopportunity documentation agentic-coding portability severity-mediumopportunity
2026-09-19Post mvp factory extensions bots agentsplan living-plan backlog factory parrot api-guard rls supabase drizzleplan
2026-09-19Prefer JSON configsystem-design monorepospec
2026-09-19Present stateglossary terminologyglossary
2026-09-19Prettier at repo levelsystem-design code-quality-checks prettierspec
2026-09-19Private informationsystem-design prd features core-drive taxila graphprd
2026-09-19Profile creation Postgres triggersystem-design security postgresql api authenticationspec
2026-09-19Profile trigger and referential integrityopportunity phase-2 database authentication integrity severity-highopportunity
2026-09-19Profiles schemasystem-design security rls authenticationspec
2026-09-19Public API onlysystem-design api rls authentication clispec
2026-09-19PWAsystem-design pwa offlinespec
2026-09-19RAGsystem-design rag ai embeddingsspec
2026-09-19Reflections and learningssystem-design prd features core-driveprd
2026-09-19Registrysystem-design feature-systemspec
2026-09-19Repository clientsystem-design database rls supabase drizzle api repository-patternspec
2026-09-19Request flowsystem-design monorepo api offlinespec
2026-09-19Retryablesystem-design rag embedding embeddingsspec
2026-09-19Row level securitysystem-design security rls drizzle offlinespec
2026-09-19Runtime database URL driftopportunity phase-2 security rls configuration severity-highopportunity
2026-09-19Runtime role reproducibilityopportunity phase-2 database security severity-criticalopportunity
2026-09-19Runtime validationsdecisions technical architecture-decision api-guard supabase api typescript clidecision
2026-09-19Runtime validationssystem-design typescriptspec
2026-09-19Security proof and ciopportunity phase-2 testing ci security severity-highopportunity
2026-09-19Server actionssystem-design nextjs rls api authenticationspec
2026-09-19Shared tsconfigdecisions technical architecture-decision nextjs clidecision
2026-09-19Shared tsconfigsystem-design code-quality-checks typescriptspec
2026-09-19Signup confirmation flowopportunity authentication ux severity-lowopportunity
2026-09-19Soft delete supportsystem-design database soft-deletespec
2026-09-19Source attributionprd features alter-ego aiprd
2026-09-19State representationsystem-design api aispec
2026-09-19Structured response attributionsystem-design ai structured-streaming source-attribution citationsspec
2026-09-19Syncable tablessystem-design database offline soft-deletespec
2026-09-19System overview diagramsystem-designspec
2026-09-19Tag taxonomyai-coding agent-guidance taxonomy discoveryguidance
2026-09-19Task 1.1plan phase-1 task supabase postgresql api authentication nextjsplan
2026-09-19Task 1.10plan phase-1 task rls supabase drizzle postgresql authentication typescriptplan
2026-09-19Task 1.11plan phase-1 task api-guard rls supabase api authentication nextjsplan
2026-09-19Task 1.12and1.13plan phase-1 task supabase api authentication nextjs react typescriptplan
2026-09-19Task 1.14plan phase-1 task react pnpm mantine cssplan
2026-09-19Task 1.15and1.16plan phase-1 task supabase authentication nextjs react mantineplan
2026-09-19Task 1.17plan phase-1 task supabase authenticationplan
2026-09-19Task 1.18plan phase-1 task api-guard rls supabase drizzle postgresql authenticationplan
2026-09-19Task 1.2plan phase-1 task supabase drizzle postgresql authentication nextjs pnpmplan
2026-09-19Task 1.3plan phase-1 task supabase nextjs typescriptplan
2026-09-19Task 1.4plan phase-1 task supabase authentication nextjs react typescriptplan
2026-09-19Task 1.5plan phase-1 task rls supabase authentication typescriptplan
2026-09-19Task 1.6plan phase-1 task rls supabase drizzle authentication typescript offlineplan
2026-09-19Task 1.7plan phase-1 task drizzle postgresql typescriptplan
2026-09-19Task 1.8plan phase-1 task turborepo pnpmplan
2026-09-19Task 1.9plan phase-1 task rls supabase drizzle postgresql authenticationplan
2026-09-19Taxilasystem-design prd features taxila ragprd
2026-09-19Technology stacksystem-design supabase drizzle postgresql nextjs typescript turborepo pnpm vercelspec
2026-09-19Tiered context modelsystem-design core-drive domain situation war-room factory ai embeddingsspec
2026-09-19Tiptap requirementsystem-design rag embedding embeddingsspec
2026-09-19tsupsystem-design code-quality-checks eslintspec
2026-09-19Turboreposystem-design monorepo turborepo pnpmspec
2026-09-19TypeScript hoistingdecisions technical architecture-decision nextjs typescript pnpmdecision
2026-09-19Use corepackdecisions technical architecture-decision pnpm verceldecision
2026-09-19Use navigation hooksystem-design nextjsspec
2026-09-19User profile creation by DB triggerdecisions technical architecture-decision supabase api authenticationdecision
2026-09-19Values onlysystem-design prd features core-drive war-room factoryprd
2026-09-19Verceldecisions technical architecture-decision nextjs turborepo pnpm verceldecision
2026-09-19Vercelsystem-design monorepo turborepo pnpm vercelspec
2026-09-19War roomsystem-design prd features war-roomprd
2026-09-19What is itsystem-design prd features core-drive factory aiprd
2026-09-19Why Prettier at repo level?decisions technical architecture-decision prettier turborepo graphdecision
2026-09-19Why Turborepodecisions technical architecture-decision turborepo pnpmdecision
2026-09-19With API guardsystem-design security api-guard rls api authentication typescriptspec
2026-09-19Zinssersystem-design prd features zinsser aiprd
2026-08-24Model selection strategyWhich model to use for which kind of session based on the type of task, teaching value, and complexitysidekick project technical ainote
2026-08-24Sidekick's Architectural OverviewSidekick's architectural overview β€” an API-first platform tuned for solo developerssidekick project technical architecturenote
2026-07-19Project Sidekick - A Bird's Eye ViewAn introduction to Project Sidekick. What is it? What problem does it solve? Why am I building it?essays sidekickessay
2026-07-10Building in the margins of realityProject kick-off post and a confessional essay about my past attempts and their failures. Why start now? What do I hope to achieve?essays sidekickessay
2026-05-29Checkpoint A walkthroughbuild walkthrough phase-0 checkpointguidance
2026-05-29Checkpoint B walkthroughbuild walkthrough phase-0 checkpointguidance
2026-05-29Checkpoint C walkthroughbuild walkthrough phase-0 checkpointguidance
2026-05-29Checkpoint D walkthroughbuild walkthrough phase-0 checkpointguidance
2026-05-29Config files explainedbuild walkthrough phase-0 turborepo typescript eslint prettierguidance
2026-05-29Phase 1 walkthroughbuild walkthrough phase-1 supabase drizzle authenticationguidance