Use when forking this template for a project that does not need a database, auth, or file storage. Removes Void-managed auth (Better Auth with Google sign-in), Cloudflare D1 through Drizzle ORM, and the R2 avatar storage, together with the login and profile pages built on them. The Worker and its deployment through Void stay.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Remove Db?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/imaimai17468-remove-db)
---
name: remove-db
description: Use when forking this template for a project that does not need a database, auth, or file storage. Removes Void-managed auth (Better Auth with Google sign-in), Cloudflare D1 through Drizzle ORM, and the R2 avatar storage, together with the login and profile pages built on them. The Worker and its deployment through Void stay.
---
# Remove DB / Auth / Storage
Strips the template down to a Void Pages app serving the home page and the not-found page, by removing:
- Void-managed auth (Better Auth, Google sign-in, the dev sign-in)
- Cloudflare D1 and Drizzle ORM (the auth tables and their migrations)
- Cloudflare R2 (avatar storage, served at `/api/avatars`)
- the `/login` and `/profile` pages and the account menu in the header
**Deleting the code is what switches each one off, and the Worker stays.** `node_modules/void/docs/guide/auth.md` (Config) lists what turns auth on. This template meets it through `src/auth.ts` and the `void/auth` and `void/client` imports under `src/shared/lib/auth/`, and its `void.config.ts` has no `auth` key. Void binds `DB` because a module imports `void/db` and `STORAGE` because one imports `void/storage`, and every such import is in a file step 1 deletes. So `void.config.ts` keeps its bindings section untouched, and `voidPlugin()` in `vite.config.ts` and `bun run deploy` stay. When these steps were last run, `bun run generate-void` then removed `.void/auth.d.ts`, `.void/db.d.ts`, `.void/env.d.ts`, `.void/better-auth-schema.ts` and `.void/better-auth-db.ts` as stale, and `bun run build` wrote a `.cloudflare/output/v1/workers/default/worker.config.json` whose `env` held `ASSETS` alone.
What else stays: the root layout and the header (without the account menu), `src/middleware/01.document-headers.ts`, the shared UI, the `src/shared/lib/` modules outside `auth/` and `storage/`, and the lint, format, type-check, fallow, Vitest and Mootant toolchain. The `arch-rules` plugin under `tools/oxlint-plugins/` stays as it is: its bans on `void/db`, `void/storage`, `void/env`, `void/auth` and `@auth-schema` refuse those imports from a page should the fork add one back, and its tests name the deleted paths only as fixture strings, so they pass without them.
## Preconditions
- `git status` is clean, and the work happens on a dedicated branch (the change set is large).
- `bun run setup` has run in this checkout.
## 1. Delete the code
```bash
rm -f src/auth.ts src/auth.test.ts src/env.ts
rm -rf src/shared/lib/auth
rm -rf src/gateway src/entities
rm -f src/middleware/02.current-user.ts
rm -rf src/pages/login src/pages/profile
rm -f src/routes/api/avatars.ts
rm -f src/pages/_components/header/auth-navigation.tsx
rm -rf src/pages/_components/header/user-menu src/shared/components/user-avatar
rm -rf src/db
rm -f src/shared/lib/auth/testing/auth-server.ts src/gateway/user/testing/users.ts src/shared/lib/auth/testing/signed-cookie.ts src/shared/testing/local-bindings.ts config/vitest/cloudflare-workers-stub.ts
rm -f src/shared/lib/service-keys.test.ts
```
Four of these reach further than their names suggest:
- `src/gateway/` goes whole, not only `user/`. The modules beside `user/` (`runtime.ts` with `makeRunHandler`, `report-error.ts`, `rejection.ts`, `error-reports.ts`) are reached only from `user/`, from `src/pages/profile/_gateway/` and from their own tests, all of which step 1 deletes, and `report-error.ts` recognises Drizzle's `DrizzleQueryError` by its fields, which its test builds from `drizzle-orm/errors`. A fork that adds a server handler later can take them back from git history.
- `src/env.ts` declares `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` and nothing else. `BETTER_AUTH_SECRET` is Void's to create on deploy (`guide/auth.md`, Behavior), so no other secret declaration is left to edit.
- `src/shared/testing/local-bindings.ts` boots Miniflare with the migrations in `src/db/migrations/`, and `config/vitest/cloudflare-workers-stub.ts` exists for the `cloudflare:workers` alias step 3 removes from `vitest.config.mts`.
- `src/shared/lib/service-keys.test.ts` asserts that the gateway declares a `UserProfiles` service, then checks every service's key. With the gateway gone no module under `src/` declares a service, so its first case fails and the other two check nothing. `ticket-work` step 6 names this file, which step 7 below reconciles.
A test helper sits in a `testing/` directory beside the modules it serves, and `bun run dead-code` reports one that nothing imports. When these steps were last run, `src/shared/testing/absent-field.ts` and `src/shared/testing/standard-schema.ts` had no importer left. Every importer of `src/shared/testing/defect.ts` now sits under `src/gateway/`, `src/pages/login/_lib/` or `src/pages/profile/_gateway/`, so step 1 leaves it with none too. Run `bun run dead-code` after step 1 and delete each helper under a `testing/` directory it reports.
## 2. Fix what read the signed-in user
- `src/pages/_components/root-layout.tsx`: delete the `useShared` import and the `const { currentUser } = useShared();` line, and render `<Header />` without props. Nothing shares data any more, because `02.current-user.ts` was the middleware that called `c.set("shared", …)` and declared its type.
- `src/pages/_components/header/header.tsx`: delete the `user` prop, the `UserWithEmail` and `AuthNavigation` imports, and the `<AuthNavigation user={user} />` element.
- `src/pages/(home)/_components/home.content.ts` describes the stack in Japanese. Remove the rows for auth, data and file storage from `SPECS`, D1 and R2 from the Workers row's detail, and the Better Auth, Cloudflare D1 and Cloudflare R2 entries from `LINKS`. `home-page.tsx` beside it ends with a sentence pointing at `docs/DATABASE_SETUP.md`, which step 6 deletes: drop that clause.
- `void.config.ts`'s `head.meta` description says the template wires Void's auth, D1 and R2. Rewrite it, and leave the rest of the file as it is.
- `src/vite-env.d.ts` declares `VITE_GOOGLE_SIGN_IN` on `ImportMetaEnv`, which only `src/pages/login/_lib/` read. Delete it with its doc comment, and delete `ImportMetaEnv` with it where no member is left.
The residual grep in step 8 misses the header's `user` prop, `void.config.ts`'s description and the Japanese rows of `SPECS`, because none of them holds one of its literals.
## 3. Fix the config that names the deleted files
- `tsconfig.json`: remove the `@auth-schema` and `void/db` entries from `paths`, because both point into `.void/` files `bun run generate-void` deletes once nothing turns auth or D1 on. Keep `@/*` and `extends`.
- `vitest.config.mts`: remove the `resolve.alias` block (`void/db` and `cloudflare:workers`) and the `node:path` import only it used. In `coverageExclude`, remove `"src/env.ts"` and the comment above it. Keep the other entries, `src/pages/**/*.server.ts`, `src/middleware/**` and `src/routes/**` among them, because they name the files Void loads by name, and a server file or an API route the fork adds later is held to them again. Keep the `coverage` block itself, which is the per-file 100% branch gate AGENTS.md's Testing section names. Reword the comment above `restoreMocks`, which names `src/pages/profile/_components/render.tsx`.
- `scripts/mutate/mutation-targets.test.ts`: delete the case naming `src/env.ts` as unmutated. `mutationTargets` reads `coverageExclude`, so the case fails once that entry goes. The other cases there name deleted paths as fixture strings and still pass.
- `.fallowrc.jsonc`: remove `src/auth.ts` from `entry` and `src/env.ts` from `dynamicallyLoaded`, and the auth config and env schema from the comments above them.
- `vite.config.ts`: remove `src/db/migrations` and its comment from the formatter's `ignorePatterns`. Keep `voidPlugin()` and its `persistTo`, which `bun run smoke` still uses to keep Void's local state in a directory of its own.
- `config/oxlint/project.ts`: delete each override whose `files` lists only deleted files, and remove the deleted path from an override that lists it beside a file that stays. When these steps were last run, the first kind named `src/gateway/report-error.ts`, `src/gateway/user/avatar/bucket.ts`, `src/gateway/runtime.ts`, `src/pages/login/_lib/dev.ts` and `src/gateway/testing/error-reports.ts`, and the second kind was `src/pages/profile/_components/render.tsx` beside `config/vitest/setup.ts` in the vitest-globals override, and `src/pages/login/_lib/dev.ts` in the `max-classes-per-file` override, where `src/shared/testing/defect.ts` also goes once that helper is deleted. Where an override's comment counts its files or gives a deleted path as its reason, reword it to match what is left. Keep every glob naming a layer (`src/gateway/**`, `src/entities/**`, `EFFECT_LAYERS`), because it governs the next module the fork puts in that layer.
- `scripts/check-toolchain-pins.entry.ts` checks that `devDependencies.drizzle-orm` equals the floor of Void's own `drizzle-orm` range, so the type check fails on it once step 5 removes the dependency. Remove that pin, `floorVersionOf`, the Void `package.json` import and `VOID`, then the Void clause in the header comment and in the final `console.log`. `bun run check:pins` prints `toolchain pins agree with vite-plus …` once it runs again.
## 4. Fix the smoke run
`bun run smoke` boots the dev server and requests the routes `scripts/smoke/smoke.expected.ts` names, then sends a burst of sign-ins to `/api/auth/sign-in/email` and expects the fourth to be rate-limited. With auth off that path answers no sign-in at all, so the burst fails every run until it goes.
- `scripts/smoke/smoke.expected.ts`: keep the `/` and `/favicon.svg` rows of `ROUTES`, and delete the `/login`, `/login?error=access_denied`, `/profile` and `/api/avatars` rows.
- `scripts/smoke/smoke.ts`: delete `SIGN_IN_BURST` and `signInBurstFailure`.
- `scripts/smoke/smoke.entry.ts`: delete their import, `signInStatus`, `signInStatuses`, the burst block in `smokeOn` up to the `return 0`, the three placeholder secrets in `devEnv`, and the burst's sentences in the file's opening comment.
- `scripts/smoke/smoke.test.ts`: delete the `signInBurstFailure` import and its cases, shrink the case listing `ROUTES`' paths to `/` and `/favicon.svg`, retitling it because it names the avatar path, and shrink the headers case, which reads only the rows carrying a marker, to the one `EXPECTED_DOCUMENT_HEADERS` that `/` carries.
Keep `releaseLocalD1Record` and `pointsAt`. They remove `.void/local-d1.json` only when it names the run's own directory, and a run that wrote no such record reads an empty string and removes nothing.
## 5. Update `package.json`
```bash
bun remove better-auth drizzle-orm
```
Remove the `db:generate`, `db:migrate` and `db:studio` scripts. Keep everything else, `dev`, `deploy`, `generate-void` and `smoke` included, and keep `void`, which is the deployment rather than the database.
Run `bun run generate-void` next, so the type check reads a `.void/` without the auth and D1 types, then `bun run dead-code`, and remove each dependency it reports as unused. When these steps were last run it reported `miniflare`, which only `src/shared/testing/local-bindings.ts` imported. Run it again after each removal, because a dependency only a deleted helper used, such as `@standard-schema/spec` after `src/shared/testing/standard-schema.ts` goes, may surface next.
## 6. Local files
```bash
rm -f docs/DATABASE_SETUP.md
```
Keep `scripts/setup/placeholders.dotenv`, and the copy of it onto the root dotenv file that `scripts/setup/setup.sh` and `.claude/hooks/session-start-env-check/session-start-env-check.sh` make. Delete the Better Auth comment and the two variable lines below its header, so the file holds the header alone and the next secret the fork declares in a new `src/env.ts` has a place for its placeholder line. The header's second sentence names an `env.ts` that is gone: reword it to say that `src/env.ts`, where the fork declares one, lists the names the Worker reads. `scripts/setup/setup.test.ts` reads the file's current body and compares the copy with it, so its cases pass whatever lines the file holds.
The root dotenv file the user already has keeps the old values. `.claude/hooks/pre-bash-guard/pre-bash-guard.entry.ts` refuses a command that names it outside the prose of a `git` or `gh` command, and `.claude/settings.json` denies reading and editing it, so leave clearing it to the user. Nothing in the code reads it once `src/env.ts` and `src/auth.ts` are gone.
## 7. Update the documents
Several documents still describe the removed stack. Read each one **end to end** and remove every reference to the database, auth and storage: D1, R2, Drizzle, Better Auth, Google OAuth, the sign-in, migrations, `BETTER_AUTH_*`, `GOOGLE_CLIENT_*`, and the paths step 1 deleted. Step 8's grep finds only references holding one of its literals, and these documents are mostly Japanese.
Surfaces to go through:
- `README.md`, `docs/DEPLOYMENT.md`, `docs/FORKING.md`
- `AGENTS.md`, `.claude/skills/ticket-work/SKILL.md` (its opening paragraph describes the migrations `bun run dev` applies and how to check Google login, and its step 6 names `src/shared/lib/service-keys.test.ts`), `.claude/hooks/guidance/`, and `.claude/skills/prod-logs/SKILL.md`
- `.cursor/permissions.json`
- the comments and messages that name the removed types or the burst: the absent-`.void/tsconfig.json` message in `session-start-env-check.sh`, the comment above `Generate Void types` in `.github/actions/setup/action.yml`, and the comment above the smoke step in `.github/workflows/ci.yaml`
**Keep these while you are in there.** They are the deployment, which this procedure keeps:
- README's hosting line, which names Cloudflare Workers and Void.
- `docs/DEPLOYMENT.md` itself and every link to it, its deploy, logs and rollback sections, and the `compatibility_date` paragraph.
- In `.cursor/permissions.json`'s `block_instructions`, the rule on `bun run deploy` and the `void` commands. Remove only `db:generate` from it.
- In `AGENTS.md`, the binding paragraph, apart from its `DB` and `STORAGE` sentence, which names bindings the fork no longer has.
- `.claude/skills/web-security-audit/`, `.claude/skills/webapp-security-review/` and `.claude/skills/launch-checklist/`. They describe how to review or launch a stack with auth, D1 and R2, which is what a fork that adds those back needs, so their mentions stay.
**Places where the right edit is not a deletion:**
- `docs/DEPLOYMENT.md`'s secrets and rotation sections lose their subject: `BETTER_AUTH_SECRET`, `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` are the only secrets they cover, so the `void secret put` examples, the rotation table, the paragraphs on how Better Auth receives its secrets, and the subsection on replacing `BETTER_AUTH_SECRET` go with them. Reduce the two sections to generic guidance: a secret is declared in `src/env.ts` and set with `void secret put`, and a rotation registers the new value, verifies it, and only then revokes the old one. Keep the paragraphs that hold for any secret, such as never writing a value on the command line. That ordering rule warns that reversing it drops **認証** during the gap. There is no auth left, so name the consequence for whatever reads the secret, which the step 8 grep cannot flag because the word is not ASCII.
- `docs/DEPLOYMENT.md`'s deploy section keeps its commands and loses the migration paragraph and the Google redirect-URI check, and its rollback section loses the D1-schema caveat, because both only matter while a database exists.
- `docs/FORKING.md`'s section on preparing Cloudflare resources is about D1 and R2 and also holds its pointer to `docs/DEPLOYMENT.md`. Move that pointer into the section on project identifiers and drop the section, renumbering the headings after it. Its section on app features to delete lists the profile feature and ends by sending the reader to `/remove-db`, which is circular for a fork that just ran it, so drop both.
## 8. Residual reference check
Scope the grep to database, auth and storage terms. Do **not** grep for `void` or `cloudflare`, because those legitimately remain in `void.config.ts`, `vite.config.ts` and `package.json`, and treating them as leftovers is what leads to deleting the deployment by mistake.
```bash
git grep -n -I "better-auth\|BETTER_AUTH\|drizzle\|GOOGLE_CLIENT\|void/db\|void/storage\|void/auth\|@auth-schema\|db:generate\|db:migrate\|db:studio\|db/migrations\|DATABASE_SETUP\|currentUser" -- . ':!tools/oxlint-plugins' ':!.claude/skills' ':!bun.lock'
```
Read every hit and decide, because a hit is not automatically a leftover, and an empty result proves nothing about a literal the pattern does not hold. The exclusions are deliberate: `tools/oxlint-plugins/` keeps its bans and fixture strings (see the opening of this skill), and the skills keep their review guidance (step 7). A dated record, such as a report under `docs/lighthouse/`, describes what was true when it was written, so a hit there is not "fixed". Grep `.claude/skills/ticket-work/SKILL.md` and `.claude/skills/prod-logs/SKILL.md` separately, because the path exclusion leaves them out. Hits inside this skill file are its own instructions.
The comments in the code and config that stay still describe the removed stack in words the first grep holds no literal for, such as `D1`, a route path, or the rate-limit rows. On the tree these steps were written against, `src/shared/lib/document-headers.ts`, `vite.config.ts`, `config/oxlint/project.ts` and `scripts/smoke/smoke.entry.ts` held such comments. Find them over code and config alone:
```bash
git grep -n -I -w -E "D1|R2" -- src scripts '*.ts' '*.mts' ':!tools/oxlint-plugins'
git grep -n -I -i -E "/login|/profile|/api/avatars|sign-in|lib/auth|rate-limit|VITE_GOOGLE" -- src scripts '*.ts' '*.mts' ':!tools/oxlint-plugins'
```
Rewrite each hit in a kept comment to say what the code below it does now, and delete a declaration nothing reads. `releaseLocalD1Record` and the comments on it in `scripts/smoke/smoke.entry.ts` stay, for the reason step 4 gives.
## 9. Verify
```bash
bun install
bun run generate-void
bun run check
bun run test
bun run dead-code
bun run dupes
bun run build
bun run smoke
bun run mutate scripts/smoke/smoke.ts
bun run dev
```
- `bun run check` errors point at an import of a deleted module or at a config entry naming one. Remove it.
- `bun run test` failing on coverage points at a module that lost the test reaching one of its branches; failing on a case points at a test or a fixture that still expects a deleted route, file or export.
- `bun run smoke` printing `/ -> 200` and `/favicon.svg -> 200` and exiting 0 is the signal that the Worker still runs under Void. If it fails to boot, something in step 1 or 3 removed part of the deployment rather than the database. `bun run build` exiting 0 is the signal that the bundle `bun run deploy` uploads still builds, and the `env` in the `worker.config.json` it writes shows which bindings that bundle still asks for.
- CI mutates the modules a pull request changes, and step 4 changes `scripts/smoke/smoke.ts`, so the `mutate` run has to report no survivor. When these steps were last run it reported none.
- `bun run dev` prints a URL. Read the home page there and check that the header holds the theme toggle and no sign-in link, because no gate reads the rendered header.
Not verified: an app deployed before this procedure still has the D1 database and R2 bucket its earlier `bun run deploy` created. Void's docs (`node_modules/void/docs/reference/cli/project.md`, `void project delete`) say Void never tears down an inferred resource on a direct Cloudflare target, because such a resource can be shared, but they do not say what `void deploy` does with one that no import infers any more. `node_modules/void/docs/reference/config.md` (`cloudflare`) says a value Void previously generated is removed by deleting it from the `resolved` object in `void.lock.json`, and does not say whether the `DB` and `STORAGE` entries stay there once their imports are gone. So before anyone deploys, the user checks the account for the database and the bucket, removes them with Cloudflare's own tools if they are no longer wanted, and, where the fork has a `void.lock.json`, decides whether to remove those entries from its `resolved` object.
## 10. Commit
Split per the Commits discipline in `AGENTS.md`, staging each path by name:
1. `feat:` remove the sign-in, profile and avatar features (the `src/` deletions of step 1 and the edits of step 2)
2. `chore:` remove the D1, R2, Drizzle and auth configuration (`tsconfig.json`, `vitest.config.mts`, `scripts/mutate/mutation-targets.test.ts`, `.fallowrc.jsonc`, `vite.config.ts`, `config/oxlint/project.ts`, `scripts/check-toolchain-pins.entry.ts`, `scripts/setup/placeholders.dotenv` and `docs/DATABASE_SETUP.md`)
3. `test:` stop the smoke run requesting the removed routes and the sign-in burst (`scripts/smoke/`)
4. `chore:` remove the DB and auth dependencies (`package.json`, `bun.lock`)
5. `docs:` remove the DB- and auth-related documentation: every surface step 7 touched, each by its explicit path. A surface missing from the commit is a surface left uncommitted.
Intermediate commits are not individually buildable (commit 1 deletes the modules that commit 2's config still names, and commit 4 removes the package commit 2's pin check stops reading), so verify on the final state.