Self-Hosting & BYOC
DevWannaSpace supports complete infrastructure self-hosting without modifying source code.
+--------------------------------------------------------------------------------+
| BYOC Setup Pipeline |
| |
| 1. User supplies: Neon DB URL + Clerk Keys + Cloudflare Auth |
| 2. `setup.mjs` verifies Clerk API (`api.clerk.com/v1/users`) |
| 3. `npx drizzle-kit push` executes schema migrations to Neon DB |
| 4. `npx wrangler secret put` injects clean secrets via stdin (no quotes) |
| 5. `npx wrangler deploy` publishes Workers API |
| 6. Auto-injects deployed worker URL into `apps/web/.env` |
+--------------------------------------------------------------------------------+Step-by-Step Infrastructure Prerequisites Guide
For users setting up their own self-hosted backend ($0/month tier):
1. Neon Database Setup (PostgreSQL)
- Sign up at neon.tech.
- Create a new project (e.g.
devwannaspace-db). - Under the Project Dashboard, copy your Connection String.
- Ensure it starts with
postgresql://orpostgres://and includes?sslmode=require.
2. Clerk Authentication Setup
- Sign up at clerk.com.
- Create a new Application (e.g.
DevWannaSpace). - In the Clerk Dashboard -> API Keys:
- Copy the Publishable Key (
pk_test_...orpk_live_...). - Copy the Secret Key (
sk_test_...orsk_live_...).
- Copy the Publishable Key (
3. Cloudflare Account Setup
- Sign up at cloudflare.com.
- Install Cloudflare Wrangler CLI globally or use the bundled script:bash
npx wrangler login - Authorize Wrangler in your web browser. Now
npm run setupcan deploy Workers and push secrets automatically.
Automated Setup Wizard (npm run setup)
The interactive setup CLI is powered by @clack/prompts (setup.mjs).
Key Features of the CLI Setup:
- Clerk Verification: Validates the secret key against Clerk REST API before deploying.
- Cross-Platform Stdin Secret Streaming: Pipes secrets into
wrangler secret putusing Node's nativeinputbuffer stream to eliminate Windows CMD/PowerShell escape code bugs. - Regex Subdomain Parser: Supports multi-level Cloudflare Worker subdomains (e.g.
https://api.username.workers.dev).
Dynamic Client Endpoint Override
Users can point any pre-compiled Desktop binary or Web app instance to a custom backend without rebuilding:
- LocalStorage Keys:
devwannaspace_custom_api_url: Overrides defaultVITE_API_URL.devwannaspace_custom_clerk_key: OverridesVITE_CLERK_PUBLISHABLE_KEY.
- UI Trigger: Accessible via Settings Modal or Login Screen ->
⚙️ Custom Server / Self-Host.