Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/docs/self-host/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Put its id and name, your Cloudflare account id, and an account API token with A
| Cloudflare | `pnpm run deploy`, which the button runs. Workers Builds that run `npx wrangler deploy` need `pnpm db:migrate:remote` after schema changes. |
| Vercel, Netlify | `pnpm db:migrate --allow-data-loss` (ViteHub's `vitehub db migrate`) after the build, before publishing. |
| Deno Deploy | `pnpm db:migrate:d1` as a pre-deploy command. |
| Docker Compose | Drizzle for SQLite, or `pnpm db:migrate:d1` for an explicit D1 build, before Drop starts. |
| Docker Compose | Drop itself before it listens for SQLite, or `pnpm db:migrate:d1` for an explicit D1 build, before Drop starts. |

Both commands need `CLOUDFLARE_ACCOUNT_ID`, `CLOUDFLARE_API_TOKEN`, and `CLOUDFLARE_D1_DATABASE_ID`. They record migrations in `d1_migrations`, as Wrangler does, and skip those already applied.

Expand Down
2 changes: 1 addition & 1 deletion content/docs/self-host/vps.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ${EDITOR:-nano} .env
docker compose up -d --build
```

Compose builds for `DROP_HOST=vps`, applies the existing Drizzle migrations, and starts Drop. It binds port 3000 to localhost and keeps the SQLite database, files, and cleanup history in the `drop-data` volume. If migrations fail, the server does not start.
Compose builds for `DROP_HOST=vps` and starts Drop, which applies pending migrations before it listens. It binds port 3000 to localhost and keeps the SQLite database, files, and cleanup history in the `drop-data` volume. If migrations fail, the server does not start.

## Serve HTTPS {#proxy}

Expand Down
7 changes: 0 additions & 7 deletions knip.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
"entry": [
"server/auth.ts",
"server/console-authorize.ts",
"server/database-migrate.ts",
"server/handlers/*.ts",
"server/code-image-png/*.ts",
"server/live-drafts/*.ts",
"server/realtime/*.ts",
"server/schedules/*.ts",
"server/databases/*.ts",
Expand Down Expand Up @@ -67,9 +64,5 @@
// Tests load these through nitro's and vite-hub's own resolution (createRequire), to test the copies they use.
"unstorage",
"@vite-hub/rate-limit",
"@vite-hub/auth",
"@vite-hub/content",
"@vite-hub/database",
"@vite-hub/schedule",
],
}
25 changes: 9 additions & 16 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const VITEHUB: Record<Host, NonNullable<NuxtConfig["vitehub"]>> = {
cache: { driver: "kv" },
rateLimit: true,
schedule: true,
// Live editing: rooms in a SQLite Durable Object, drafts in BLOB (server/live-drafts/realtime.ts).
// Live editing: rooms in a SQLite Durable Object, drafts in BLOB (server/utils/live-drafts.ts).
realtime: { authority: "cloudflare" },
},
// Vercel Blob (a private store, BLOB_READ_WRITE_TOKEN), D1 over HTTP, and cleanup as a Vercel Cron Job.
Expand Down Expand Up @@ -109,6 +109,9 @@ const VITEHUB: Record<Host, NonNullable<NuxtConfig["vitehub"]>> = {
connection: {
url: env({ source: env.source("DROP_DATABASE_URL"), default: "file:.data/database/drop.db" }),
},
// Pending migrations run before the server listens. A fresh database runs them all, and
// 0004_drop_comments_on_vitehub drops the old comment tables, which ViteHub counts as data loss.
migrateOnStart: { allowDataLoss: true },
}
: d1("vitehub-drop-vps"),
kv: { driver: "fs-lite", base: ".data/kv" },
Expand Down Expand Up @@ -148,19 +151,11 @@ export default defineNuxtConfig({
vitehub: {
...VITEHUB[host],
auth: true,
console: { auth: "app", authorize: fileURLToPath(new URL("./server/console-authorize.ts", import.meta.url)) },
},

alias: {
// PNG code images are a Browser Run screenshot. Browser Run only exists on Cloudflare, and ViteHub only
// generates its runtime module in builds that enable it, so other hosts get a stub that says so.
"#code-image-png": fileURLToPath(
new URL(`./server/code-image-png/${host === "cloudflare" ? "browser-run" : "unavailable"}.ts`, import.meta.url),
),
// Live editing needs Realtime rooms, which only Cloudflare and VPS builds have. The others get a stub that says so.
"#live-drafts": fileURLToPath(
new URL(`./server/live-drafts/${liveEditing ? "realtime" : "unavailable"}.ts`, import.meta.url),
),
console: {
auth: "app",
authorize: fileURLToPath(new URL("./server/console-authorize.ts", import.meta.url)),
signInPage: "/signin",
},
},

// `nuxt dev` has no R2 binding; keep files on disk (.vitehub/data/blob) while developing.
Expand Down Expand Up @@ -399,8 +394,6 @@ export default defineNuxtConfig({
nitro: {
// Keep Node for local development; ViteHub emulates Cloudflare bindings separately.
devServer: { runner: "node-worker" },
// Drizzle applies the existing migration journal before a local Node instance serves requests.
plugins: database === "sqlite" ? [fileURLToPath(new URL("./server/database-migrate.ts", import.meta.url))] : [],
// `nuxt dev` keeps Nitro's cache in memory instead of the dev KV store.
devStorage: { cache: { driver: "memory" } },
// One structured "wide event" per request (evlog), with who called, what they did, and why it failed.
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@
"@tiptap/vue-3": "3.31.4",
"@tiptap/y-tiptap": "3.0.9",
"@valibot/to-json-schema": "^1.8.0",
"@vite-hub/auth": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/auth@5e5dd32390df8517b0920346129ffe5404025b18",
"@vite-hub/comments": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/comments@5e5dd32390df8517b0920346129ffe5404025b18",
"@vite-hub/content": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/content@5e5dd32390df8517b0920346129ffe5404025b18",
"@vite-hub/database": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/database@5e5dd32390df8517b0920346129ffe5404025b18",
"@vite-hub/realtime": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/realtime@5e5dd32390df8517b0920346129ffe5404025b18",
"@vite-hub/schedule": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/schedule@5e5dd32390df8517b0920346129ffe5404025b18",
"@vite-hub/ui": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/ui@5e5dd32390df8517b0920346129ffe5404025b18",
"@vueuse/core": "^14.4.0",
"@vueuse/nuxt": "^14.4.0",
"beautiful-mermaid": "1.1.3",
"better-auth": "1.7.10",
"comark-comments": "0.8.2",
"comark-content": "0.4.1",
"comark-linter": "0.8.2",
"comark-ui": "0.8.2",
"confbox": "^0.3.1",
Expand Down Expand Up @@ -85,7 +91,7 @@
"stripe": "22.6.2",
"tailwindcss": "4.3.3",
"valibot": "^1.4.2",
"vite-hub": "0.1.0",
"vite-hub": "https://pkg.pr.new/vite-hub/vitehub/vite-hub@5e5dd32390df8517b0920346129ffe5404025b18",
"vue": "3.5.44",
"vue-router": "5.4.0",
"yjs": "13.6.33"
Expand Down
21 changes: 0 additions & 21 deletions patches/@vite-hub__comments@0.1.0.patch

This file was deleted.

Loading
Loading