You can install ARI on your own macOS, Windows or Linux computer, or host it in the cloud. On Cloudflare, ARI runs in a Cloudflare Container. Cloudflare builds ARI from your own copy of the code, runs it on its global network, and rebuilds it whenever that code changes. ARI starts when someone visits and goes to sleep after 30 minutes without visits.
What You Need
- A Cloudflare account on the Workers Paid plan ($5 per month). Containers are not available on the free plan. Container use beyond what the plan includes is billed separately; see Cloudflare's container pricing.
- A GitHub account. Cloudflare creates your copy of ARI there.
- A PostgreSQL database. A free Supabase or Neon database works. See Step 3.
Step 1 — Create a Cloudflare Account
Create an account at dash.cloudflare.com, or sign in if you already have one. Then upgrade to Workers Paid: in the dashboard, open Workers & Pages, go to Plans and choose Workers Paid.
Step 2 — Deploy
Once you are signed in to Cloudflare, click the deploy button below:
Cloudflare opens a Create an app screen. Fill it in as follows:
- Git account. Connect GitHub if Cloudflare asks. Then choose the GitHub account or organization where your copy of ARI should live. Cloudflare creates a new repository there and redeploys ARI every time it changes. Tick Create private Git repository to keep it private.
- Project name. This becomes the name of your Worker (the small Cloudflare program that runs ARI's container) and part of ARI's address:
https://project-name.your-subdomain.workers.dev. Cloudflare also gives the new repository this name, so pick one the Git account doesn't already use, such asmy-ari. - ARI_DEPLOYMENT_TARGET. Leave it as
cloudflare. - ARI_CONTAINER_INSTANCE. The size of ARI's container. The default,
basic, has ¼ of a CPU and 1 GiB of memory. If ARI feels slow, choose a larger size:standard-1tostandard-4add CPU and memory, at a higher cost. - Build command and Deploy command. Leave them as
pnpm run buildandnpx wrangler deploy. - Enable Preview builds. Turn this off. ARI doesn't use preview builds, and each one would rebuild ARI's whole container image whenever another branch changes.
- Protect with Cloudflare Access. Leave it off.
- Click Deploy.
The first build takes several minutes, because Cloudflare builds ARI's container image from scratch. When it finishes, open ARI's address, which the Worker's page in the dashboard shows: https://project-name.your-subdomain.workers.dev. The first visit starts ARI. An ARI is starting page refreshes itself every 15 seconds until ARI is ready, and then the setup wizard opens.
Complete setup at this
workers.devaddress, not on a custom domain. ARI uses the address to check that your Cloudflare API token belongs to the account that runs it. You can add a custom domain afterwards. See After Setup.
The wizard first asks you to create your admin account and enter your personal details. Its last step, Deploy, needs a database, a Cloudflare API token and, optionally, a GitHub token. Steps 3 to 5 explain how to get them.
Step 3 — Set Up a Database
ARI needs a PostgreSQL database. Cloudflare's own database, D1, is not supported, because it is SQLite rather than PostgreSQL. Create a free hosted database with either provider below and copy its connection string into the wizard.
-
Supabase
Create a project at supabase.com. Then open Connect (top of the dashboard) and choose the connection string carefully:
- Choose the Session pooler. Don't use the Transaction pooler (port 6543): it can't hold the lock ARI takes while it creates your admin account. Don't use the Direct connection either: it is IPv6-only unless you buy Supabase's IPv4 add-on.
- Set Type to URI and copy the string. It looks like
postgresql://postgres.your-project-ref:[YOUR-PASSWORD]@aws-0-region.pooler.supabase.com:5432/postgres. Look for port 5432 and thepostgres.<ref>username. - Replace
[YOUR-PASSWORD]with your database password. If the password contains special characters, percent-encode them.
-
Neon
Create a project at neon.tech, open Connect and turn off Connection pooling to get the direct connection string, whose host doesn't contain
-pooler. Neon's pooled string has the same limitation as Supabase's Transaction pooler.
ARI tests the connection before it saves anything, so a wrong string fails right away with a clear message instead of breaking your deployment.
Step 4 — Create a Cloudflare API Token
ARI uses this token once, to find your Worker and save your configuration on it as encrypted secrets. ARI never stores, logs or shows the token again.
- Open dash.cloudflare.com/profile/api-tokens (My Profile → API Tokens). Create the token there, on your profile. Account API tokens, under Manage Account, don't work: ARI rejects them.
- Click Create Token and give it a name, such as
ARI setup. - Under Policies, choose Start from scratch, then Start with an Account policy.
- Add these three permissions:
Permission Access What ARI uses it for Workers Scripts Edit Saves your configuration as secrets on your Worker. Account Settings Read Confirms that the token belongs to the account that runs this Worker, by matching your workers.devsubdomain.Workers Builds Configuration Read Finds the GitHub repository and branch that Cloudflare deploys from, so module installs know where to commit. - Choose the account that runs ARI rather than All accounts, so the token can't change Workers in your other Cloudflare accounts.
- Set an expiration. 7 days is plenty.
- Review the summary and click Create Token. Copy the token now, because Cloudflare shows it only once. Paste it into the API Token field in the wizard.
If the wizard also asks for an Account ID, copy it from the Workers & Pages overview in the Cloudflare dashboard, or from the dashboard's address bar.
Step 5 — Create a GitHub Token (Optional)
The GitHub Token field lets you install new modules from the Modules page. Cloudflare wipes the container's disk whenever ARI restarts, so ARI installs a module by committing it to your repository. Cloudflare then rebuilds ARI with the module included.
- Open github.com/settings/personal-access-tokens to create a fine-grained token.
- Resource owner: the account or organization that owns your ARI repository, which is the Git account you chose in Step 2.
- Expiration: your choice. ARI keeps using this token for module installs, so when it expires you'll need to replace it.
- Repository access: choose Only select repositories and pick your ARI repository.
- Permissions: under Repository permissions, set Contents to Read and write. GitHub adds Metadata: Read-only automatically.
- Click Generate token, copy it and paste it into the GitHub Token field in the wizard.
If the repository belongs to an organization that requires approval for fine-grained tokens, an organization owner must approve the token before it works. ARI finds your repository and branch automatically. If it can't, the wizard asks for them.
Step 6 — Configure & Restart
In the wizard's Deploy step, paste your database connection string and keep the auto-generated authentication secret. Then paste your Cloudflare API token and, optionally, your GitHub token, and click Configure & Restart. ARI will:
- Check that the Cloudflare token belongs to the account that runs this Worker.
- Test the database connection. If it fails, nothing is saved.
- Save your configuration as encrypted secrets on your Worker.
- Restart with the new settings. This usually takes 1–5 minutes. Keep the tab open; the ARI is starting page may appear while it restarts.
When it's done, click Sign in to ARI and sign in with the admin email and password you chose. ARI creates your account and database tables automatically the first time you sign in.
After Setup
- Delete the Cloudflare API token. ARI no longer needs it. Remove it under My Profile → API Tokens.
- Changing settings. All of ARI's configuration is under Workers & Pages → your Worker → Settings → Variables and Secrets. When you add or change a value there, ARI restarts with it within a few minutes. Never change
BETTER_AUTH_SECRET: ARI uses it to encrypt the API keys you store, and changing it makes them unreadable. - First-run credentials.
ARI_FIRST_RUN_ADMIN_EMAILandARI_FIRST_RUN_ADMIN_PASSWORDare one-time secrets that ARI ignores once your account exists. You can safely delete them under Variables and Secrets. - File storage. The container's disk is wiped whenever ARI restarts, so uploaded files need permanent storage. Create a Cloudflare R2 bucket and an R2 API token. Then add these secrets:
ARI_STORAGE_PROVIDER(set tor2),ARI_R2_ACCOUNT_ID,ARI_R2_ACCESS_KEY_ID,ARI_R2_SECRET_ACCESS_KEYandARI_R2_BUCKET. See Storage. - Installing modules. With a GitHub token, each module install commits to your repository. Cloudflare rebuilds ARI, which takes several minutes, and ARI restarts with the new module. If you skipped the GitHub token in the wizard, add these secrets:
GITHUB_TOKEN(see Step 5),GITHUB_REPO_OWNER,GITHUB_REPO_NAMEandGITHUB_BRANCH(the branch Cloudflare deploys from, usuallymain). - Sleeping. After 30 minutes without visits, ARI's container stops. The next visit starts it again, and the ARI is starting page appears for a moment.
- Custom domain. Add your domain under Settings → Domains & Routes on your Worker. Then set the
BETTER_AUTH_URLandNEXT_PUBLIC_APP_URLsecrets tohttps://your-domain. After ARI restarts, sign in at your domain; ARI accepts sign-ins only at the address in those two secrets.
Troubleshooting
| Problem | What to do |
|---|---|
The build fails with an Unauthorized error from the containers API | Containers need the Workers Paid plan. Upgrade (Step 1), then run the build again from your Worker's page. |
Cloudflare could not create the Git repository right now | A repository with that name probably already exists in the chosen Git account (GitHub ignores upper and lower case), or Cloudflare isn't allowed to create repositories there. Choose a different project name or Git account. |
| The ARI is starting page keeps coming back | Check that your account is on Workers Paid, then open your Worker's Logs in the dashboard to see why the container doesn't start. |
Finish setup at this Worker's workers.dev address | You opened the wizard on another domain. Open https://project-name.your-subdomain.workers.dev and complete setup there. |
This is an account API token | Create the token under My Profile → API Tokens instead. See Step 4. |
Cloudflare rejected the API token | The token has expired or is missing a permission. Create a new one with the three permissions in Step 4. |
ARI couldn't find the Cloudflare account that runs this Worker | Enter your Account ID in the field that appears, and check that the token was created for that account. |
Database connection failed — nothing was saved | Check the connection string and password. On Supabase, use the Session pooler string (port 5432). See Step 3. |
ARI couldn't detect the GitHub repository this Worker deploys from | Enter the repository owner, name and branch in the fields that appear. |
| Still restarting… | Your configuration was saved, so there's nothing to enter again. Check your Worker's logs in the dashboard, then reload the page. |
Managed Setup
Prefer not to deal with infrastructure? The Managed Setup plan includes full hosting on your own custom domain, daily backups, and professional setup. Contact hello@ari.software for details.