---
title: "Deploy Lago"
description: "Open-source usage-based billing: metering, subscriptions, invoices"
category: "Analytics"
url: https://railway.com/deploy/lago-2
---

# Deploy Lago

Open-source usage-based billing: metering, subscriptions, invoices

**[Deploy Lago on Railway](https://railway.com/template/lago-2)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/lago-2/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Analytics

## Template content

### lago-api https://raw.githubusercontent.com/getlago/lago-front/v1.57.0/public/favicon-prod.svg

- **Source:** https://github.com/aalfath/lago-railway-template
- **Health check:** /health
- **Public domain:** Yes

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Postgres https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/postgres.png

- **Source:** https://github.com/aalfath/lago-railway-template

### lago-clock https://raw.githubusercontent.com/getlago/lago-front/v1.57.0/public/favicon-prod.svg

- **Source:** https://github.com/aalfath/lago-railway-template

### lago-front https://raw.githubusercontent.com/getlago/lago-front/v1.57.0/public/favicon-prod.svg

- **Source:** https://github.com/aalfath/lago-railway-template
- **Health check:** /
- **Public domain:** Yes

### lago-worker https://raw.githubusercontent.com/getlago/lago-front/v1.57.0/public/favicon-prod.svg

- **Source:** https://github.com/aalfath/lago-railway-template

### lago-pdf https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/gotenberg.png

- **Source:** https://github.com/aalfath/lago-railway-template
- **Health check:** /health

## Buckets

- **Bucket**

## Documentation

# Deploy and Host Lago on Railway

Lago is an open-source billing and metering platform. It ingests usage events, prices them with plans (subscriptions, usage-based, hybrid, prepaid credits), and issues invoices with PDFs, webhooks and payment-provider integrations (Stripe, Adyen, GoCardless). It is a self-hosted alternative to Stripe Billing or Chargebee, with a web app and REST and GraphQL APIs.

## About Hosting Lago

Lago is several processes around one database: a Rails API, a Sidekiq worker for invoices, PDFs and webhooks, a clock process for scheduled billing, a Gotenberg service for invoice PDFs, and a React web app. It needs PostgreSQL with the pg_partman extension, Redis, and file storage that the API and worker share. This template wires all of it up on Railway's private network. It creates the first organization and admin user on first boot, generates every secret and the webhook-signing key, keeps public sign-up off, and stores files in a Railway Bucket. You only enter the admin's email.

## Common Use Cases

* Usage-based billing for APIs, AI products and SaaS: meter events and invoice per unit, per tier or per package
* Subscriptions with add-ons, coupons, prepaid credits (wallets) and invoice PDFs, connected to Stripe, Adyen or GoCardless for payment collection
* Self-hosted billing when you want your billing data and customer records on your own infrastructure

## Dependencies for Lago Hosting

* PostgreSQL 15 with pg_partman (Lago's own image, built from the template repo)
* Redis, and S3-compatible storage (a Railway Bucket)

### Deployment Dependencies

* Lago v1.57.0: [release notes](https://github.com/getlago/lago/releases/tag/v1.57.0)
* [Lago self-hosting guide](https://getlago.com/docs/guide/lago-self-hosted/docker)
* Template repo: [aalfath/lago-railway-template](https://github.com/aalfath/lago-railway-template)

### Implementation Details

Services: `lago-front` (web app, public), `lago-api` (API, public), `lago-worker`, `lago-clock`, `lago-pdf` (Gotenberg), `Postgres` (with a volume), `Redis` and a `Bucket`.

First login: open the `lago-front` domain and sign in with the email you entered and the password in `lago-api` → Variables → `LAGO_ORG_USER_PASSWORD`. Your API key is under Developers → API keys, and the API base URL is the `lago-api` domain.

The admin user and organization are created once. To change the password later, change it in the app, not in the variable. To send emails, add `LAGO_FROM_EMAIL` and the `LAGO_SMTP_*` variables on `lago-api` and `lago-worker`. Each service's Dockerfile pins the upstream image by version and digest, so updates arrive as "update available" notices you apply when you choose.

## Why Deploy Lago 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 Lago 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.



## Similar templates

- [Plausible WordPress](https://railway.com/deploy/deploy-plausible-for-wordpress-sites) — Cookie-free WordPress stats from your own Plausible
- [Typesense Multilingual](https://railway.com/deploy/deploy-typesense-multilingual-search) — Locale-aware multilingual search with Typesense
- [Formbricks](https://railway.com/deploy/formbricks-surveys) — Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube

Open this page in a browser: https://railway.com/deploy/lago-2
