Skip to content

Host an online network on Cloudflare

Use this guide to host an online network with the RidgeCast Worker in online-host/ and a RidgeCast build that has File → Open Shared Network…. For a new deployment, use the Worker from the same source revision or release as your desktop build. These Cloudflare commands were checked on November 27, 2026. See the desktop guide for the publisher and guest workflows.

If someone sent you an invitation, open it in RidgeCast. If the operator gave you a host address and publisher token, publish to that host. Use this guide when you are setting up or operating the host.

Already running a host? Offline working files and automatic sync use the existing save API. If your host already supports New Online Network… and admin files, start at 5. Verify the live host with test sites. The health check tells you whether the host is ready. Use the test in that section to confirm the creation and reconnection flows. If RidgeCast asks you to update the host or its database is missing 0002_owned_networks.sql, follow Upgrade an existing host for admin files.

Start with one live Worker and one Cloudflare D1 database. In the supplied configuration example, production is the name for this live host. Use it first with sample sites, then use the same host for your real network. A separate staging host can be added later.

For a first setup, work through prepare the tools, test locally, create the live database, deploy the Worker, and verify the host with test sites. Once the publisher, guest, and admin checks pass, start sharing real sites.

1. Choose the account and prepare the tools

Section titled “1. Choose the account and prepare the tools”

You need a Cloudflare account with permission to manage Workers and D1. You can use Workers Free. A Worker is the small program that receives RidgeCast requests. D1 is the database that holds the shared node rows. A binding connects the Worker to the database inside Cloudflare. RidgeCast users get invitations and do their coverage calculations on their own computers.

  • Sign in to your Cloudflare account and confirm you can see Workers & Pages and D1.
  • Install Node.js 22.12 or later and npm. Choose a release supported by Wrangler. The current Wrangler OS requirements include Windows 11, macOS 13.5+, and Linux distributions with glibc 2.35+. The examples use PowerShell 7.2 or later. Check that node --version and npm --version both print versions.
  • Choose the address your invitees will use. If you have a domain in Cloudflare, use an unused hostname such as networks.example.org for a durable link address. Otherwise, the workers.dev address is enough to get started. In Workers & Pages, find Your subdomain and record the value before .workers.dev. Select Change there if you need to choose an account subdomain. workers.dev setup · Read the account subdomain through the Cloudflare API · Custom Domain requirements

Install the host package. If you have only the desktop app, open Help → About RidgeCast and record the version and Git commit. Download and extract the source archive from the matching RidgeCast release. For a development build, use the checkout that produced the desktop app. Open PowerShell 7 in the folder that contains online-host. The online-host/ package includes the Worker, pinned Wrangler, wrangler.jsonc.example, SQL migrations, and local integration tests. Make sure npm ci finishes successfully before running Wrangler. Run commands one at a time. Paste complete multiline blocks such as if and try together. Stop on an error or a nonzero $LASTEXITCODE, especially for migrations before deployment.

Terminal window
Set-Location -LiteralPath .\online-host
if (-not (Test-Path -LiteralPath .\wrangler.jsonc)) {
Copy-Item -LiteralPath .\wrangler.jsonc.example -Destination .\wrangler.jsonc
}
npm ci
npm test

Wrangler uses your working copy, wrangler.jsonc, for both local tests and deployment. The example stays available as a clean template. Run the remaining Wrangler commands from online-host/.

You may see a node-domexception deprecation warning from a Wrangler dependency or npm warnings about install scripts for esbuild and workerd. If npm ci succeeds, run npm test before changing any script approvals. On Windows, the pinned dependencies passed the tests and Wrangler dry run with install scripts disabled.

The tests start a local Cloudflare workerd runtime and D1 database. Expect all tests to pass before setting up a remote database. The tests use a temporary database and synthetic credentials.

Terminal window
npx wrangler --version
npx wrangler whoami

If Wrangler says you are logged out, run npx wrangler login, finish authorizing it in your browser, and run npx wrangler whoami again. If whoami reports fetch failed, check that the terminal can reach Cloudflare before starting a new login. Confirm the intended account in the output, especially if you have access to several organizations. Set account_id in wrangler.jsonc to that account ID. Keep your Cloudflare credentials separate from the publisher credential used in RidgeCast. Wrangler authentication · Worker account permissions

If Wrangler reports a permission error writing its logs, set WRANGLER_LOG_PATH in the current PowerShell session to a writable log file in a private directory, then retry the command. Check the retry’s output and exit code.

Check the top-level d1_databases in wrangler.jsonc before starting the local server. Keep the shipped local DB binding. If a previous create command added an extra top-level binding for the live database with remote: true, record that database’s name and remove the extra entry. Wrangler can try to connect to remote bindings even during local testing. The live database belongs under env.production only.

To try the Worker with Wrangler, create .dev.vars next to wrangler.jsonc with the following synthetic values. Keep existing local credentials if you have already configured this file. Use these public example values only for localhost. Generate the publisher hash for a token containing 64 lower-case a characters with PowerShell:

