Skip to content

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)

  1. Sign up at neon.tech.
  2. Create a new project (e.g. devwannaspace-db).
  3. Under the Project Dashboard, copy your Connection String.
  4. Ensure it starts with postgresql:// or postgres:// and includes ?sslmode=require.

2. Clerk Authentication Setup

  1. Sign up at clerk.com.
  2. Create a new Application (e.g. DevWannaSpace).
  3. In the Clerk Dashboard -> API Keys:
    • Copy the Publishable Key (pk_test_... or pk_live_...).
    • Copy the Secret Key (sk_test_... or sk_live_...).

3. Cloudflare Account Setup

  1. Sign up at cloudflare.com.
  2. Install Cloudflare Wrangler CLI globally or use the bundled script:
    bash
    npx wrangler login
  3. Authorize Wrangler in your web browser. Now npm run setup can 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 put using Node's native input buffer 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 default VITE_API_URL.
    • devwannaspace_custom_clerk_key: Overrides VITE_CLERK_PUBLISHABLE_KEY.
  • UI Trigger: Accessible via Settings Modal or Login Screen -> ⚙️ Custom Server / Self-Host.