Initialize Next.js + TypeScript + Supabase foundation - #1
Conversation
|
Warning Review limit reached
More reviews will be available in 49 minutes and 20 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (18)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90742a4184
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import { createBrowserClient } from "@supabase/ssr"; | ||
|
|
||
| function getRequiredPublicEnv(name: "NEXT_PUBLIC_SUPABASE_URL" | "NEXT_PUBLIC_SUPABASE_ANON_KEY") { | ||
| const value = process.env[name]; |
There was a problem hiding this comment.
Inline public env reads for the browser client
Because this file is a "use client" module, this dynamic lookup has to survive into the browser bundle. Next.js only inlines NEXT_PUBLIC_* values for static process.env.NEXT_PUBLIC_... references, and its docs call out that dynamic lookups like process.env[varName] are not inlined (https://nextjs.org/docs/pages/guides/environment-variables#bundling-environment-variables-for-the-browser). When a client component uses createSupabaseBrowserClient, these reads will be undefined in the browser and the helper will throw despite valid build-time env config; read the URL and anon key with static property access before passing them to Supabase.
Useful? React with 👍 / 👎.
Motivation
Description
package.json,tsconfig.json,next.config.ts, andeslint.config.mjswith strict TypeScript enabled and an ESLint ignore for build artifacts.app/layout.tsx,app/page.tsx,app/dashboard/page.tsx, and styles inapp/globals.css, plus layout componentscomponents/layout/{app-shell,sidebar,topbar}.tsx.app/api/health/route.tsthat returns a JSON health/status response indicating foundation-only state.lib/supabase/client.tsthat only readsNEXT_PUBLIC_env vars and a server client inlib/supabase/server.tsthat uses cookie-backed SSR APIs while avoiding exposing any service role key to client code.lib/security/auth.tsthat resolve or require the current Supabase user for future protected routes.lib/validation/schemas.tsfornamespace,strength,canonStatus, andmemoryTypeto satisfy the memory classification contract..gitignoreand.env.example(contains placeholders includingSUPABASE_SERVICE_ROLE_KEYandOPENAI_API_KEYbut no real secrets).Testing
npm installsuccessfully to install dependencies.npm run typecheck(tsc --noEmit) and TypeScript strict checks passed after minor type annotations were added to the server cookie handler.npm run lintwitheslint(configured to ignore.nextandnode_modules) and the build-time linting completed as part ofnext build.npm run buildwhich compiled and optimized the app successfully.npm run dev -- -H 0.0.0.0and verifiedGET /api/healthreturns the expected JSON response.Codex Task