Terminal window
$bytes = [Text.Encoding]::UTF8.GetBytes(('a' * 64))
[Convert]::ToHexString([Security.Cryptography.SHA256]::HashData($bytes)).ToLowerInvariant()

Copy the resulting hash in place of <publisher-hash>:

RIDGECAST_PUBLISHER_TOKEN_SHA256=<publisher-hash>
RIDGECAST_INVITE_HMAC_KEY=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Terminal window
npx wrangler d1 migrations list DB --local
npm run migrate:local
npm run dev

The CLI prints http://127.0.0.1:8787. Check health from a second PowerShell window. A successful response shows api_version equal to 1 and ready equal to true. If health fails, check the DB binding, local secrets, and migration output. Use the live HTTPS host for the desktop workflow. Leave remote bindings off during local tests. D1 local development · D1 migration behavior · Local Worker secrets

Terminal window
Invoke-RestMethod -Method Get -Uri 'http://127.0.0.1:8787/v1/health'

If Wrangler cannot write its local registry, open a separate PowerShell window for the dev server. In that window, set XDG_CONFIG_HOME to a private writable directory and retry npm run dev. Use your original window for Cloudflare commands so Wrangler can find your existing login.

When you finish local testing, press Ctrl+C in the window running npm run dev. It is safe to stop the server. Wrangler saves the local D1 database on disk so you can pick up where you left off with npm run dev. Cloudflare local data persistence

3. Create the live database and configure its host

Section titled “3. Create the live database and configure its host”

List databases in the confirmed Cloudflare account before creating one. If the database you intended for this host already exists, keep it and verify its UUID with d1 info. If the name belongs to another project, choose a different name and use it throughout the guide.

Terminal window
npx wrangler d1 list

Run the create command only if you still need a database.

Terminal window
npx wrangler d1 create ridgecast-online-production --update-config=false

Confirm the name and UUID before editing wrangler.jsonc.

Terminal window
npx wrangler d1 info ridgecast-online-production

If a previous create command added the live database as a top-level binding, use the UUID verified by d1 info in env.production.d1_databases[0].

Open wrangler.jsonc and configure the live host. Keep the top-level local database, the binding name DB, the required secret names, and the cleanup schedule. Edit these keys in place.

Key What to enter
account_id at the top level The Cloudflare account ID confirmed with wrangler whoami.
env.production.d1_databases[0].database_name The database name you created. The examples use ridgecast-online-production.
env.production.d1_databases[0].database_id The database UUID printed by wrangler d1 info.
env.production.vars.RIDGECAST_PUBLIC_ORIGIN Your HTTPS address without a path. The examples below show the two routing options.
env.production.ratelimits[0].namespace_id Keep 1002 if it is unused in your account. Otherwise choose an unused numeric ID.

For a workers.dev address, set env.production.workers_dev to true and leave preview_urls set to false. Edit these keys in env.production and replace example with your account subdomain. If you changed the Worker name, use its deployed name in the address.

{
"workers_dev": true,
"preview_urls": false,
"vars": {
"RIDGECAST_PUBLIC_ORIGIN": "https://ridgecast-online-production.example.workers.dev",
"RIDGECAST_MAINTENANCE": "false"
}
}

For a custom hostname, keep workers_dev and preview_urls set to false and add the route inside env.production. Set the public origin to the matching HTTPS address. The route uses an unused hostname in an active Cloudflare domain you control. Cloudflare creates its DNS record and issues the certificate. This snippet shows only the routing keys and variables to edit in env.production.

{
"workers_dev": false,
"preview_urls": false,
"routes": [{ "pattern": "networks.example.org", "custom_domain": true }],
"vars": {
"RIDGECAST_PUBLIC_ORIGIN": "https://networks.example.org",
"RIDGECAST_MAINTENANCE": "false"
}
}

Check the account and database name and UUID before applying migrations. Use --env production for live operations. The top-level configuration points to your local test setup. D1 CLI · Wrangler environments · Wrangler configuration · Custom Domains · Version URLs

In the Cloudflare dashboard, check Workers & Pages for the live Worker. You can also run npx wrangler deployments list --env production. Error 10007 means that Worker has yet to be created. If it exists, confirm its hostname and D1 binding match the host you mean to configure. Keep its current credentials and use the saved publisher token.

Terminal window
npx wrangler d1 migrations list ridgecast-online-production --remote --env production
npx wrangler d1 migrations apply ridgecast-online-production --remote --env production
npx wrangler d1 migrations list ridgecast-online-production --remote --env production
npx wrangler d1 execute ridgecast-online-production --remote --env production --command "SELECT name FROM sqlite_schema WHERE type = 'table' ORDER BY name"
npx wrangler deploy --dry-run --env production

Expect no unapplied migrations. Verify 0001_online_networks.sql and 0002_owned_networks.sql are both recorded in d1_migrations. The second migration adds support for admin files and reserves unpublished network IDs. A dry run checks the bundle. The next step checks the deployed Worker and its connection to D1.

