Skip to content

feat(cli): add Supabase as a backend option#283

Open
gonzoblasco wants to merge 2 commits into
akd-io:developfrom
gonzoblasco:feature/249-add-supabase-support
Open

feat(cli): add Supabase as a backend option#283
gonzoblasco wants to merge 2 commits into
akd-io:developfrom
gonzoblasco:feature/249-add-supabase-support

Conversation

@gonzoblasco

Copy link
Copy Markdown

Add support for Supabase (#249)

Closes #249

Summary

Adds Supabase as a backend-as-a-service option via --supabase flag. This is a bare-bones hosted setup that generates browser and server clients for Next.js App Router, plus the required environment variables.

As noted in the issue, this PR starts with hosted Supabase support (connecting to a remote project). Local development with Docker can be added in a follow-up.

Changes

  • New plugin supabase.ts with:
    • @supabase/supabase-js@^2.0.0 and @supabase/ssr@^0.6.0 as dependencies
    • Browser client generated at lib/supabase/client.ts (uses createBrowserClient)
    • Server client generated at lib/supabase/server.ts (uses createServerClient with cookie handling for App Router)
    • Environment variables: NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY
    • Technology metadata for README and landing page
    • Todo items guiding users to create a Supabase project and update env vars
  • CLI flag: --supabase (boolean)
  • Plugin registration: supabasePlugin added to setup.ts
  • Sort orders: supabase added to technologies, Supabase env vars added to environment variables sort order

Design decisions

  • Hosted only for v1: The issue asks whether to start with hosted or local dev. Hosted is simpler and covers the most common use case. Local dev (Docker, supabase init) can be a follow-up.
  • @supabase/ssr over raw @supabase/supabase-js: The SSR package is the official way to use Supabase with Next.js App Router, handling cookie-based auth in server components and route handlers.
  • No middleware generated: Middleware for auth session refresh can be added later. Keeping the first PR focused on the client setup.
  • No type generation: supabase gen types requires a live project URL. Users can run it after setting up their env vars.

Verification

  • pnpm run build — clean
  • pnpm run lint — no errors
  • pnpm run unit — 9/9 tests pass
  • ./bin/run --help shows --supabase flag

Notes

  • Website (create-next-stack.com) is NOT updated in this PR — can be done in a follow-up.
  • The generated lib/supabase/server.ts uses await cookies() which requires Next.js 15+ (App Router). This is compatible with the Next.js 16 that create-next-stack currently scaffolds.

- Add supabase plugin with @supabase/supabase-js and @supabase/ssr dependencies
- Generate browser client (lib/supabase/client.ts) and server client (lib/supabase/server.ts)
- Add environment variables: NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY
- Add --supabase flag to CLI
- Register supabasePlugin in setup
- Add supabase to technologies and environment variables sort orders
- Bare-bones hosted setup (no local development / Docker)
@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

@gonzoblasco is attempting to deploy a commit to the 9ty Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Supabase

1 participant