{"id":51619855,"url":"https://github.com/imjlk/sveltekit-orpc-typia","last_synced_at":"2026-07-12T18:01:47.431Z","repository":{"id":365818042,"uuid":"1273894266","full_name":"imjlk/sveltekit-orpc-typia","owner":"imjlk","description":"Cloudflare-first SvelteKit starter with oRPC, typia, Drizzle D1, Hyperdrive, Better Auth, and Bun.","archived":false,"fork":false,"pushed_at":"2026-06-30T15:36:23.000Z","size":553,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-30T16:29:06.960Z","etag":null,"topics":["bun","cloudflare","d1","hyperdrive","orpc","sveltekit","typia"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imjlk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-19T01:29:02.000Z","updated_at":"2026-06-30T15:39:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/imjlk/sveltekit-orpc-typia","commit_stats":null,"previous_names":["imjlk/sveltekit-orpc-typia"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/imjlk/sveltekit-orpc-typia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjlk%2Fsveltekit-orpc-typia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjlk%2Fsveltekit-orpc-typia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjlk%2Fsveltekit-orpc-typia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjlk%2Fsveltekit-orpc-typia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imjlk","download_url":"https://codeload.github.com/imjlk/sveltekit-orpc-typia/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjlk%2Fsveltekit-orpc-typia/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35398566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-12T02:00:06.386Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bun","cloudflare","d1","hyperdrive","orpc","sveltekit","typia"],"created_at":"2026-07-12T18:01:43.128Z","updated_at":"2026-07-12T18:01:47.423Z","avatar_url":"https://github.com/imjlk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare First Starter\n\nCloudflare-first GitHub template for teams that want a contract-first stack without pretending deployment choices do not matter.\n\nKorean translation: [`README_ko.md`](./README_ko.md)\n\nPublic release checklist: [`docs/public-release.md`](./docs/public-release.md)\n\nSecurity policy: [`SECURITY.md`](./SECURITY.md)\n\nTypeScript graph tooling: [`docs/ttsc-graph.md`](./docs/ttsc-graph.md)\n\n## What This Template Gives You\n\n- `SvelteKit` running on Cloudflare Pages\n- `oRPC` + `typia` as the shared contract and schema layer\n- `Drizzle` + `D1` as the default relational data path, with an optional Hyperdrive/Postgres API runtime\n- `better-auth` mounted under `/auth/*`\n- an in-process gateway for `/rpc/*` and `/api/*` by default\n- an optional `/og.png` route backed by a dedicated OG Worker\n- a minimal auth-scoped CRUD example under `/posts`\n- an internal `AUTH_HASHER` Worker with a TypeScript shell and Rust Wasm kernel\n- automatic password rehash on successful email/password sign-in when the stored hash is older than the active `AUTH_HASHER` preset\n- optional advanced examples for `EDGE_GUARD` rate limiting, `POST_EVENTS` async projection, and `OG_WORKER` image rendering\n\nThis template is intentionally opinionated. It is not trying to be infra-agnostic.\n\n## Architecture\n\n```mermaid\nflowchart LR\n    U[\"Browser\"] --\u003e W[\"Cloudflare Pages / apps/web\"]\n    W --\u003e AUTH[\"/auth/* (Better Auth)\"]\n    W --\u003e RPC[\"/rpc/* Gateway\"]\n    W --\u003e API[\"/api/* Gateway\"]\n    AUTH --\u003e DB[\"D1 / Drizzle\"]\n    RPC --\u003e APP[\"In-process App Router\"]\n    API --\u003e APP\n    APP --\u003e API_DB[\"D1 or Hyperdrive Postgres / Drizzle\"]\n    W -. optional .-\u003e HASH[\"AUTH_HASHER Worker\"]\n    HASH -. service binding .-\u003e W\n```\n\nDefault public surface:\n\n- `/auth/*`\n- `/rpc/*`\n- `/api/*`\n- `/api/docs`\n- `/api/docs/rpc`\n- `/og.png` when the optional OG worker is attached\n\nThe recommended extension path stays explicit:\n\n1. `packages/shared`\n2. `packages/api`\n3. `packages/gateway`\n4. `apps/*`\n\n## Quick Start\n\nInstall and validate the template:\n\n```bash\nbun install --frozen-lockfile\nbun run check\n```\n\nChoose one local runtime:\n\n- `bun run dev:web:solo`\n  fastest loop, local SQLite, in-process `/rpc`\n- `bun run dev`\n  Vite web app plus Bun API server\n- `bun run dev:web:cf`\n  local Pages with Wrangler bindings plus local `AUTH_HASHER` and `OG_WORKER` service sessions. The checked-in config currently routes in-process `/rpc` and `/api` to Hyperdrive/Postgres through `ORPC_DB_DRIVER=hyperdrive`, while D1 remains bound for Better Auth. This script applies D1 migrations and, when Hyperdrive is active, the local Postgres migration from the configured `localConnectionString`.\n\n## Deploy To Cloudflare\n\n1. Create a D1 database and copy the returned `database_name` and `database_id` into [apps/web/wrangler.jsonc](./apps/web/wrangler.jsonc).\n\n```bash\nbunx wrangler d1 create \u003cyour-d1-name\u003e\n```\n\n2. Set `BETTER_AUTH_URL` in [apps/web/wrangler.jsonc](./apps/web/wrangler.jsonc) to your deployed Pages origin.\n3. Store `BETTER_AUTH_SECRET` as a Pages secret instead of a checked-in config var.\n\n```bash\nbunx wrangler pages secret put BETTER_AUTH_SECRET --project-name \u003cyour-pages-project\u003e\n```\n\n4. Deploy the auth hasher Worker.\n\n```bash\nbun run --cwd apps/auth-hasher-worker deploy\n```\n\n5. In your Cloudflare Pages project, configure:\n   - optional: `GITHUB_CLIENT_ID`\n   - optional: `GITHUB_CLIENT_SECRET`\n6. Keep the `AUTH_HASHER` service binding in [apps/web/wrangler.jsonc](./apps/web/wrangler.jsonc) pointed at `cloudflare-first-starter-auth-hasher`.\n7. Deploy the Pages app with your normal Pages workflow.\n\nFor local-only secrets and D1 HTTP migration config, copy from [apps/web/.dev.vars.example](./apps/web/.dev.vars.example).\nThe checked-in `HYPERDRIVE` binding in [apps/web/wrangler.jsonc](./apps/web/wrangler.jsonc) is configured for local Postgres through `localConnectionString`; replace its `id` value with a real Hyperdrive config id before using it in Cloudflare. When `ORPC_DB_DRIVER=hyperdrive`, the in-process `/rpc` and `/api` gateway uses `@repo/db/postgres` and the Postgres migrations in `packages/db/drizzle-pg/`.\nTo initialize that local Postgres schema, run:\n\n```bash\nDATABASE_URL=postgres://root:mysecretpassword@localhost:50101/local bun run --cwd packages/db db:migrate:pg\n```\n\nAfter changing Wrangler bindings in `apps/web`, `apps/worker-edge-guard`, or `apps/worker-post-events`, regenerate the checked-in binding types with `bun run types:cf`.\nIf you also change the optional OG worker bindings, rerun `bun run types:cf` as well.\n\n## Advanced Examples\n\nThe default template does not need extra application Workers.\n\n```mermaid\nflowchart LR\n    W[\"Pages Gateway\"] --\u003e APP[\"Default App Router\"]\n    APP --\u003e DB[\"D1 or Hyperdrive Postgres\"]\n    APP -. optional service binding .-\u003e EG[\"EDGE_GUARD Worker\"]\n    EG --\u003e RL[\"Workers Rate Limiting binding\"]\n    EG -. optional adapter .-\u003e DO[\"RATE_LIMITER_STATE DO\"]\n    APP -. optional queue send .-\u003e Q[\"POST_EVENTS Queue\"]\n    Q --\u003e C[\"post-events Consumer Worker\"]\n    C --\u003e DB\n    W -. optional image render .-\u003e OG[\"OG_WORKER\"]\n```\n\nUse extra Workers only when Cloudflare capabilities are the reason:\n\n- rate limiting\n- coordinated edge state\n- async side effects\n- dedicated image rendering and cache isolation\n- Durable Object backed workflows\n\nCurrent notes:\n\n- `bun run dev:web:cf:services` is an advanced reference mode only.\n- The default `bun run dev:web:cf` stack starts Pages, `AUTH_HASHER`, and `OG_WORKER`; use it before reaching for split-service examples.\n- `apps/web/wrangler.jsonc` is the single Pages config source; service bindings and Hyperdrive live there together.\n- The service-mode script temporarily pins `ORPC_DB_DRIVER=d1` so the legacy capability example keeps sharing the same local D1 state across Pages and Workers.\n- It boots the capability example path: `EDGE_GUARD` + `POST_EVENTS` + `OG_WORKER`.\n- On `localhost`, auth hashing falls back only if Wrangler cannot proxy the local `AUTH_HASHER` session.\n- On `localhost`, `post_activity` is also projected inline so the advanced example stays visible even when local Queue emulation lags.\n- On `localhost`, `/og.png` prefers `OG_WORKER_BASE_URL` and falls back to the `OG_WORKER` service binding.\n- `apps/worker-content` and `apps/worker-meta` are transitionary reference implementations for service-binding experiments.\n- They are not the recommended default topology for this template.\n- They remain in the repo only as legacy references.\n\nAdvanced example bindings:\n\n- `EDGE_GUARD`\n  service binding for cross-cutting post creation policy\n- `POST_EVENTS`\n  Queue producer used to project `post.created` into `post_activity`\n- `OG_WORKER`\n  optional HTTP worker used to render `/og.png` as PNG\n- `RATE_LIMITER_STATE`\n  Durable Object namespace used only when `EDGE_GUARD_MODE=do`\n\nAdvanced example files:\n\n- [`apps/web/wrangler.jsonc`](./apps/web/wrangler.jsonc)\n- [`apps/worker-edge-guard`](./apps/worker-edge-guard)\n- [`apps/worker-post-events`](./apps/worker-post-events)\n- [`apps/worker-og`](./apps/worker-og)\n\n## Validation Bar\n\nFresh clone release bar:\n\n```bash\nbun install --frozen-lockfile\nbun run check\nbun run test:unit\nbun run test:e2e\nbun run --cwd apps/web test:e2e:solo\nbun run smoke:web:cf:services\ncargo check --manifest-path apps/auth-hasher-worker/Cargo.toml --target wasm32-unknown-unknown\n```\n\nTemplate hygiene rules:\n\n- do not commit Playwright `test-results/`\n- do not commit `.wrangler/state`\n- do not commit temp SQLite files\n- keep checked-in OpenAPI output in sync with `bun run gen:openapi`\n- keep checked-in Cloudflare binding types in sync with `bun run types:cf`\n- run the public release checklist in [`docs/public-release.md`](./docs/public-release.md) before making a repository public or marking it as a GitHub template\n\n## Package Docs\n\n- [`apps/web/README.md`](./apps/web/README.md)\n- [`apps/auth-hasher-worker/README.md`](./apps/auth-hasher-worker/README.md)\n- [`packages/auth-hasher-contracts/README.md`](./packages/auth-hasher-contracts/README.md)\n- [`packages/auth-hasher-client/README.md`](./packages/auth-hasher-client/README.md)\n- [`packages/auth-hasher-better-auth-adapter/README.md`](./packages/auth-hasher-better-auth-adapter/README.md)\n- [`packages/auth-hasher/README.md`](./packages/auth-hasher/README.md)\n- [`apps/worker-edge-guard/README.md`](./apps/worker-edge-guard/README.md)\n- [`apps/worker-post-events/README.md`](./apps/worker-post-events/README.md)\n- [`apps/worker-og/README.md`](./apps/worker-og/README.md)\n- [`packages/shared/README.md`](./packages/shared/README.md)\n- [`packages/db/README.md`](./packages/db/README.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimjlk%2Fsveltekit-orpc-typia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimjlk%2Fsveltekit-orpc-typia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimjlk%2Fsveltekit-orpc-typia/lists"}