4. Set publisher credentials and deploy the live host

Section titled “4. Set publisher credentials and deploy the live host”

If this is the first deployment, follow the credential setup below. If the Worker already has both required secrets, keep them and deploy with npx wrangler deploy --env production. Use the corresponding publisher token already stored in your password manager.

This host uses a publisher credential. It allows its holder to publish and manage all shared networks on this host. The host operator keeps it. Give guests individual view or edit links. The Worker gets the publisher token’s SHA-256 digest and a separate secret HMAC key used to verify invitations. Rotating the publisher token replaces operator access. Rotating the invitation key invalidates all existing links on that host.

Generate two independent cryptographically random 32-byte values, each encoded as 64 hex characters, in a trusted password manager or secret generator. Save them labeled as production publisher token and production invitation HMAC key. The lower-case hex publisher token is what the operator enters in RidgeCast. The HMAC key stays with the host operator and the Worker.

Before deploying, confirm the operator can reopen both saved credentials. For unattended setup, use a private encrypted store accessible to the operator’s account. Cloudflare stores the publisher token’s digest, so the operator needs the original value to sign in through RidgeCast. On Windows, PowerShell can store a PSCredential in a private directory with Export-Clixml -NoClobber. Test reopening it with Import-Clixml under the same Windows user on the same computer. Encrypted Windows credential export

If your password manager cannot generate this format, use the PowerShell command below on a trusted computer. It copies one random value without printing it. Paste it into the first password-manager entry, run the command again for the second entry, then clear the clipboard. Use a local clipboard with history and device sync turned off.

Terminal window
Set-Clipboard -Value ([Convert]::ToHexString([Security.Cryptography.RandomNumberGenerator]::GetBytes(32)).ToLowerInvariant())

The PowerShell example masks entry and supplies the secrets on the first deployment. It writes an upload file to the current account’s temporary directory and removes it in finally. Use a trusted account with a private temporary directory. Check its location with [IO.Path]::GetTempPath(). Keep the original values in your password manager.

Terminal window
$targetEnvironment = 'production'
$secretUpload = $null
try {
$publisherToken = Read-Host -MaskInput "$targetEnvironment publisher token (64 lower-case hex characters)"
$inviteKey = Read-Host -MaskInput "$targetEnvironment invitation HMAC key (64 lower-case hex characters)"
if ($publisherToken -cnotmatch '^[0-9a-f]{64}$' -or $inviteKey -cnotmatch '^[0-9a-f]{64}$' -or $publisherToken -ceq $inviteKey) {
throw 'Supply two distinct 64-character lower-case hex values.'
}
$secretUpload = New-TemporaryFile -ErrorAction Stop
$publisherDigest = [Convert]::ToHexString(
[Security.Cryptography.SHA256]::HashData([Text.Encoding]::UTF8.GetBytes($publisherToken))
).ToLowerInvariant()
@{
RIDGECAST_PUBLISHER_TOKEN_SHA256 = $publisherDigest
RIDGECAST_INVITE_HMAC_KEY = $inviteKey
} | ConvertTo-Json -Compress | Set-Content -LiteralPath $secretUpload.FullName -Encoding utf8NoBOM -ErrorAction Stop
npx wrangler deploy --env $targetEnvironment --secrets-file $secretUpload.FullName
if ($LASTEXITCODE -ne 0) { throw "$targetEnvironment Worker deployment failed." }
} finally {
if ($secretUpload) { Remove-Item -LiteralPath $secretUpload.FullName }
Remove-Variable publisherToken, inviteKey, publisherDigest, secretUpload -ErrorAction SilentlyContinue
}

The Worker should refuse access when its required secrets are missing. Cloudflare supports JSON secret files for first deployment. Subsequent wrangler secret put <NAME> --env production prompts for a value and deploys a new Worker version immediately. Coordinate secret and code changes when rolling out an authentication change, and retest the live route. When rotating RIDGECAST_PUBLISHER_TOKEN_SHA256, upload the new token’s digest using the same calculation as above. The operator enters the raw token in RidgeCast. Worker secrets and deployment

Use the exact live HTTPS address, including the port if present. If you’re testing a host someone else runs, ask the operator to confirm the address and arrange for someone with publishing permission to run the publisher steps. The health check is public. The publisher steps use a host-wide token, and the guest steps use the test invitations you create below.

If you operate the host, compare the live address with env.production.vars.RIDGECAST_PUBLIC_ORIGIN in wrangler.jsonc. If they differ, correct the setting, run npx wrangler deploy --env production, and repeat the health check.

Expect HTTP 200 and {"api_version":1,"ready":true} on the ready host. The health check establishes reachability. The workflow tests below exercise credentials and actual D1 reads and writes.

