Skip to content

Go client-side, migrate to Vite, open source#37

Merged
scastiel merged 7 commits intomainfrom
free-client-side-migration
Apr 11, 2026
Merged

Go client-side, migrate to Vite, open source#37
scastiel merged 7 commits intomainfrom
free-client-side-migration

Conversation

@scastiel
Copy link
Copy Markdown
Owner

@scastiel scastiel commented Apr 11, 2026

Summary

Three things bundled together so the repo can ship as a free, open-source, fully client-side app:

1. Rip out the backend

Every server-side system is gone; everything runs in the browser.

  • Storage: snippets live in localStorage under codevideo:snippets:v1 (src/lib/snippet-storage.ts). No more Postgres/Prisma.
  • Rendering: @remotion/web-renderer generates videos in the browser via WebCodecs — no AWS Lambda, no credits.
  • Auth/billing: gone. No NextAuth, Resend, Stripe, plans, credits, watermark enforcement, invite list, or beta signup.
  • Public snippet route (/[snippetSlug]): deleted — cross-device sharing required a backend.
  • Remotion upgraded 4.0.684.0.448.
  • Background gradients drawn on <canvas> (gradient-canvas.tsx); web-renderer doesn't support radial-gradient CSS.
  • Canvas2D fontStretch setter shimmed (canvas-shim.ts) to accept the "100%" value modern browsers emit for font-stretch: normal.
  • Forced dark theme app-wide.
  • Help page converted from MDX to plain TSX.
  • Removed unused deps: @hookform/resolvers, react-hook-form, uuid, lru-cache, react-type-animation, @mdx-js/*, @next/mdx, remark-prism, @types/uuid, @types/mdx.

2. Migrate from Next.js to Vite

With no server code left, Next was only providing a dev server, bundler, and routing shim. Vite gives faster startup, a plain static dist/, and lets us drop next, next-plausible, next-themes, eslint-config-next.

  • Static index.html owns the head (OG, Twitter, favicon, fontStretch shim inline <script>).
  • Code-based TanStack Router tree in src/routes.tsx — 4 routes.
  • Pages moved from src/app/src/pages/; /my/* layout collapses into MyShell.
  • Hardcoded dark theme via <html class="dark"> — no theme provider.
  • import.meta.env.VITE_* replaces NEXT_PUBLIC_* (VITE_BASE_URL, VITE_PLAUSIBLE_DOMAIN).
  • Plausible now injected manually from src/main.tsx when the env var is set.
  • Jest switched from next/jest to plain ts-jest.
  • package.json is now "type": "module"; CJS configs renamed to .cjs to silence Vite's CJS Node API deprecation warning.

3. Open source prep

  • Refreshed landing page: a "Now 100% free — No account" tag under the hero CTA and a new "100% free, runs in your browser" section above the FAQ with links to the repo and GitHub Sponsors.
  • Rewrote README.md as a standard OSS readme (features, stack, local setup, scripts, env vars, sponsor link).
  • Added .github/FUNDING.yml to enable the GitHub Sponsor button.

Test plan

  • npm install completes without pulling next/next-auth/stripe/prisma/@remotion/lambda
  • npm run dev — no Vite CJS deprecation warning; app loads on :3000
  • npm run build && npm start — production build serves all routes
  • npm test — Jest suite passes
  • npm run lint — clean
  • Landing page loads; hero tag scrolls smoothly to the open-source section
  • /my/snippets — empty state auto-seeds the tutorial snippet in localStorage
  • Open tutorial snippet, edit markdown, reload — edit persists
  • Click MP4 button — progress updates, browser downloads <slug>.mp4
  • Downloaded MP4 matches the in-player preview (gradient, code, window chrome)
  • Create a second snippet, delete one — list stays consistent
  • Clear localStorage, reload — tutorial re-seeds
  • /help renders with prose styling

scastiel and others added 2 commits April 11, 2026 10:25
Rips out every backend system — auth (NextAuth/Resend), Stripe billing,
Prisma/Postgres persistence, Remotion Lambda rendering, public snippet
routes — and replaces them with:

- localStorage snippet storage (src/lib/snippet-storage.ts)
- @remotion/web-renderer client-side video generation
- No accounts, no plans, no credits, no watermark enforcement

Side effects: upgraded Remotion 4.0.68 → 4.0.448, drew background
gradients on a <canvas> (web-renderer banned radial-gradient CSS),
shimmed Canvas2D fontStretch percentage values, forced dark theme
app-wide, replaced the help page with plain TSX (dropped the MDX stack),
dropped unused deps (hookform, uuid, lru-cache, react-type-animation).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rewrites the doc to describe the post-migration state: localStorage
persistence, in-browser renderMediaOnWeb, web-renderer CSS caveats, the
forced dark theme (and the useTheme gotcha), and Plausible as the lone
third-party service. Also ignores .claude/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
No longer needed — the Remotion Lambda webhook it tunneled for is gone.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
update-site.yml re-uploaded the Remotion Lambda site on pushes — Lambda
rendering is gone, so the workflow has nothing to do.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the Next.js App Router with Vite + React SPA and TanStack Router.
The app was already fully client-side, so Next was only providing dev
server, bundler and routing — Vite gives faster startup, a plain static
build, and drops next, next-plausible, next-themes, eslint-config-next.

- Static index.html owns the head (OG, Twitter, favicon, fontStretch shim)
- Code-based TanStack Router tree in src/routes.tsx
- Pages moved from src/app/ to src/pages/; layouts collapse into MyShell
- Hardcoded dark theme via <html class="dark"> — no theme provider
- import.meta.env.VITE_* replaces NEXT_PUBLIC_*
- Jest switched from next/jest to plain ts-jest
- package type set to module; CJS configs renamed to .cjs

Also refresh the landing page with a "100% free — No account" tag and a
new open-source section linking to the repo and GitHub Sponsors.
Rewrite the README as a standard OSS readme (features, stack, local
setup, scripts, env vars, sponsor link) and add .github/FUNDING.yml so
the Sponsor button shows up on the repo.
@scastiel scastiel changed the title Migrate to fully client-side: localStorage + in-browser rendering Go client-side, migrate to Vite, open source Apr 11, 2026
Run ESLint, Prettier check, and Jest on every push to main and every PR.
Also add a format:check script and run prettier --write across src/ so
the new check passes from day one.
@scastiel scastiel merged commit 20310ec into main Apr 11, 2026
1 check passed
@scastiel scastiel deleted the free-client-side-migration branch April 11, 2026 15:16
scastiel added a commit that referenced this pull request Apr 11, 2026
* Migrate to fully client-side: localStorage + in-browser rendering

Rips out every backend system — auth (NextAuth/Resend), Stripe billing,
Prisma/Postgres persistence, Remotion Lambda rendering, public snippet
routes — and replaces them with:

- localStorage snippet storage (src/lib/snippet-storage.ts)
- @remotion/web-renderer client-side video generation
- No accounts, no plans, no credits, no watermark enforcement

Side effects: upgraded Remotion 4.0.68 → 4.0.448, drew background
gradients on a <canvas> (web-renderer banned radial-gradient CSS),
shimmed Canvas2D fontStretch percentage values, forced dark theme
app-wide, replaced the help page with plain TSX (dropped the MDX stack),
dropped unused deps (hookform, uuid, lru-cache, react-type-animation).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update CLAUDE.md for client-side architecture

Rewrites the doc to describe the post-migration state: localStorage
persistence, in-browser renderMediaOnWeb, web-renderer CSS caveats, the
forced dark theme (and the useTheme gotcha), and Plausible as the lone
third-party service. Also ignores .claude/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove ngrok.yml

No longer needed — the Remotion Lambda webhook it tunneled for is gone.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove GitHub workflow

update-site.yml re-uploaded the Remotion Lambda site on pushes — Lambda
rendering is gone, so the workflow has nothing to do.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Migrate from Next.js to Vite

Replace the Next.js App Router with Vite + React SPA and TanStack Router.
The app was already fully client-side, so Next was only providing dev
server, bundler and routing — Vite gives faster startup, a plain static
build, and drops next, next-plausible, next-themes, eslint-config-next.

- Static index.html owns the head (OG, Twitter, favicon, fontStretch shim)
- Code-based TanStack Router tree in src/routes.tsx
- Pages moved from src/app/ to src/pages/; layouts collapse into MyShell
- Hardcoded dark theme via <html class="dark"> — no theme provider
- import.meta.env.VITE_* replaces NEXT_PUBLIC_*
- Jest switched from next/jest to plain ts-jest
- package type set to module; CJS configs renamed to .cjs

Also refresh the landing page with a "100% free — No account" tag and a
new open-source section linking to the repo and GitHub Sponsors.

* Add open-source README and GitHub FUNDING config

Rewrite the README as a standard OSS readme (features, stack, local
setup, scripts, env vars, sponsor link) and add .github/FUNDING.yml so
the Sponsor button shows up on the repo.

* Add CI workflow and format source with Prettier

Run ESLint, Prettier check, and Jest on every push to main and every PR.
Also add a format:check script and run prettier --write across src/ so
the new check passes from day one.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant