Self-host on your own server
Self-host anfra on a Linux server or a home server with Docker Compose.
Set up with a coding agent
Paste this prompt into your coding agent on your server, and it helps you set this up.
Self-host this anfra project on this server. Follow https://anfra.ai/docs/self-host/own-server.md. Do the steps you can, and tell me which ones I need to do.You need a Linux server with Docker, and your project on GitHub (how). The server can be a cloud VM or a machine at home.
1. Clone your project on the server
git clone https://github.com/<you>/<project>.git
cd <project>Your database credentials
Git leaves .anfra/data_sources.yml out, so the clone doesn't have your database credentials. Copy that file into the same place on the server. Skip it if your project only uses a DuckDB file in the repo.
The container runs as uid 1000 and writes into this folder. If the folder belongs to another user, run sudo chown -R 1000 . in it.
2. Add a compose.yaml and start it
In your project's folder:
services:
anfra:
image: ghcr.io/holistics/anfra-hosting:0.24.0
restart: unless-stopped
ports:
- 8080:8080
volumes:
- .:/repodocker compose up -d3. Check that it works
Open http://<server>:8080, and open one of your Data Apps: it shows your data. Anyone who can reach the server on port 8080 can use it, so keep it on a network you trust, or add a login in step 4.
If it doesn't start, read the logs with docker compose logs. The last line starting with start.sh: says what to fix, see Troubleshooting. If your apps show errors instead of data, anfra can't reach your database: check .anfra/data_sources.yml, and your database's IP allowlist.
4. Add a login (optional)
The login only works over HTTPS, so put HTTPS in front first. Pick one:
Point a domain, such as data.example.com, at the server, and open ports 80 and 443. Install Caddy, then set its config. Caddy gets the certificate on its own:
data.example.com {
reverse_proxy 127.0.0.1:8080
}sudo systemctl reload caddyYour address is https://data.example.com.
Then set your address and the users in compose.yaml, and let only HTTPS reach anfra:
services:
anfra:
image: ghcr.io/holistics/anfra-hosting:0.24.0
restart: unless-stopped
ports:
- 127.0.0.1:8080:8080 # only through HTTPS
volumes:
- .:/repo
environment:
PUBLIC_URL: https://data.example.com
LOGIN_USERS: ${LOGIN_USERS}Put the users in a .env file next to it, in single quotes, and add .env to .gitignore. Include one for agent, for your coding agent:
LOGIN_USERS='maria:a-long-password,agent:another-long-password'To let people sign in with Google or GitHub instead, see Authentication.
Run docker compose up -d again, open your address, and sign in with a user from LOGIN_USERS.
5. Connect your coding agent
In Claude Code, with your address:
claude mcp add --transport http anfra http://<server>:8080/mcpWith a login, use your HTTPS address and the agent user's password:
claude mcp add --transport http anfra https://data.example.com/mcp \
--header "Authorization: Basic $(printf 'agent:<agent-password>' | base64 | tr -d '\n')"Ask it to list your datasets and run a small query. For other agents, see Coding agents with MCP.
Updates
Your anfra project
When you change your project, such as a new or edited Data App, model or dataset, push it to your repo. Then on the server, in the project's folder, run:
git pullanfra picks up the new files without a restart.
anfra
Your compose.yaml pins the anfra version: the number at the end of image: ghcr.io/holistics/anfra-hosting:0.24.0. Change it to the latest version, the one in the anfra-hosting Dockerfile, then download and start it:
docker compose pull
docker compose up -dRun anfra update on your machine too, so your CLI matches.
Run the plain anfra image
The steps above use anfra-hosting, which adds the login page. The plain ghcr.io/holistics/anfra image runs anfra serve alone, with no login. Use it on a private network, behind your own authentication, or to try anfra on your machine. Mount the project at /repo:
docker run -p 7878:7878 -v "$PWD:/repo" ghcr.io/holistics/anfraThis starts anfra serve on all interfaces in the container. The apps, the API and the MCP server are then at http://localhost:7878/. Other commands run the same way, for example:
docker run --rm -v "$PWD:/repo" ghcr.io/holistics/anfra validate- One image for every machine. Docker pulls the build for yours: x64 or ARM, Apple silicon included.
- Tags follow the releases: a full version such as
0.5.0, a minor version such as0.5, orlatest. - No login. Anyone who can reach the port can open the apps and query the project's data. Publish the port only to people who may do that, or use
anfra-hostingas above.
Try anfra without installing
Any anfra command runs in the image, with the project folder mounted at /repo. Create the project:
mkdir my-project && cd my-project
docker run --rm -v "$PWD:/repo" ghcr.io/holistics/anfra initThen start the server, instead of Run the server in the quick start:
docker run -p 7878:7878 -v "$PWD:/repo" ghcr.io/holistics/anfraOpen http://localhost:7878/. Your coding agent still needs the agent skills. Without the CLI, install them with npx skills add holistics/anfra-skills.