Self-hosting

Run Golem Docs on your own server.

Golem Docs is free with no server at all. A server adds sync between devices, sharing and live editing. golemdocs.com runs one for $3 a month, or you can run your own on your own Cloudflare account, so the files and the accounts are yours.

How it works

The server is one Cloudflare Worker. It serves the app too, so your address becomes Golem Docs for the people you let in. It keeps everything in four Cloudflare products, all on your account:

WorkersThe app’s files, and the API that signs people in and keeps their documents.
D1One database: accounts, sessions, sharing, and each person’s list of documents and folders.
R2The documents themselves, their pictures and their earlier versions.
Durable ObjectsA room for each document while people edit it together.

It runs on Cloudflare only, for now. If you would like to host it somewhere else, on your own computer or another provider, tell me and I’ll work out a plan for running it without Cloudflare.

What it costs

For a household it can cost nothing. Cloudflare’s free plan includes 100,000 requests a day and 10 GB of file storage; past 10 GB, storage costs $0.015 per GB a month, so 100 GB is about $1.35. The free plan allows little computing time per request, so long documents may need the Workers Paid plan: $5 a month, with much higher limits. Check Cloudflare’s pricing for today’s figures.

What you need

Setting it up

It takes about half an hour. Every command runs in a terminal, from the folder you download the code to.

1. Get the code and sign in to Cloudflare

This downloads Golem Docs, installs what it needs, and opens your browser so that it can use your Cloudflare account.

git clone https://github.com/davidfig/golemdocs.git
cd golemdocs
pnpm install
pnpm --filter @golemdocs/server exec wrangler login

2. Create the database and the storage

Turn on R2 in the Cloudflare dashboard first; Cloudflare may ask for a payment method, even within the free allowance. Then this creates the database and the storage bucket, and prints the database’s id.

pnpm --filter @golemdocs/server cf:setup

3. Say which account, database and address

Copy server/wrangler.local.example.json to server/wrangler.local.json and fill it in: your Cloudflare account id, the database id from step 2, and your domain. Write workers.dev as the domain to use the free address instead.

{
  "ACCOUNT_ID": "…",
  "DIRECTORY_ID": "…",
  "DIRECTORY_DEV_ID": "",
  "DOMAIN": "docs.example.com"
}

4. Create the tables and put it online

The second command builds the app, uploads it with the server, and prints the address it is at.

pnpm --filter @golemdocs/server cf:migrate
pnpm --filter @golemdocs/server deploy:prod

5. Make a sign-in app

On GitHub, open Settings › Developer settings › OAuth Apps › New OAuth App. Give it your server’s address, and https://<your address>/api/auth/callback/github as the callback URL. Then generate a client secret.

6. Set who may sign in

Each command asks for a value. Run them from the server folder.

cd server
pnpm exec wrangler secret put SINGLE_DATABASE --env=""
pnpm exec wrangler secret put ALLOWED_EMAILS --env=""
pnpm exec wrangler secret put ADMIN_EMAILS --env=""
pnpm exec wrangler secret put GITHUB_CLIENT_ID --env=""
pnpm exec wrangler secret put GITHUB_CLIENT_SECRET --env=""
SINGLE_DATABASEtrue: everyone’s list of documents lives in the one database, so the server needs no Cloudflare API token.
ALLOWED_EMAILSWho may sign in: whole addresses (me@example.com) or a whole domain (@example.com), separated by commas. Set it, or anyone who finds your address can sign up and store files on your bill.
ADMIN_EMAILSYour own address. Admins can always sign in, and can read the feedback people send.
LINK_WEBSITE, LINK_SUPPORT…Optional: where the Help menu and the welcome document link to, instead of golemdocs.com. The full guide lists them all.

7. Sign in

Open your address and sign in with GitHub. The documents you make while signed in are now kept on your server, and the people on your list can share them with each other.

Keeping it up to date

When a new version comes out, get it and put it online the same way. Read the Journal first: a release that changes how files or accounts are stored says so there.

git pull
pnpm install
pnpm --filter @golemdocs/server cf:migrate
pnpm --filter @golemdocs/server deploy:prod

What is different from golemdocs.com

The app and server are under the AGPL-3.0: if you run a changed version for other people, offer them its source. The Golem Docs name and logo stay with this project.