---
title: "Deploy ArchiveBox | (Just Updated) Self-Hosted Web Archive, Wayback Machine Alternative, Admin Login Generated"
description: "ArchiveBox self-hosted web archive, save pages offline, admin generated"
category: "Storage"
url: https://railway.com/deploy/archivebox-or-just-updated-self-hosted-w
---

# Deploy ArchiveBox | (Just Updated) Self-Hosted Web Archive, Wayback Machine Alternative, Admin Login Generated

ArchiveBox self-hosted web archive, save pages offline, admin generated

**[Deploy ArchiveBox | (Just Updated) Self-Hosted Web Archive, Wayback Machine Alternative, Admin Login Generated on Railway](https://railway.com/template/archivebox-or-just-updated-self-hosted-w)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/archivebox-or-just-updated-self-hosted-w/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** Storage

## Template content

### archivebox

- **Image:** ghcr.io/bon5co/archivebox-railway:0.9.77@sha256:931ea9e2cabd8c39270f8b94dd35a1e1c7948bde212213cf3f49d7b51951f609
- **Health check:** /health/
- **Public domain:** Yes

## Documentation

# Deploy and Host ArchiveBox on Railway

**Built for an LLM agent to deploy and use.** The deploy form has no fields to fill: the administrator account is created at first boot with a generated password, the API works from the first request, the snapshot index and public sign-up are closed, and the archive lives on a volume. ArchiveBox is a self-hosted web archive that saves pages as HTML, PDF, screenshot, WARC and media, with full-text search, a web UI and a REST API, a free alternative to the Wayback Machine, Pocket and Pinboard archiving.

## About Hosting ArchiveBox

This template runs one service, **archivebox**: the upstream ArchiveBox v0.9.77 image, pinned by digest, through a thin wrapper, with a volume at `/data` that holds the SQLite index, every archived page and the logs. One public domain serves the web UI and the REST API. The server listens on Railway's injected `PORT`, and the healthcheck is `GET /health/`.

**What the wrapper fixes.** Upstream ArchiveBox runs in security mode `auto`, which on a one-domain host such as Railway switches on subdomain routing and then answers every write, the API-token request and the whole REST API with `403 control plane disabled on this host`. It also publishes the snapshot index to anonymous visitors (`PUBLIC_INDEX=True`), generates a new `SECRET_KEY` on every start so every sign-in is dropped on a redeploy, and listens on a fixed port 5797 instead of Railway's `PORT`. The wrapper pins `SERVER_SECURITY_MODE=safe-onedomain-nojsreplay` (one domain, control plane on, archived JavaScript neutered), closes the public index and public add, reads the administrator password and the secret key from variables, derives `BASE_URL` from the Railway domain, and listens on `PORT`. It refuses to start if `ADMIN_PASSWORD` is shorter than 8 characters or `SECRET_KEY` is empty. Upstream's own entrypoint is kept, so the root-owned Railway volume is repaired and the app runs as an unprivileged user. Read from the ArchiveBox v0.9.77 source and reproduced on the wrapper: in `auto` mode the same API call from a one-domain host answers 403, and in the pinned mode the signed-in call returns 200. Not reproduced on a Railway control of the incumbent listing.

**Using it.** Open the domain and sign in as `admin` with `ADMIN_PASSWORD`. Everything the API does is under `/api/v1` (OpenAPI at `/api/v1/docs`): `POST /api/v1/auth/get_api_token` with a JSON body of `username` and `password` returns a token that lasts 30 days, sent as the `X-ArchiveBox-API-Key` header (or as a Bearer token). `POST /api/v1/cli/add` with `{"urls": [...]}` queues pages for archiving, and `GET /api/v1/core/snapshots` lists them. To publish the snapshot list to anyone set `PUBLIC_INDEX` to `True`. For a custom domain add a `BASE_URL` variable such as `https://archive.example.com`.

### Agent contract

- Public URL: `https://RAILWAY_PUBLIC_DOMAIN` (the generated domain of the `archivebox` service)
- Private URL: `http://archivebox.railway.internal:8080`
- Credentials: the variable `ADMIN_PASSWORD` on the `archivebox` service is the password of the administrator `admin`; `SECRET_KEY` signs web sessions and is never sent by a client
- Auth: `POST /api/v1/auth/get_api_token` with a JSON body of `username` and `password` returns `token`; send it as the `X-ArchiveBox-API-Key` header on every API call. Without it a write answers 401. Public sign-up is closed and the snapshot index needs a login.
- Health: `GET /health/` returns 200 without credentials

```bash
#!/bin/sh
# needs: RAILWAY_PUBLIC_DOMAIN, ADMIN_PASSWORD (variables of the archivebox service); also curl, grep, sed.
# The administrator username is admin. The API token is minted from that login and sent as the X-ArchiveBox-API-Key header.
R="https://$RAILWAY_PUBLIC_DOMAIN"
J="Content-Type: application/json"
STAMP=$(date +%s)
n=0; until [ "$(curl -s -o /dev/null -w '%{http_code}' "$R/health/")" = 200 ]; do n=$((n+1)); [ "$n" -le 60 ] || break; sleep 5; done
curl -s -o /dev/null -w "health: %{http_code}\n" "$R/health/"
# a stranger cannot write: archive a URL with no key, then with a wrong key
curl -s -o /dev/null -w "write without key: %{http_code}\n" -X POST -H "$J" -d '{"urls":["https://example.com/denied"]}' "$R/api/v1/cli/add"
curl -s -o /dev/null -w "write with wrong key: %{http_code}\n" -X POST -H "$J" -H "X-ArchiveBox-API-Key: not-a-key" -d '{"urls":["https://example.com/denied"]}' "$R/api/v1/cli/add"
# a stranger cannot register or browse: there is no sign-up route, and the snapshot index needs a login
curl -s -o /dev/null -w "public signup: %{http_code}\n" -X POST --data-urlencode "username=stranger$STAMP" --data-urlencode "email=s@example.com" "$R/accounts/signup/"
curl -s -o /dev/null -w "anonymous index: %{http_code}\n" "$R/public/"
# a wrong password is refused, the generated one returns an API token
BAD=$(curl -s -X POST -H "$J" -d "{\"username\":\"admin\",\"password\":\"wrong$STAMP$STAMP\"}" "$R/api/v1/auth/get_api_token" | grep -c '"success": false')
if [ "$BAD" = 1 ]; then echo "login with wrong password: refused"; else echo "login with wrong password: ACCEPTED"; fi
KEY=$(curl -s -X POST -H "$J" -d "{\"username\":\"admin\",\"password\":\"$ADMIN_PASSWORD\"}" "$R/api/v1/auth/get_api_token" | sed -n 's/.*"token": *"\([^"]*\)".*/\1/p')
if [ -n "$KEY" ]; then echo "login with key: ok"; else echo "login with key: FAILED"; fi
# with the key a URL is queued for archiving, then read back from the snapshot list
URL="https://example.com/?agent=$STAMP"
curl -s -o /dev/null -w "write with key: %{http_code}\n" -X POST -H "$J" -H "X-ArchiveBox-API-Key: $KEY" -d "{\"urls\":[\"$URL\"]}" "$R/api/v1/cli/add"
n=0; FOUND=0
until [ "$FOUND" -ge 1 ]; do
  FOUND=$(curl -s -H "X-ArchiveBox-API-Key: $KEY" "$R/api/v1/core/snapshots" | grep -c "agent=$STAMP")
  n=$((n+1)); [ "$n" -le 24 ] || break; [ "$FOUND" -ge 1 ] || sleep 5
done
if [ "$FOUND" -ge 1 ]; then echo "snapshot listed: found"; else echo "snapshot listed: MISSING"; fi
```

Expected output against a fresh deploy (measured on a Railway deploy of the generated draft):

```text
health: 200
write without key: 401
write with wrong key: 401
public signup: 404
anonymous index: 302
login with wrong password: refused
login with key: ok
write with key: 200
snapshot listed: found
```

The refusals are the contract: `write without key: 401` and `write with wrong key: 401` come from the API, `public signup: 404` is the absence of any sign-up route, and `anonymous index: 302` is the redirect to the login page for a visitor with no session.

## Why Deploy ArchiveBox on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying ArchiveBox on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

- **Agent-ready** - no deployer fields, a contract block, and one script that proves the instance is healthy, a stranger can neither write nor register nor browse, and the generated password returns a token that queues a page and lists it back.
- **API works on first deploy** - the security mode is pinned to one domain with the control plane on, instead of the upstream default that answers 403.
- **Sign-ins survive redeploys** - the session key is a variable, not regenerated at every start.
- **Private by default** - the snapshot index and public add are closed until you open them.
- **Data survives redeploys** - the index and every archived page live on a volume.
- **Pinned** - the upstream image is pinned by digest and the wrapper by tag and digest.

## Common Use Cases

- **Personal web archive** - save every page you bookmark before it changes or disappears.
- **Research and evidence capture** - keep dated, searchable copies of sources with screenshots, PDFs and WARC files.
- **Agent memory for the web** - give an AI agent an API that archives a URL and returns it later.
- **Team link vault** - a shared, searchable archive of the pages a team cites.

## Dependencies for ArchiveBox Hosting

- The archivebox service with its volume, created by the template. A custom domain is optional; add it as a `BASE_URL` variable if you use one.

### Deployment Dependencies

- [ArchiveBox repository](https://github.com/ArchiveBox/ArchiveBox)
- [ArchiveBox documentation](https://github.com/ArchiveBox/ArchiveBox/wiki)
- [Wrapper image source](https://github.com/bon5co/archivebox-railway)


## Similar templates

- [RustFS | (Just Updated) S3 Object Store, Public URL and Keys Set](https://railway.com/deploy/rustfs-or-just-updated-s3-object-store-p) — S3-compatible object store, keys and public URL preset, volume kept
- [TimescaleDB](https://railway.com/deploy/timescaledb-railway-template) — A PostgreSQL-based time-series database for analytics on Railway.
- [Neo4j 2026.10 Community](https://railway.com/deploy/neo4j-202610-community) — Neo4j graph database with APOC, Browser, Bolt TCP proxy and a volume

Open this page in a browser: https://railway.com/deploy/archivebox-or-just-updated-self-hosted-w
