Linked is a Next.js dashboard that now ships with a fully typed Supabase backend, storage bucket support for media assets, and tooling to seed development data quickly.
- Node.js 20+
- A Supabase project
- Optional: Supabase CLI (helps run schema/policy SQL locally before pushing)
npm installThis pulls in the Supabase SDKs (@supabase/supabase-js, @supabase/ssr, @supabase/auth-helpers-nextjs) plus utilities used for seeding (dotenv, tsx).
Copy .env.example to .env.local and fill in the variables that matter for your Supabase project:
SITE_URL=...
NEXT_PUBLIC_SUPABASE_URL=...
NEXT_PUBLIC_SUPABASE_ANON_KEY=...
NEXT_PUBLIC_SUPABASE_STORAGE_BUCKET=images
NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY=...
NEXT_PUBLIC_SUPABASE_JWT_SECRET=...NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY is required for server-side mutations and the seed script. Keep it out of the browser—only expose * keys client-side.
-
Apply tables and relationships:
psql "$SUPABASE_DB_URL" -f supabase/schema.sqlOr run
supabase db pushif you’re using the Supabase CLI. -
Provision storage and policies (run with the service role user):
psql "$SUPABASE_DB_URL" -f supabase/storage-policies.sqlThis creates (or reconfigures) a public
imagesbucket and RLS policies that allow:- Public reads for generated URLs
- Authenticated uploads/updates/deletes
Seed demo data any time with:
npm run seedThe script reads .env.local, injects a demo account, content rows, and default settings. Update scripts/seed.ts if you want different fixtures.
High-level helpers live in lib/supabase/storage.ts:
uploadImageFromBrowser– upload user-selected files client-sidegetPublicImageUrl/createSignedImageUrl– generate delivery URLsdeleteImages– purge unused assets
They all default to the images bucket but accept custom clients so you can reuse them inside server actions or route handlers.
npm run devOpen http://localhost:3000 and iterate. Lint and format helpers stay available:
npm run lint
npm run formatDeploy like any other Next.js (Vercel, Render, etc.). Remember to configure the same environment variables on the target platform and run the SQL/policy files against your production Supabase instance.