Terminal window
$hostOrigin = Read-Host 'Live HTTPS origin, with no path'
Invoke-RestMethod -Method Get -Uri "$($hostOrigin.TrimEnd('/'))/v1/health" `
-UserAgent 'RidgeCast-Hosting-Check/1.0' -NoProxy -MaximumRedirection 0

You can also run the read-only host check from online-host/. It reports readiness and publisher access separately. Enter the publisher token at the masked prompt. Add -ReadinessOnly to check readiness without a token.

Terminal window
.\scripts\Test-RidgeCastHost.ps1 -Origin $hostOrigin

To check which Cloudflare account, Worker, and D1 database the configuration points to, run .\scripts\Inspect-CloudflareTarget.ps1 before a remote migration or deployment. It prints the target and can verify the database through Wrangler. Use -ConfiguredOnly to inspect the file without contacting Cloudflare.

The local npm test suite checks the Worker and database. Use the matching RidgeCast desktop build and sample sites to check the complete workflow. Use two computers or two RidgeCast sessions to separate publisher and guest access. Sessions on the same computer should use distinct invitation links when testing two guests so each session has its own working file.

For the first pass, create a new local network. In Advanced, open Edit → Bulk Add Nodes by Coordinates… and paste this sample. Choose Table Columns and Keep Unmapped Headers as Attributes to retain Site code, then choose Add Nodes. The two sites should appear in the Network list.

Name,Latitude,Longitude,Site code
Test North,45.0120,-122.0100,0012
Test South,45.0020,-122.0100,0013
  1. On the local test network, choose File → Publish Local Network…. Enter the live HTTPS origin and publisher token, and give the network a name. In the custom field review, check the fields you want recipients to see.
  2. In Published Networks, choose Open Published Copy. Open File → Manage This Network…, create a labeled View invitation, and use Copy New Link. Anyone who has the link can forward it. Create an Edit invitation separately.
  3. On the other client, click the view invitation in a browser first. It should show instructions and Copy invitation link. On a supported installation, Open in RidgeCast opens the invitation dialog. You can also open File → Open Shared Network… in the app. Paste the invitation and confirm the exact displayed host. Choose Open Network and verify Can view, Test North, and Test South. Confirm the view invitation keeps node edits disabled. Save Working File is available for local work. Repeat with the edit invitation and check for Can edit.
  4. With the edit link, double-click a test site, rename it, and choose Finish Edit. Wait for Your edits uploaded. In the view session, use Host has changes · Refresh when it appears. You can also use File → Refresh Shared Network. If you have only two sessions, reopen the view working file in the guest session for this check. Confirm the new name appears.
  5. Reopen the edit working file, wait for Your edits uploaded, and turn on Settings → Work Offline. Change the name again and close the Edit window. Confirm the status shows Offline · Changes to sync. Reopen that working file while still offline and confirm it kept the new name. Turn off Work Offline, wait for Your edits uploaded, and refresh the view session to verify the change.
  6. As publisher, use File → Manage This Network… → Revoke → Confirm Revoke on the edit invitation. Refresh on the edit client and verify Access ended. Confirm the view invitation still works. The old edit working file can still open with its saved data.

To check publisher token reuse with a system credential store available, quit and relaunch the publisher’s RidgeCast session. Choose File → Manage Published Networks…, check the host shown, leave the token field blank, and choose Connect. Verify the test network is listed. RidgeCast stores publisher tokens for this computer account, so a different publisher’s computer needs its own first connection. Keep the original token in the operator’s password manager for setup and recovery.

Check online network creation and admin files

Section titled “Check online network creation and admin files”
  1. Choose File → New Online Network… and enter the HTTPS origin, a test network name, and the publisher token. Choose Save Admin File… and save to a private location. Anyone with the file can administer that network.
  2. Add a test site and wait for Your edits uploaded. Close the network, open the .ridgecast-online file with File → Open Network…, and verify the expected HTTPS origin before choosing Open Working File. Check that RidgeCast shows Administrator and opens the saved site.
  3. Open File → Manage This Network…, create a View invitation with the name left blank, and copy the link. Reopen the admin file and check the invitation’s role and expiration. Revoke the invitation with Revoke → Confirm Revoke and confirm it stops working from the other client.
  4. Use File → Manage This Network… → Unpublish… to remove this test network. Reopen the admin working file with Work Offline off. The saved site opens and the status changes to Access ended when RidgeCast attempts to reconnect.

Once these steps pass, go to Start sharing your network. Use the additional checks below when you want to test conflicts, inspect logs, or measure capacity before sharing.

Test Expected result
Publisher setup and publish Set up publishing in RidgeCast with the live HTTPS host and publisher token. Publish two small synthetic networks. Verify the unchanged local source files.
View and edit links Open with no account. A view invite opens and can calculate locally. A direct API write using the view grant is refused. An edit invite can add, change and delete nodes in its own network. Both guest grants are refused for publisher operations and other networks.
Revocation Revoke a test invite and retry from a second client. Further reads and writes fail. Another invitation for the same network still works. Check that alternate hostname and preview routes cannot bypass the expected controls.
Sync and conflicts Use the optional conflict check to verify what happens when two editors change the same site.
Attributes and local work Publish values such as 0012 and a multiline note and include their fields in the review. Verify the exact values on the other computer. Publish a second copy with those fields unchecked and verify they are absent. Run coverage, then reopen the same working file offline to check its local workspace settings.
Boundaries Open an invitation in a browser and verify the page only gives instructions for opening it in RidgeCast. Exercise an unknown host, HTTPS redirect, oversized request, offline mode, request cancellation, and a missing or expired token. Check real Worker logs and RidgeCast diagnostics with synthetic credentials. They should contain no link secret, authorization header, node payload, coordinate, or custom attribute used in the test.
Capacity Use the sample below to publish, open, and save 1,000 nodes together on your live Worker. Repeat with a typical small network. Record the tested Worker package, RidgeCast build, API version and deployment ID.

For this check, use two computers and a fresh pair of edit invitations for the same sample network. Start on both computers with the same names for the north and south sites. Refresh each working file before the test.

  1. On computer A, turn on Settings → Work Offline. Rename the two sites to North A and South A, closing each Edit window to save.
  2. On computer B, rename the north site to North B, close the editor, and wait for Your edits uploaded.
  3. On A, turn off Work Offline. Verify Sync conflict and both A names still in its working file. On B, refresh and verify North B and the original south name. The conflicting upload leaves both host rows as they were before A reconnected.
  4. On A, open Review Sync Conflict… and choose Load Host Version. Verify that north is listed under Sites to review and south under Unrelated changes. Optional exports should contain both draft names.
  5. Check Send these unrelated changes, leave north undecided, and choose Apply Reviewed Changes. After the upload, refresh B and verify it shows North B and South A. North should still need review on A. Choose Use host version for north and apply the remaining review.

In PowerShell, copy a synthetic 1,000-site table to the clipboard. The long custom field brings the network close to the 1 MiB storage limit.

Terminal window
$padding = 'x' * 890
$rows = @('Name,Latitude,Longitude,Test padding') + @(1..1000 | ForEach-Object {
$longitude = (-122 + $_ / 10000).ToString('0.0000', [Globalization.CultureInfo]::InvariantCulture)
'Test {0:D4},45,{1},{2}' -f $_, $longitude, $padding
})
Set-Clipboard -Value ($rows -join "`n")
  1. Start a new local network. In Advanced, open Edit → Bulk Add Nodes by Coordinates…, paste the table, and choose Table Columns. Use comma separation and confirm the first row contains headers. Select Keep Unmapped Headers as Attributes, check that the preview accepts all 1,000 rows, then choose Add Nodes. See Table columns and custom attributes.
  2. Publish the network on the live host. Include Test padding in the custom field review. Open the published network as the publisher.
  3. In the Network panel, choose Ungrouped, then Disable All. Wait for Your edits uploaded and refresh to verify the sites are disabled. This saves 1,000 row changes together.
  4. In the Cloudflare dashboard, review CPU time and errors for publish, open, and save. Check for CPU-limit errors and compare with the Workers Free 10 ms CPU limit. Review D1 rows read and written for the same time period. Record the observed results for the large and small networks. Workers limits · D1 metrics

