Repository navigation
SV1: the app on Workers - #2
Merged
Merged
Conversation
CMSaasStarter (scosman/CMSaasStarter at 2e61406, MIT, its LICENSE kept) in apps/web, on Cloudflare Workers + Static Assets: - adapter-auto → @sveltejs/adapter-cloudflare 7 (SvelteKit 2): one Worker with the pre-rendered marketing pages, the blog, the sitemap, the search index and the hashed assets beside it; 487 KiB gzipped. - wrangler.template.jsonc renders per environment from the supabase root's wiring document (the project's URL and anon key as vars); the fixture render is committed. tooling/wire/with-vars.mjs hands those vars to `vite build`, so $env/static/public inlines the same project the Worker talks to. - Every secret is read at request time through $env/dynamic/private instead of being inlined by $env/static/private: the service-role key, Stripe's and Resend's keys. component.yaml resolves them as optional Orun secrets and the build pushes each set one to the Worker as a secret (worker-secrets.mjs), never into the build. - Stripe is optional and talks over fetch: without a key the billing page says to connect it and checkout and the portal send the visitor there. - Workers forbid code generation, so the email templates are precompiled at build (a Vite plugin) and rendered with the Handlebars runtime alone. - /api/health counts the profiles table with the service-role key: the deploy's smoke, proving the project, its key and its schema reached the Worker. - WebsiteBaseUrl comes from PUBLIC_SITE_URL (SITE_URL or the workers.dev URL); the welcome email is sent from the owner's own sender; OAuth providers start empty (each needs an OAuth app in the project first). - fuse.js and prettier stay on the versions upstream's lockfile resolved (newer ones break the search page's types and re-format upstream's files); patch-package is gone (the SvelteKit bug it patched does not reproduce on 2.70). tests/web holds the Worker's config to its fixture render and its secrets to the Worker, then runs the app's own suite (upstream's tests and the port's). Locally: install, wire:fixture, typecheck, lint, test (6 + 19) and build green; wrangler dev over the build serves every page, the feed, the sitemap and the search index, sends /account to /login, and 404s an unknown path. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019PcpNVpFBcbeiX3EHdXfmn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CMSaasStarter (scosman/CMSaasStarter at
2e61406, MIT, its LICENSE kept) now lives inapps/weband runs on Cloudflare Workers + Static Assets.What changes for Workers
adapter-auto→@sveltejs/adapter-cloudflare7, for SvelteKit 2. The build is one Worker, with the pre-rendered marketing pages, blog, sitemap, search index and hashed assets beside it. It is 487 KiB gzipped.wrangler.template.jsoncrenders per environment from thesupabaseroot's wiring document, which carries the project URL and anon key as vars. The fixture render is committed.tooling/wire/with-vars.mjshands the rendered vars tovite build, so$env/static/publicinlines the same project the Worker talks to.$env/static/private→$env/dynamic/private. That covers the service-role key and the Stripe and Resend keys. They are optional Orun secrets that the build pushes to the Worker as secrets (worker-secrets.mjs), and none of them reaches the build.fetch: without a key, the billing page says to connect it, and checkout and the portal send the visitor there.handlebars.compiledoes. A Vite plugin precompiles the templates at build, and the Handlebars runtime renders them./api/health: counts theprofilestable with the service-role key. This is the deploy's smoke.WebsiteBaseUrlcomes fromPUBLIC_SITE_URL.patch-packageis gone: the SvelteKit bug it patched does not reproduce on 2.70.Tests
tests/webchecks that:wrangler.jsoncis the fixture render;$env/static/private;It then runs the app's own suite: upstream's tests plus the port's (Stripe unconnected, the precompiled templates,
/api/health, billing without Stripe).Locally:
wire:fixture, typecheck, lint, test (6 + 19) and build are all green.wrangler devover the build serves every page, the RSS feed, the sitemap and the search index. It sends/accountto/loginand 404s an unknown path.Generated by Claude Code