---
title: "Deploy Haben"
description: "Self-hosted German bookkeeping with ELSTER, e-invoices and GoBD"
category: "Other"
url: https://railway.com/deploy/deploy-haben-german-bookkeeping
---

# Deploy Haben

Self-hosted German bookkeeping with ELSTER, e-invoices and GoBD

**[Deploy Haben on Railway](https://railway.com/template/deploy-haben-german-bookkeeping)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-haben-german-bookkeeping/manifest.json

- **Creator:** onepush
- **Category:** Other

## Template content

### haben https://api.iconify.design/mdi/calculator-variant-outline.svg

- **Image:** ghcr.io/onepush-dev/haben:0.6.5
- **Health check:** /api/auth/ok
- **Public domain:** Yes

### haben-db https://devicons.railway.app/postgres

- **Image:** ghcr.io/onepush-dev/haben-db:0.6.5

## Documentation

# Deploy and Host self hosted Haben (German Bookkeeping) on Railway

This template deploys Haben, a self-hosted open-source bookkeeping app for German freelancers and small GmbH or UG companies (upstream: Beta).

## About Hosting Haben open-source software on Railway (self hosted Haben template)

Haben is an open-source German bookkeeping app for freelancers and small GmbH or UG companies. The app and docs are in German. Independent community packaging of the unmodified upstream images; not affiliated with or endorsed by the Haben project.

Railway handles HTTPS, volumes and private networking. Upstream restic and Caddy are not included; use Railway volume backups and pg_dump copies. Store HABEN_ENCRYPTION_KEY separately, because without it stored ELSTER certificates, PINs and bank credentials cannot be decrypted after a restore.

## Why Deploy Haben, the self-hosted German bookkeeping app on Railway (Railway Free Trial)

Lexware Office and sevDesk are paid hosted subscriptions. Haben is free open-source software; you pay for your own server, and upstream labels it Beta.

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 Haben 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.

### Railway vs Other Hosting Providers and VPS for Haben self hosting

Haben runs as two services, the app and Postgres 18; your host sets the server work.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | Both services from one template, with generated secrets and HTTPS. | A Droplet you configure yourself, with your own firewall, reverse proxy and Docker or Podman. |
| AWS | A template deploy with private networking between app and database and no VPC setup. | Wide networking and compute control, larger setup. |
| Hetzner | Usage-based billing, no server to patch and volumes attached to each service. | Low-cost servers where ERiC runs natively on x86_64. |

## Common Use Cases for hosted Haben

- **Writing invoices with ZUGFeRD and XRechnung:** Create invoices with a PDF preview.
- **Collecting receipts and matching bank transactions:** Upload receipts and review bank matches.
- **EUeR or balance sheet with E-Bilanz:** Freelancers get the EUeR; a GmbH or UG gets balance sheet and profit and loss, sent as E-Bilanz via ERiC.
- **VAT returns and annual returns sent to ELSTER:** Build the Voranmeldung and send it via ERiC or Mein ELSTER XML upload; annual returns follow the same path.
- **Migrating from Lexware Office or sevDesk:** Move invoices, receipts, bookings and contacts; keep a DATEV archive with checksums.

## Dependencies for Haben Docker hosted on Railway

Haben runs as two Railway services; Postgres 18 is reachable only inside the project.

### Deployment Dependencies for Managed Haben Service (app plus Postgres 18)

The template creates haben and haben-db together, each with a volume.

### Implementation Details for Haben (unmodified Haben 0.6.5 images plus a Railway start script)

The app image ghcr.io/onepush-dev/haben:0.6.5 wraps the unmodified upstream tristanteu/haben:0.6.5 image with a start script.

The template defines six variables. On haben-db, POSTGRES_PASSWORD is generated. Back up HABEN_ENCRYPTION_KEY separately.

| Variable | Service | Purpose |
| --- | --- | --- |
| DATABASE_URL | haben | Postgres connection string for the app, built from the haben-db private address and generated password. |
| BETTER_AUTH_URL | haben | Public HTTPS address of this app (Railway domain). Passkeys are bound to this address; update it if you add a custom domain. |
| BETTER_AUTH_SECRET | haben | Generated secret that signs login sessions. Keep it stable. |
| HABEN_ENCRYPTION_KEY | haben | Generated 32-byte base64 key that encrypts the ELSTER certificate, bank and API credentials. Back it up separately; without it stored credentials cannot be decrypted. |
| HABEN_SETUP_CODE | haben | Generated one-time code you enter on /setup to create the owner account. Unused after the first account exists. |
| POSTGRES_PASSWORD | haben-db | Generated password for the haben database user. The app reads it through DATABASE_URL. |

## How does Haben compare against other tools

### Haben vs Lexware Office (Lexware Office Alternative)

- **Hosting:** Haben runs on your own server; Lexware Office is hosted.
- **Cost model:** Haben is free under AGPL-3.0; you pay only for the server. Lexware Office and sevDesk are paid subscriptions.
- **Where Lexware Office wins:** No server to maintain.
- **Maturity:** Upstream labels Haben Beta, so back up before every update.

### Haben vs sevDesk (sevDesk Alternative)

- **Hosting:** Haben is self-hosted; you hold the database and key. sevDesk is hosted.
- **E-invoicing and ELSTER:** Haben creates ZUGFeRD and XRechnung invoices and can send VAT returns to ELSTER through ERiC with your own Hersteller-ID.
- **Where sevDesk wins:** No setup.
- **Migration:** Haben can import invoices, receipts and contacts from sevDesk via its API.

### Haben vs a spreadsheet and Mein ELSTER by hand (Spreadsheet and Mein ELSTER Alternative)

- **Structure:** Haben does double-entry bookkeeping, computes the VAT pre-return from bookings and keeps an audit log.
- **Archive:** Haben produces a yearly export with SHA-256 checksums.
- **Where a spreadsheet wins:** Free and flexible for few transactions.
- **ELSTER effort:** Mein ELSTER by hand means typing every figure; Haben can prepare the XML for upload.

### Haben with Docker Compose vs Railway (Haben Railway Deployment)

- **Setup:** Compose on a VPS gives full control; the Railway template starts app and Postgres 18 with generated secrets.
- **Backups:** The upstream restic container and Caddy are not in the Railway template, so use Railway volume backups and keep your own database dumps.
- **Where Compose wins:** It includes the restic backup container and Caddy out of the box.
- **Updates:** Both paths need a backup first, because migrations cannot be rolled back.

## How to use Haben on Railway?

1. Open the public URL of the haben service. Haben redirects you to `/setup`; ELSTER and bank setup come later.
2. Find `HABEN_SETUP_CODE` in the haben service's Variables tab and enter it on the setup page.
3. Enter your name, email and a password of at least 12 characters to create the single owner account. Others join by invitation. The setup code also appears in app logs until an account exists.
4. Go to Settings, then Firma, and fill in your company details.
5. Copy `HABEN_ENCRYPTION_KEY` from the Variables tab into a password manager. Without it, credentials cannot be decrypted after a restore.
6. Request your ELSTER certificate and Hersteller-ID early; both can take one to two weeks.

The app and its documentation are in German. To check that the service is healthy, open the health endpoint:

```
https://your-domain/api/auth/ok
```

## How to self host Haben on other VPS Services (Haben self hosting guide)

### Clone the Repository

Haben ships as a prebuilt image; download the compose files on an x86_64 Linux server (ERiC needs it):

```sh
mkdir haben && cd haben
curl -O https://raw.githubusercontent.com/firsttris/haben/v0.6.5/deploy/compose.yml
curl -o .env https://raw.githubusercontent.com/firsttris/haben/v0.6.5/deploy/compose.env.example
```

This is upstream's VPS deployment, not the Railway template.

### Install Dependencies

You need Docker Compose 2.23 or newer, a domain pointing at the server, and ports 80 and 443 open. Passkeys require HTTPS.

### Configure Environment Variables

Set `DOMAIN` in `.env`, then fill `DB_PASSWORD`, `AUTH_SECRET`, `ENCRYPTION_KEY` and `RESTIC_PASSWORD` with values generated as the file suggests:

```sh
openssl rand -hex 24      # DB_PASSWORD
openssl rand -base64 32   # each of the other three
```

Caddy reads `DOMAIN` and fetches the TLS certificate itself.

### Start the Haben Application

```sh
docker compose up -d
docker compose logs app
```

Four containers start: app, Postgres, Caddy and a daily restic backup. Until an account exists, the setup code is printed in the app log; do not share the log.

## Pricing and License of Haben (Haben pricing)

Haben is AGPL-3.0 open-source software: self-host and modify free; offering it to others requires providing source.

## Haben hosted vs self hosted comparison (Pricing, features, costs, and more)

No hosted Haben plan exists upstream; you pay only for your own hosting.

### Monthly cost of self hosting Haben on Railway

Railway bills by usage: RAM, CPU for app and Postgres 18, and volume size.

### System Requirements for Hosting Haben on a VPS

Size app, Postgres 18 and volume for your load.

## Frequently Asked Questions (FAQs)

### Where do I find the setup code?

It is the `HABEN_SETUP_CODE` value in the haben Variables tab, entered on `/setup` to create the owner account.

### What happens if I lose HABEN_ENCRYPTION_KEY?

This key encrypts stored ELSTER certificate and PIN, mail passwords, bank credentials and Lexware Office and sevDesk API keys. Without it they cannot be decrypted; backups lack it.

### Is Haben production-ready?

Upstream labels Haben Beta: migrations cannot be rolled back. Back up before each update; check reports before filing.

### How do I back up Haben on Railway?

Upstream restic is not in this template; use Railway volume backups plus your own pg_dump copies.

### Can I send my VAT return to ELSTER?

Yes: via ERiC with your own Hersteller-ID, or by uploading the XML via Mein ELSTER. The optional ELSTER_HERSTELLER_ID and ERIC_AUTO_INSTALL variables are not set by this template.

### Is the interface available in English?

No, the app and its documentation are in German.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/deploy-haben-german-bookkeeping
