Appflare

Deploy with the button

Deploy Appflare from your browser with the Deploy to Cloudflare button, then remove what the button leaves behind.

The Deploy to Cloudflare button installs Appflare without any service of Appflare's touching your account. Everything happens in your browser, and there is nothing to install on your computer. The button copies a prebuilt Appflare into your GitHub or GitLab account, deploys it to your Cloudflare account, and then you open the setup wizard. Appflare does not need the copy afterwards, because it updates itself, so the last step is to remove the copy. To skip the copy and the API token, install from your browser instead.

Cloudflare's Deploy button

The button deploys from github.com/appflare/deploy, which holds the latest Appflare release, prebuilt. Nothing is built during the deploy; Cloudflare's Workers Builds only copies it and deploys it.

Before you start

  • A Cloudflare account. The free Workers plan works.
  • A GitHub or GitLab account. The button always copies Appflare into one; there is no way to deploy without it. Make the copy private, as step 3 shows.
  • A workers.dev subdomain on the account. If it has none, register one in the dashboard under Workers & Pages first.
  • A free cron trigger. Appflare checks for updates on a schedule, which uses one cron trigger. A free account has five in total, and the deploy fails if all five are in use.
  • No Appflare in the account yet. A second Appflare in the same account would take over the first one's background jobs (appflare-jobs), so the account can hold only one.
  • Permission to create an API token for the account, for the setup wizard.

Deploy

  1. Open Deploy to Cloudflare, sign in, and pick the account.
  2. The Git account picker lists every GitHub or GitLab account and organization you have connected. Choose one: the copy is created there. The first time, select Connect GitHub (or GitLab) and install the Cloudflare Workers and Pages app. Giving it access to only selected repositories is enough.
  3. Check the form:
    • Tick Create private Git repository. It may start unticked, and an unticked box makes the copy public.
    • Project name becomes the Worker's name, its address, and the name of the copy. It defaults to appflare. If the Git account you chose already has a repository with that name, change the project name: the form gives no error.
    • The D1 database defaults to appflare; the KV namespace is named after the project. Keep Create new for both.
    • Leave the two variables, APPFLARE_VERSION and APPFLARE_INSTALL_SOURCE, as they are.
    • The form asks for no secrets. Leave the build command empty and the deploy command as npm run deploy.
  4. Select Create and deploy and wait for the build to finish, usually a minute or two.
  5. The deploy page shows no address when the build is done. In the Cloudflare dashboard, open Workers & Pages > appflare (your project name) and select its address, or go straight to https://appflare.<your subdomain>.workers.dev, with your project name in place of appflare if you changed it.

Set up

The setup wizard opens on the first visit. It asks for a Cloudflare API token before anything else: only someone who can create a token for this account can set Appflare up. The wizard also generates the secret that signs sessions, BETTER_AUTH_SECRET, and stores it with the token as encrypted secrets on Appflare's Worker, and adds the service binding through which Appflare runs its own jobs. It waits a few seconds for that new version, then you create the owner account and check your account.

The button deploys Appflare at its workers.dev address. When the account has an active domain, the wizard asks Where should Appflare live? after the owner account: keep the workers.dev address, or move Appflare to a name in that domain. Later skips it. See Give Appflare its own address.

Clean up the deploy copy

The button leaves two things behind: the copy of the repository in your Git account, and a Workers Builds connection from that copy to Appflare's Worker. While the connection stays, any push to the copy deploys the version it holds over the one Appflare has updated itself to. Appflare cannot remove either one: the Workers Builds API does not accept the account-owned token Appflare holds.

After setup, admins see Clean up the deploy copy under Needs attention on Home. Show the steps lists them, each with its button, and Done hides the row for every admin:

  1. Disconnect Workers Builds. Open Builds opens the Worker's Settings at its Builds section in the Cloudflare dashboard. Select Disconnect.
  2. Delete the repository copy. Find on GitHub searches your private repositories for the project name. Open the copy, then Settings, and select Delete this repository at the bottom. On GitLab, open the project, then Settings > General > Advanced > Delete project.

Optionally, also:

  • delete the API token Workers Builds may have created for its builds (dashboard, My Profile > API Tokens);
  • uninstall the Cloudflare Workers and Pages app from github.com/settings/installations (or the organization's settings) if nothing else uses it.

Dismiss the card when you are done. It does not come back.

Caveats

  • A push to the copy downgrades Appflare to the version the copy holds, and removes bindings Appflare added to itself since. If that older version is also older than Appflare's database, Appflare shows a banner saying so. Either way, open Settings > Updates > Appflare version, update to the newest version again, and then disconnect Workers Builds.
  • Until Appflare updates itself once, it runs every step of a job inside the job itself. A manager installed with create-appflare hands the heaviest steps to itself over a service binding, which the button cannot declare (the binding would name the Worker, and the form lets you rename it). The next update of Appflare adds the binding. On the free plan, an install of a large app may fail before then.
  • Names. The KV namespace is named after the project, not appflare-kv as with create-appflare. Appflare does not depend on either name.

On this page