Use this probe to verify the deployed API refuses writes with a view invitation. Run it from the PowerShell session where you checked $hostOrigin and use only the view invitation for the test network. Expect HTTP 403 with the API error forbidden. The command keeps the invitation and response body out of terminal output.

Terminal window
$invitationText = Read-Host -MaskInput 'Paste the view invitation for the test network'
try {
$testView = [Uri]$invitationText
$expectedOrigin = ([Uri]$hostOrigin).GetLeftPart([UriPartial]::Authority)
if ($testView.Scheme -ne 'https' -or
$testView.GetLeftPart([UriPartial]::Authority) -cne $expectedOrigin -or
$testView.UserInfo -or $testView.Query -or
$testView.AbsolutePath -cnotmatch '^/v1/networks/[0-9a-f-]{36}$' -or
$testView.Fragment -cnotmatch '^#[0-9a-f]{64}$') {
throw 'Use a complete invitation for the verified live host.'
}
$probe = Invoke-WebRequest -Method Post -Uri "$($testView.GetLeftPart([UriPartial]::Path))/save" `
-Headers @{ Authorization = "Bearer $($testView.Fragment.Substring(1))" } `
-UserAgent 'RidgeCast-Hosting-Check/1.0' -NoProxy `
-ContentType 'application/json' -Body '{}' -MaximumRedirection 0 -SkipHttpErrorCheck
if ($probe.StatusCode -ne 403 -or $probe.Content -cnotmatch '^\s*\{\s*"error"\s*:\s*"forbidden"\s*\}\s*$') {
throw "Expected the RidgeCast API's HTTP 403 forbidden response. Received HTTP $($probe.StatusCode)."
}
'The test view invitation cannot save.'
} finally {
Remove-Variable invitationText, testView, probe -ErrorAction SilentlyContinue
}

Run the log command in another PowerShell window, then repeat opens and saves with the test network. Press Ctrl+C to stop reading the logs.

Terminal window
npx wrangler tail --env production

Use the dashboard’s Workers Logs and D1 metrics for sustained monitoring. URLs may appear in invocation logs. Keep tokens in authorization headers, sanitize exception details, and confirm the normal paths and error paths. Tail output is also sensitive. Use synthetic data when collecting diagnostics. Real-time logs

Some default HTTP library user agents can trigger error 1010 on workers.dev before the Worker receives the request. Verify the desktop build can open the deployed host with its RidgeCast/<version> user agent. If a successful browser check differs from the desktop result, inspect the actual request and test a custom hostname before sharing with users. workers.dev behavior

Unpublish the test network from File → Manage This Network…. If you made more than one, unpublish each. This removes the test sites from the live network list and ends their invitations. Check File → Manage Published Networks… to confirm the test networks are gone. Use the same verified host for real sites.

Before publishing real sites, check that the network owner is comfortable sharing exact locations, including hidden and disabled sites. Cloudflare, people who administer the host, and recipients with access can see the uploaded fields. Coordinates are shared even when all custom fields are unchecked.

Use the verified HTTPS origin and raw production publisher token in either workflow.

  • Start from scratch with File → New Online Network…. Save the private admin file, wait for Your edits uploaded · Administrator, then add sites and wait for RidgeCast to sync them.

  • Share an existing local network with File → Publish Local Network…. Choose Open Published Copy for publisher access. To issue a private admin file at the same time, choose Create a private admin file in the publish form, then Save Admin File & Publish…. Verify the sites and wait for Your edits uploaded before creating invitations.

  • Give an authorized publisher the exact host address from step 5 and the raw publisher token saved in step 4. They can check both in File → Manage Published Networks… → Connect. A publisher token can administer every network on the host.

  • Give a person managing just one network its private admin file, if you created one for that network. Anyone who gets the file can administer it.

  • Give collaborators a view or edit invitation from Manage Invitations…. Tell them the expected HTTPS address, including the port if present, through a channel they trust.

Record the intended account, hostname, Worker name, D1 UUID, deployment ID, and operator contact in your private notes. If you change the address later, issue new invitations with the new host. Deployment management

  • Routine operation. Check request count, CPU, errors, D1 rows scanned, and database size. Index the network and node IDs and keep public health requests cheap. Workers and D1 have separate Free quotas. If the daily limit is hit, operations can fail until the UTC reset. The Worker limits requests per IP and location. A save can write many rows, and D1 usage is shared across networks on a host. Give edit access to people you trust and check D1 row metrics if writes suddenly fail. Workers limits · D1 billing · Rate limiting

  • Updates. Run the host tests and check migrations against a local D1 database before updating the live host. Prefer migrations compatible with both Worker versions while the old and new builds overlap. A failing migration rolls itself back. Earlier migrations stay applied. Record a recovery bookmark before changing the live database. A Worker rollback can restore earlier code, configuration, and secrets. D1 recovery changes the stored data. To roll back after a key rotation, deploy the earlier compatible code with the current keys or rotate again before reopening the service. D1 migrations · Worker rollbacks

  • Lost data. RidgeCast’s design stores current node rows only. D1 has database-wide Time Travel with a seven-day Free recovery window, including deleted data. Recovering the database can roll back unrelated networks. Decide whether the provider recovery window meets your retention needs. A separate SQL export is optional and contains sensitive site data, so protect and expire it according to the host’s retention policy. The export blocks other requests while running. D1 Time Travel · D1 SQL export and import

Use the host source that matches the RidgeCast build. If you extracted a new source archive, copy your working online-host/wrangler.jsonc into its online-host folder. Compare it to the updated example and carry over new fields without replacing the live account, HTTPS origin, or database UUID. Keep the existing Worker secrets. Run these steps from online-host against the verified live database and Worker. In wrangler.jsonc, check the production database name and UUID under env.production.d1_databases. Enter that database name at the prompt, even if it differs from the example. If you use a staging host, check the staging binding and use --env staging throughout the block.

Terminal window
npm ci
npm test
$liveDatabase = Read-Host 'Verified live D1 database name from wrangler.jsonc'
npx wrangler d1 time-travel info $liveDatabase --env production
npx wrangler d1 migrations list $liveDatabase --remote --env production
npx wrangler d1 migrations apply $liveDatabase --remote --env production
npx wrangler deploy --env production

Record the bookmark printed before applying migrations. After deployment, verify /v1/health reports API version 1 and ready: true. Refresh an existing invitation to confirm it still works. Create an empty test network, add a site, wait for Your edits uploaded, reopen its admin working file, and unpublish the test network. The same publisher token manages existing publications and creates new ones.

Disable access from a lost or exposed admin file

Section titled “Disable access from a lost or exposed admin file”

If someone may have obtained an admin file, have the host operator disable its access. The file contains a credential for one network. Keep the file private and give the operator the network name and host address to identify it.

From online-host, verify the Cloudflare account and the live database UUID in wrangler.jsonc. List network IDs and titles on that database. If titles are duplicated, ask the owner for the id from a private record or another copy of the admin file. An existing invitation also contains the ID between /v1/networks/ and #. Share only the ID. Stop if you cannot identify the right network.

Terminal window
npx wrangler d1 execute ridgecast-online-production --remote --env production --command 'SELECT id, title FROM networks ORDER BY title, id;'

Run the following block and enter that exact ID. Verify that the result contains the intended network ID with admin_disabled set to 1.

Terminal window
$networkId = Read-Host 'Verified network ID'
if ($networkId -cnotmatch '^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$') {
throw 'Enter the lowercase network ID from the database results.'
}
npx wrangler d1 execute ridgecast-online-production --remote --env production --command "UPDATE networks SET admin_digest = NULL WHERE id = '$networkId'; SELECT id, admin_digest IS NULL AS admin_disabled FROM networks WHERE id = '$networkId';"
if ($LASTEXITCODE -ne 0) { throw 'Admin access may still be active. Check the database before proceeding.' }

All copies of the admin file now lose access. The sites and current guest invitations remain on the host. A host publisher can still manage this network through File → Manage Published Networks…. Reopen it as the publisher, review its sites and invitations, and revoke any invitations you cannot account for. To get a new admin file, create an empty online network, re-add the sites, and issue new invitations. Keep the old network until you verify the replacement. Run SQL with Wrangler

Use Time Travel when you need to recover from data loss. It replaces the entire database in place. The procedure ends access through all previous admin files and invitations. The publisher can still manage recovered networks and issue new invitations. Verify the database and the recovery point and let collaborators know before you start. For access checks, use sample sites and credentials for a test network that existed at the selected recovery point.

  1. Set env.production.vars.RIDGECAST_MAINTENANCE to "true" and deploy with --env production. Confirm /v1/health returns ready: false. In RidgeCast, try an invitation that worked on the live host before maintenance. Confirm the host refuses to open or refresh the network.

  2. Save the output of the command below privately. It records which IDs were ever issued to admin files. unpublished: 1 identifies networks removed before the restore. Keep maintenance enabled if you cannot establish which IDs need to stay reserved or unpublished.

    Terminal window
    npx wrangler d1 execute ridgecast-online-production --remote --env production --command 'SELECT r.id, n.id IS NULL AS unpublished FROM reserved_owned_network_ids r LEFT JOIN networks n ON n.id = r.id ORDER BY r.id;'
  3. Record the current bookmark with npx wrangler d1 time-travel info ridgecast-online-production --env production. To look up the point you want, repeat the command with --timestamp and a UTC timestamp. Verify that the database and bookmark are the intended targets. Use npx wrangler d1 time-travel restore ridgecast-online-production --bookmark <verified-bookmark> --env production to restore. Record the undo bookmark Wrangler returns.

  4. Apply the migrations required by the current Worker and review the restored network list. Compare it with the IDs you saved in step 2. Run the following block once for each ID you recorded, including IDs from networks created after the restore point. Copy the exact ID and its recorded unpublished value. Enter 1 only if the owner already removed this network. The block deletes a restored row in that case and reserves the ID in every case. Keep maintenance enabled if any command fails or any result is uncertain.

    Terminal window
    $networkId = Read-Host 'Verified network ID from the saved list'
    $wasUnpublished = Read-Host 'Recorded unpublished value (0 or 1)'
    if ($networkId -cnotmatch '^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$' -or $wasUnpublished -notmatch '^[01]$') {
    throw 'Use the exact ID and unpublished value from the saved list.'
    }
    if ($wasUnpublished -eq '1') {
    npx wrangler d1 execute ridgecast-online-production --remote --env production --command "DELETE FROM networks WHERE id = '$networkId';"
    if ($LASTEXITCODE -ne 0) { throw 'Network removal failed. Leave maintenance enabled.' }
    }
    npx wrangler d1 execute ridgecast-online-production --remote --env production --command "INSERT OR IGNORE INTO reserved_owned_network_ids (id) VALUES ('$networkId');"
    if ($LASTEXITCODE -ne 0) { throw 'ID reservation failed. Leave maintenance enabled.' }

    Rerun the query from step 2. Check that every saved ID is still reserved and that each previously unpublished ID has unpublished: 1. These reservations prevent a delayed create from reusing an old ID.

  5. Disable all restored admin credentials before reopening the service. A database restore can bring back credentials that were already disabled.

    Terminal window
    npx wrangler d1 execute ridgecast-online-production --remote --env production --command 'UPDATE networks SET admin_digest = NULL WHERE admin_digest IS NOT NULL; SELECT COUNT(*) AS enabled_admin_files FROM networks WHERE admin_digest IS NOT NULL;'

    Verify enabled_admin_files is 0. The host publisher can still open and manage recovered networks. Set a fresh RIDGECAST_INVITE_HMAC_KEY with npx wrangler secret put RIDGECAST_INVITE_HMAC_KEY --env production while maintenance is still enabled. This invalidates old invitations and the saved write baselines for any drafts opened before the restore.

  6. Confirm the maintenance gate is still closed, then set RIDGECAST_MAINTENANCE back to "false" and deploy. Confirm /v1/health returns ready: true. As publisher, open the recovered test network, issue a fresh invitation and test opening and saving. Confirm the old invitation and old admin credential for that same network lose server access. A working file can still show its saved data. If you kept a pre-restore test draft open, confirm its edits stay in the working file and the host refuses the upload. Reissue invitations and have collaborators reconcile their pending edits with the recovered network.

D1 Time Travel · D1 Time Travel CLI

For an optional SQL export, choose a new file in a private directory with access restricted to the operator.

Terminal window
$privateSqlExport = Read-Host 'Full path to the private .sql export file'
npx wrangler d1 export ridgecast-online-production --remote --env production --output $privateSqlExport
Symptom What to check
Wrangler cannot see the account Run wrangler whoami, check your Cloudflare role, and confirm the account ID in the configuration.
The API reports a missing table Confirm the Worker environment, the binding name, the database UUID, and the applied migrations on that exact remote database.
Wrong environment or a 404 after deploy Match the deployed HTTPS origin to the Worker route and application config. Check DNS/TLS for a custom domain. Verify the release’s API version.
RidgeCast asks you to update the host Verify the displayed HTTPS origin, then check that the corresponding Worker is updated and 0002_owned_networks.sql is applied to its bound D1 database.
A valid invite stops working Check expiry or revocation, the target host, and recent key rotation or a database restore. Ask the publisher for a fresh invite when appropriate.
Requests fail under load Inspect Worker CPU, D1 overload, or daily quota errors. RidgeCast keeps edits in the working file and retries when the host is reachable.
An upload timed out RidgeCast keeps the original request in the working file and retries it. If the status changes to Sync conflict, follow Handle a sync conflict before replacing the draft.

The current package uses a publisher token and per-network admin files. Named accounts would require changes to both RidgeCast and the Worker.

For several independently managed publishers, Cloudflare Access can protect a separate owner hostname with an Allow policy. Keep the guest API on its configured hostname and preserve explicit checks for network ownership in the Worker. A Cloudflare Access policy controls who can enter the owner surface. RidgeCast owns the authorization to particular networks.

The documented setup is Zero Trust → Access controls → Applications. Create a self-hosted app for the owner hostname, configure the identity provider and Allow policy, and enable Managed OAuth under the app’s advanced settings if the desktop client supports it. The Cloudflare docs call out RFC 8707 resource indicators and registered callbacks. Verify the complete native sign-in flow with an external browser, authorization code with S256 PKCE, allowed callback, expired session, and sign-out before shipping. Test the Access policy and native callback behavior on an isolated test host before replacing the publisher-token workflow. Zero Trust setup · Managed OAuth · Worker Access identity · Native app OAuth

The local Worker suite uses Cloudflare’s workerd runtime and D1 migrations. It exercises publisher and guest access, save races, retry receipts, revocation, transaction rollback, and a 1,000-site publish and save. The live HTTPS route, Cloudflare CPU and D1 usage, and live log redaction are specific to your Cloudflare deployment. Use the live-host checks above before sharing real sites. Test a Time Travel restore on a separate disposable database if you want to rehearse recovery.

A staging host is a second Worker with its own database and credentials. It gives you a place to try Worker upgrades, database migrations, and recovery once people depend on the live network. You can keep using the single live host for routine operation.

To add staging later, use the shipped env.staging block and repeat database and routing setup, deployment, and live-host verification with these substitutions.

Item Staging value
Database Create a fresh ridgecast-online-staging database and enter its name and UUID in env.staging.d1_databases[0].
Environment Use --env staging on remote commands. In the secret-and-deploy block, set $targetEnvironment = 'staging'.
HTTPS address Use https://ridgecast-online-staging.example.workers.dev with your account subdomain in place of example. Set env.staging.vars.RIDGECAST_PUBLIC_ORIGIN to that address, leave workers_dev on and preview_urls off, and use the staging address for the health and invitation checks.
Rate limit Keep env.staging.ratelimits[0].namespace_id at 1001 if unused, or choose another ID distinct from the live Worker’s.
Credentials and data Generate a separate staging publisher token and invitation HMAC key. Use only sample sites and test invitations on this host.

Confirm that the two hosts use different database UUIDs. Use disposable guest invitations to verify that access stays scoped to its host, and confirm a staging edit stays in staging. Test migrations and the release on staging before deploying the same release to the live host.

To rehearse recovery, follow Recover the live database with the staging database and --env staging for every command. Time Travel replaces that database in place. Before restoring, confirm the staging database UUID and host, save the current bookmark, and confirm maintenance blocks site requests. Use the restored sample data to check that key rotation ends old invitations and that fresh invitations work.

Development snapshot (0.5.0-dev)· revision 885e28c1 · Canonical source on GitHubHome · Install · Examples · Glossary · Model limits