[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-83294":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":8,"language":10,"languages":8,"totalLinesOfCode":8,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":15,"stars30d":15,"stars90d":14,"forks30d":14,"starsTrendScore":16,"compositeScore":17,"rankGlobal":8,"rankLanguage":8,"license":8,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":8,"pushedAt":8,"updatedAt":22,"readmeContent":23,"aiSummary":8,"trendingCount":14,"starSnapshotCount":14,"syncStatus":24,"lastSyncTime":25,"discoverSource":26},83294,"behindthecode","pontusab\u002Fbehindthecode","pontusab",null,"https:\u002F\u002Fbehindthecode-nu.vercel.app","TypeScript",69,9,54,0,11,1,3,false,"main",true,[],"2026-06-12 02:04:33","# BehindTheCode\n\n![Behind The Code — open-source video platform](.\u002F.github\u002Fhero.png)\n\nA polished, open-source, single-publisher video platform — think a Netflix-clean\nbrand channel rather than a community site. Built with Next.js 16 (Cache\nComponents), Mux, Supabase (Postgres + Auth + Storage), a minimal monochrome\nshadcn-style UI, Tiptap authoring, and optional Polar monetization.\n\n## Deploy\n\n[![Deploy with Vercel](https:\u002F\u002Fvercel.com\u002Fbutton)](https:\u002F\u002Fvercel.com\u002Fnew\u002Fclone?repository-url=https%3A%2F%2Fgithub.com%2Fpontusab%2Fbehindthecode&root-directory=apps%2Fweb&project-name=behindthecode&repository-name=behindthecode&env=NEXT_PUBLIC_SUPABASE_URL,NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY,SUPABASE_SECRET_KEY,MUX_TOKEN_ID,MUX_TOKEN_SECRET,MUX_WEBHOOK_SECRET,NEXT_PUBLIC_APP_URL,CRON_SECRET&envDescription=Core%20Supabase%20%2B%20Mux%20credentials%20required%20to%20boot.%20Optional%20OAuth%2C%20AI%20moderation%20and%20Polar%20vars%20can%20be%20added%20later.&envLink=https%3A%2F%2Fgithub.com%2Fpontusab%2Fbehindthecode%2Fblob%2Fmain%2F.env.example)\n\nOne click clones the repo, prompts for the **Core** environment variables, and\nbuilds from `apps\u002Fweb`. You still need a **Supabase project** (for the database\nschema) and a **Mux account** first — see [Deploying](#deploying) for the full\nchecklist, including the Mux webhook, scheduled-publish cron, and optional\nPolar setup.\n\n## Stack\n\n- **Monorepo:** Turborepo + Bun workspaces\n- **App:** Next.js 16 (App Router, `cacheComponents`, Turbopack), React 19.2\n- **Video:** Mux (upload, playback, signed playback, captions, Mux Data)\n- **Database:** Supabase Postgres (typed data layer, RLS, full-text search)\n- **Auth:** Supabase Auth via `@supabase\u002Fssr` (admins + viewers, roles in\n  `app_metadata`, optional OAuth\u002Fmagic link)\n- **Storage:** Supabase Storage (thumbnails + branding buckets)\n- **UI:** Tailwind v4 + shadcn-style components, custom theme, light\u002Fdark\n- **Authoring:** Tiptap (→ Markdown) + MDX rendering\n- **Monetization (optional):** Polar subscriptions + one-time purchases\n- **Hosting:** Vercel + Supabase\n\n## Layout\n\n```\napps\u002F\n  web\u002F            # the single Next.js app (viewer + \u002Fadmin)\npackages\u002F\n  db\u002F             # Supabase client, typed repositories, generated DB types\n  mux\u002F            # Mux client + helpers (upload, webhook, signed playback)\n  ui\u002F             # design system (theme, components, player, editor)\n  config\u002F         # shared tsconfig\nsupabase\u002F\n  migrations\u002F     # schema, RLS, triggers, storage buckets, stats functions\n```\n\n## Getting started\n\n```bash\nbun install\n\n# 1. Start a local Supabase stack (requires Docker)\nsupabase start\n# Copy the printed API URL + anon\u002Fservice_role keys into apps\u002Fweb\u002F.env.local\n# (a ready-to-use .env.local pointing at the default local stack is included).\n\ncp .env.example .env.local   # for non-local setups, fill in your project keys\nbun run seed                 # creates the admin + demo content (optional)\nbun run dev\n```\n\nThe schema lives in `supabase\u002Fmigrations`. Apply it locally with\n`supabase db reset`, and regenerate the typed client with\n`supabase gen types typescript --local > packages\u002Fdb\u002Fsrc\u002Fdatabase.types.ts`.\n\nOpen http:\u002F\u002Flocalhost:3000. The admin lives at `\u002Fadmin`.\n\nThe **first account to sign up automatically becomes an admin**. After that,\nmanage roles from the admin Users page.\n\nSee [`.env.example`](.\u002F.env.example) for all environment variables. Only the\nCore section is required; sign-in providers, AI moderation, and Polar\nmonetization all auto-enable when their variables are present.\n\n## Scripts\n\n- `bun run dev` — start the dev server\n- `bun run build` — production build\n- `bun run typecheck` — type-check all workspaces\n- `bun run seed` — seed admin + demo data\n- `bun run seed:admin` — seed only the admin account\n\n## Deploying\n\n1. **Create a Supabase project** at https:\u002F\u002Fsupabase.com\u002Fdashboard, then push\n   the schema with `supabase db push` (link first via `supabase link`). The\n   migrations create all tables, RLS policies, triggers, and the\n   `thumbnails` \u002F `branding` storage buckets.\n2. **Import the repo** into Vercel and set the **Root Directory** to `apps\u002Fweb`.\n   Turborepo handles the workspace build; the framework preset is Next.js.\n3. **Add environment variables** from `.env.example` (Core required; the rest\n   are opt-in). Use the new Supabase API keys: `NEXT_PUBLIC_SUPABASE_URL`,\n   `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` (`sb_publishable_...`),\n   `SUPABASE_SECRET_KEY` (`sb_secret_...`), and `NEXT_PUBLIC_APP_URL` (your\n   production URL). The legacy `anon` \u002F `service_role` keys still work as a\n   fallback. In the Supabase dashboard, add `https:\u002F\u002F\u003Cyour-domain>\u002Fauth\u002Fcallback`\n   to the **Auth → URL Configuration** redirect allow-list.\n4. **Mux webhook:** in the Mux dashboard add a webhook pointing at\n   `https:\u002F\u002F\u003Cyour-domain>\u002Fapi\u002Fmux\u002Fwebhook` and copy the signing secret into\n   `MUX_WEBHOOK_SECRET`. This is what marks uploaded assets as ready.\n5. **Scheduled publishing:** `apps\u002Fweb\u002Fvercel.json` registers a cron that hits\n   `\u002Fapi\u002Fcron\u002Fpublish` every 5 minutes. It's authorized with `CRON_SECRET`, so\n   make sure that variable is set.\n6. **Polar (optional):** set `POLAR_ENABLED=true` plus `POLAR_ACCESS_TOKEN`\n   (and `POLAR_SERVER=sandbox` while testing), then add a webhook at\n   `https:\u002F\u002F\u003Cyour-domain>\u002Fapi\u002Fpolar\u002Fwebhook` for the `order.paid` and\n   `subscription.*` events and copy its signing secret into\n   `POLAR_WEBHOOK_SECRET`. Create your subscription and one-time Products in\n   Polar and register their product IDs under **Admin → Monetization** (and on\n   paid videos). Gated videos require Mux signed playback\n   (`MUX_SIGNING_KEY_ID` \u002F `MUX_SIGNING_PRIVATE_KEY`).\n\nAfter the first deploy, run `bun run seed` against your production project (or\njust sign up — the first account becomes an admin).\n",2,"2026-06-11 04:10:49","CREATED_QUERY"]