Private and custom server setup
This guide walks through deploying a private Rated server with Cloudflare Workers and D1. It assumes a new private server unless a section says otherwise.
1. Overview
A Rated server has two parts: a Cloudflare Worker that provides the API and admin panel, and a D1 database that stores accounts, entries, reviews, profiles, follows, blocks, and messages.
Private mode changes entry submissions into suggestions. Users can browse and review published entries, but new entries submitted by users wait for administrator approval.
worker.jsDatabase bindingDBAdmin page/panel2. Requirements
- A Cloudflare account with Workers and D1 available.
- Node.js and npm installed on your computer.
- The Rated server template ZIP from this page.
- A unique server name and strong secret values.
Download and extract the template. The folder contains the Worker script, base schema, migrations, and a Wrangler configuration template.
3. Create and initialize the D1 database
- Open the Cloudflare dashboard and choose Workers & Pages → D1 SQL Database.
- Create a database, for example
rated-private-db. - Open the database and note its database ID.
- Run the SQL files in this order for a new database.
wrangler login
wrangler d1 create rated-private-db
wrangler d1 execute rated-private-db --remote --file=worker/schema.sql
wrangler d1 execute rated-private-db --remote --file=worker/migrations/002_community_features.sql
wrangler d1 execute rated-private-db --remote --file=worker/migrations/003_profiles_social.sqlMigration 002_community_features.sql adds contributor attribution, publication status, and moderation fields. Migration 003_profiles_social.sql adds profile fields, follows, blocks, direct messages, and account reports.
ALTER TABLE to add columns. For an older database only, run migration 001 if reviews.ip_hash does not already exist. The supplied base schema already includes that column.For an existing server, take a D1 backup before migrating. Keep the current database and run only migrations that have not already been applied.
4. Configure and deploy the Worker
- Open
worker/wrangler.toml. - Change
database_nameto your D1 database name. - Replace
PASTE_YOUR_DATABASE_ID_HEREwith the database ID from Cloudflare. - Set a unique Worker name and your preferred server display name.
The provided configuration uses private mode:
name = "rated-private-server"
main = "worker.js"
compatibility_date = "2024-09-01"
[vars]
SERVER_MODE = "private"
SERVER_NAME = "My Private Rated Server"
[[d1_databases]]
binding = "DB"
database_name = "rated-private-db"
database_id = "PASTE_YOUR_DATABASE_ID_HERE"From the extracted project folder, deploy the Worker:
wrangler deploy --config worker/wrangler.tomlWhen deployment completes, Cloudflare displays the Worker URL, usually ending in .workers.dev. Keep the HTTPS address.
5. Add the required secrets
The Worker requires two secrets. Set them from the same project directory:
wrangler secret put JWT_SECRET
wrangler secret put ADMIN_TOKENEnter a long, unique random value for each prompt. Keep both values private. Do not place them in the website, Android project, public repository, screenshots, or chat messages.
JWT_SECRET signs login sessions. Changing it invalidates existing sessions. ADMIN_TOKEN protects the moderation panel and admin API. Anyone with the admin token can manage the server.
6. Open the admin panel
Visit your Worker URL with /panel appended, for example:
https://your-server.workers.dev/panelEnter the ADMIN_TOKEN when asked. The panel lets you:
- Add, edit, hide, restore, and remove catalogue entries.
- Review suggestions and approve or reject them.
- Review item and review reports.
- Review account reports, dismiss them, or suspend accounts.
- Restore or remove hidden reviews.
Keep the admin token private and sign out of the panel on shared devices.
7. Connect from Rated
Open the Android app or browser version. Go to server management, paste your Worker's HTTPS URL, and connect. Rated reads the server's configured display name and stores the server in the saved list after a successful connection.
Accounts, profiles, follows, messages, entries, and reviews are separate on each server. Creating an account on one server does not create it on another.
9. Updating an existing server
- Back up the D1 database.
- Confirm which migrations have already been applied.
- For profiles and social features, run
003_profiles_social.sqlonce if it has not been applied. - Deploy the updated
worker.jsusing your current Wrangler configuration. - Verify the root URL,
/api/config,/panel, and sign-in.
Do not create a new D1 database during an update unless you intend to start a separate server. Keep the existing database binding and its ID.
10. Troubleshooting
“This doesn't look like a Rated server”
Check that the URL points to the Worker root, uses HTTPS, and responds with a valid /api/config endpoint.
Database errors after deployment
Confirm the D1 binding is named exactly DB. Check that the base schema and required migrations ran against the same database bound to the Worker.
Profile or message features return 500 errors
Confirm migration 003 completed successfully and that the deployed Worker is the updated version.
Admin panel says the token is invalid
Confirm the Worker secret is named ADMIN_TOKEN and the token is entered without extra spaces.
Users cannot send messages
Both accounts must follow each other, neither account can have blocked the other, and both accounts must be active.

8. Profiles, follows, blocking, and messages
After applying migration 003 and deploying the updated Worker, users can:
Direct messages are text-only and require mutual follows. Messages have a 2,000-character limit and a daily per-sender limit. If either user blocks the other or the mutual-follow relationship ends, the conversation cannot be accessed until the relationship requirements are met again.