-
Notifications
You must be signed in to change notification settings - Fork 9
feat: Add local Supabase (Docker) and waitlist table with seed #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,16 @@ | ||
| NEXT_PUBLIC_POSTHOG_KEY= | ||
| NEXT_PUBLIC_POSTHOG_HOST= | ||
| NEXT_PUBLIC_POSTHOG_HOST= | ||
|
|
||
| # ------------------------------------------------------------------ | ||
| # Supabase (optional) | ||
| # These are OPTIONAL. When unset the app uses placeholder values and | ||
| # runs normally β waitlist submissions will simply not be persisted. | ||
| # | ||
| # For local development with a real database: | ||
| # 1. Install Docker Desktop and make sure it is running. | ||
| # 2. Run `npm run db:start` β it prints the credentials below. | ||
| # 3. Copy the printed values into a `.env.local` file. | ||
| # ------------------------------------------------------------------ | ||
| NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 | ||
| NEXT_PUBLIC_SUPABASE_ANON_KEY= | ||
| SUPABASE_SERVICE_ROLE_KEY= |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { createClient, type SupabaseClient } from "@supabase/supabase-js"; | ||
|
|
||
| const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!; | ||
| const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!; | ||
| const serviceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY; | ||
|
Comment on lines
+3
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π§© Analysis chainπ Script executed: cat -n src/lib/supabase.tsRepository: ACTA-Team/website Length of output: 1249 π Script executed: # Search for env var setup/validation
rg -i 'NEXT_PUBLIC_SUPABASE' --type js --type ts -B2 -A2 | head -50
# Check for any error handling around supabase
rg -i 'supabase.*try|catch.*supabase' --type js --type ts
# Look for .env setup or validation
fd -e '.env*' -o -e '*env*' -type f | grep -v node_modulesRepository: ACTA-Team/website Length of output: 900 π Script executed: # Find env files more simply
find . -name ".env*" -type f 2>/dev/null | head -20
# Look for README or setup docs
find . -iname "readme*" -o -iname "setup*" -type f | head -10
# Check package.json for supabase version
rg '"@supabase' package.json
# Search for any guards around supabase initialization
rg -i 'optional.*supabase|supabase.*optional' --type md --type ts --type js -C2Repository: ACTA-Team/website Length of output: 1064 π Script executed: cat -n .env.example
# Also check if there's any existing placeholder handling in the codebase
rg -i 'placeholder' --type ts --type jsRepository: ACTA-Team/website Length of output: 4243
The non-null assertions on lines 3β4 don't protect runtime values. According to Proposed fix import { createClient, type SupabaseClient } from "@supabase/supabase-js";
-const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!;
-const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!;
+const PLACEHOLDER_SUPABASE_URL = "https://placeholder.supabase.co";
+const PLACEHOLDER_ANON_KEY = "PLACEHOLDER_ANON_KEY_NOT_A_JWT";
+
+const rawSupabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL?.trim();
+const rawSupabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY?.trim();
const serviceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY;
+
+const supabaseUrl =
+ rawSupabaseUrl && !rawSupabaseUrl.includes("your_supabase") && !rawSupabaseUrl.includes("placeholder")
+ ? rawSupabaseUrl
+ : PLACEHOLDER_SUPABASE_URL;
+
+const supabaseAnonKey = rawSupabaseAnonKey || PLACEHOLDER_ANON_KEY;
/**
* Public (anon) Supabase client β safe to use in both client and server code.
* Requires NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY in env.
@@
export function getServiceSupabase(): SupabaseClient {
if (!serviceRoleKey) {
+ console.warn(
+ "[supabase] SUPABASE_SERVICE_ROLE_KEY is missing; falling back to anon client."
+ );
return supabase;
}π€ Prompt for AI Agents |
||
|
|
||
| /** | ||
| * Public (anon) Supabase client β safe to use in both client and server code. | ||
| * Requires NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY in env. | ||
| */ | ||
| export const supabase: SupabaseClient = createClient( | ||
| supabaseUrl, | ||
| supabaseAnonKey | ||
| ); | ||
|
|
||
| /** | ||
| * Server-only Supabase client with the service-role key. | ||
| * Uses anon client when SUPABASE_SERVICE_ROLE_KEY is not set. | ||
| * | ||
| * **Never import this in client components / bundles.** | ||
| */ | ||
| export function getServiceSupabase(): SupabaseClient { | ||
| if (!serviceRoleKey) { | ||
| return supabase; | ||
| } | ||
|
|
||
| return createClient(supabaseUrl, serviceRoleKey, { | ||
| auth: { | ||
| autoRefreshToken: false, | ||
| persistSession: false, | ||
| }, | ||
| }); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Supabase | ||
| .branches | ||
| .temp | ||
|
|
||
| # dotenvx | ||
| .env.keys | ||
| .env.local | ||
| .env.*.local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Soften the βsubmits without errorsβ guarantee.
The current text over-promises behavior when Supabase is unconfigured. Prefer wording that guarantees app startup, but not guaranteed waitlist persistence/success response.
π Suggested wording
π Committable suggestion
π€ Prompt for AI Agents