@scratchwork/server-deploy-local
v0.3.0
Published
Local Bun deploy target for the Scratchwork server.
Readme
Local Scratchwork deploy
This package runs the shared
Scratchwork server app as a local
deploy target, with local file storage and an in-memory database. It lets any
deploy project under deploy/ run its server config locally.
Published to npm as @scratchwork/server-deploy-local: built ESM JavaScript
with type declarations. Requires Bun ≥ 1.2 at runtime (it serves with
@effect/platform-bun); the other deploy packages are runtime-neutral.
MIT license.
Run the generic local development server from the repo root:
bun run local:local-devOAuth credentials are required (auth cannot be disabled):
SCRATCHWORK_GOOGLE_CLIENT_ID=...
SCRATCHWORK_GOOGLE_CLIENT_SECRET=...
SCRATCHWORK_SESSION_SECRET=... # at least 32 bytesUseful environment variables:
PORT=43118
SCRATCHWORK_STORAGE_DIR=/tmp/scratchwork-local-storage
SCRATCHWORK_USERS_CAN_SET_PROJECT_NAMES=true # false: server assigns random names
SCRATCHWORK_APP_URL=http://localhost:43118
SCRATCHWORK_CONTENT_URL=http://localhost:43118Running another deploy's config locally
The package exports runLocalServer, which accepts the server section of a
Cloudflare/AWS deploy config and runs it locally (environment variables still
win over config values). Deploy projects use it to share one config module
between their cloud deploy and a local run — see deploy/cloudflare-vanilla/local.ts:
import { runLocalServer } from "@scratchwork/server-deploy-local";
import { server } from "./server-config";
runLocalServer({ server });When the config declares distinct app and content domains, the local run
serves the app on http://localhost:<port> and content on
http://pages.localhost:<port> so host-separated behavior (like the
private-content cookie handoff) works the same way locally. *.localhost
names are loopback per RFC 6761; the app stays on plain localhost so the
Google OAuth http redirect URI remains valid.
