---
title: "Deploy Frappe Lending | (Just Updated) Open-Source Loan Management, API Key Preset"
description: "Frappe Lending open-source loan management: loans, schedules, REST API"
category: "Other"
url: https://railway.com/deploy/frappe-lending-or-just-updated-open-sour
---

# Deploy Frappe Lending | (Just Updated) Open-Source Loan Management, API Key Preset

Frappe Lending open-source loan management: loans, schedules, REST API

**[Deploy Frappe Lending | (Just Updated) Open-Source Loan Management, API Key Preset on Railway](https://railway.com/template/frappe-lending-or-just-updated-open-sour)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/frappe-lending-or-just-updated-open-sour/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** Other

## Template content

### frappe-lending

- **Image:** ghcr.io/bon5co/frappe-lending-railway:latest
- **Public domain:** Yes

### mariadb

- **Image:** ghcr.io/bon5co/erpnext-railway-mariadb:latest

## Documentation

# Deploy and Host Frappe Lending on Railway

Frappe Lending is an open-source loan management system built on ERPNext and the Frappe framework: loan products, loan applications, disbursements, repayment schedules, interest accrual, demands and dunning, loan security and pledges, restructuring and write-offs. Every document type is exposed over a REST API. It is a self-hosted alternative to commercial loan management software and loan origination systems.

This template deploys Frappe Lending (frappe 16, erpnext 16.60.0, lending 16.8.2) as **two** services, the application and MariaDB. The deploy form has nothing you have to fill in, and the `Administrator` account already has an API key and secret.

## About Hosting Frappe Lending

Frappe Lending is not one process. A working install needs the web server, a background worker for queued jobs (interest accrual, demand generation, emails), a scheduler, a socket.io service for realtime updates, redis for the cache and the job queues, and nginx in front to serve the built frontend. `frappe_docker` splits those across six containers around a shared `sites/` volume.

A Railway volume attaches to exactly one service, and frappe's web, worker and scheduler all read and write the same `sites/` directory. So on Railway, Frappe Lending is a single container by necessity: this template runs the full process set under `honcho`, exactly as `bench start` does, and if any one process exits the container is restarted rather than left half-running. Redis runs inside that container, which is why you pay for two services and not four.

What this template does differently from a stock Frappe Lending deploy:

- **The app is in the image.** Upstream publishes no image that carries the Lending app; the usual route is `pip install` against a mounted volume on every boot. This template's image installs `lending` v16.8.2 from its release tag on top of a digest-pinned `frappe/erpnext:v16.60.0` and builds the frontend assets at image build time.
- **The API key pair is preset.** `Administrator` gets `FRAPPE_API_KEY` and `FRAPPE_API_SECRET` from the service variables on every boot, so a script or an AI agent can call the REST API with a token header and never opens the login page.
- **Public sign-up is closed.** Nobody can register an account from the internet; you create users from the admin desk.
- **Custom domains work.** nginx passes the fixed site name `loans` as `X-Frappe-Site-Name`, so frappe resolves the same site whatever `Host` arrives.

**First boot creates the site before anything listens on a port**: `bench new-site --install-app erpnext --install-app lending` takes several minutes because ERPNext installs first. The template sets no healthcheck, because Railway's 300 second default would race a slow first boot. Every later boot finds the existing site and starts in seconds.

### Agent contract

- Public URL: `https://$RAILWAY_PUBLIC_DOMAIN` (the `frappe-lending` service's generated domain); the desk is at `/app`
- Private URL: `http://frappe-lending.railway.internal:8080`
- Credentials: API key in the variable `FRAPPE_API_KEY`, API secret in `FRAPPE_API_SECRET`; browser login is `Administrator` with the secret in `ADMIN_PASSWORD`
- Auth: send the header `Authorization: token FRAPPE_API_KEY:FRAPPE_API_SECRET` on every API call; a request without it answers 403, a wrong key answers 401
- Health: `GET /api/method/ping` returns 200 `{"message":"pong"}` without authentication

```bash
# needs: RAILWAY_PUBLIC_DOMAIN of the frappe-lending service, plus FRAPPE_API_KEY and FRAPPE_API_SECRET from its variables
BASE="https://$RAILWAY_PUBLIC_DOMAIN"
AUTH="Authorization: token $FRAPPE_API_KEY:$FRAPPE_API_SECRET"
curl -s -w "\nhealth: %{http_code}\n" "$BASE/api/method/ping"
curl -s -H "$AUTH" "$BASE/api/method/frappe.auth.get_logged_user"; echo
# the lending app is installed: its Loan Security Type doctype answers
curl -s -H "$AUTH" "$BASE/api/resource/Loan%20Security%20Type?limit_page_length=3"; echo
curl -s -o /dev/null -w "desk login page: %{http_code}\n" "$BASE/login"
NAME="Agent Security $(date +%s)"
curl -s -o /dev/null -w "write without key: %{http_code}\n" -X POST "$BASE/api/resource/Loan%20Security%20Type" -H 'Content-Type: application/json' -d "{\"loan_security_type\":\"$NAME\"}"
curl -s -o /dev/null -w "write with wrong key: %{http_code}\n" -X POST "$BASE/api/resource/Loan%20Security%20Type" -H "Authorization: token bad:bad" -H 'Content-Type: application/json' -d "{\"loan_security_type\":\"$NAME\"}"
curl -s -o /dev/null -w "write with key: %{http_code}\n" -X POST "$BASE/api/resource/Loan%20Security%20Type" -H "$AUTH" -H 'Content-Type: application/json' -d "{\"loan_security_type\":\"$NAME\"}"
curl -s -H "$AUTH" "$BASE/api/resource/Loan%20Security%20Type/$(printf %s "$NAME" | sed 's/ /%20/g')" | jq -r .data.loan_security_type
curl -s -o /dev/null -w "public signup: %{http_code}\n" -X POST "$BASE/api/resource/User" -H 'Content-Type: application/json' -d '{"email":"visitor@example.com","first_name":"Visitor"}'
curl -s -X POST "$BASE/api/method/frappe.core.doctype.user.user.sign_up" -H 'Content-Type: application/json' -d '{"email":"visitor2@example.com","full_name":"Visitor Two","redirect_to":"/"}' | grep -o "Sign Up is disabled" | head -1
```

A fresh deploy prints `{"message":"pong"}` and `health: 200`, then `{"message":"Administrator"}`, an empty list `{"data":[]}`, `desk login page: 200`, `write without key: 403`, `write with wrong key: 401`, `write with key: 200`, the new security type's name read back, `public signup: 403`, and `Sign Up is disabled` from the sign-up method.

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

- **A working app, not an empty bench** - no upstream image ships the Lending app; this one has it installed and its assets built.
- **Nothing to configure** - the database host, the root credential, the `Administrator` login and the API key pair are all generated and wired at deploy time. The form is empty.
- **Cheap to leave running** - two always-on containers, billed by usage rather than per loan or per seat.
- **Your data, your domain** - attach a custom domain in the Railway UI and it works; loan records and attachments live on your volume.

## Common Use Cases

- **Replacing a loan management software subscription** - run loan products, applications, disbursements and repayment schedules on your own infrastructure.
- **Microfinance and lending back office** - interest accrual, demands, dunning and loan restructuring with ERPNext accounting underneath.
- **A lending back office your own software drives** - the REST API covers every doctype, so an origination flow or an internal bot can create loan products and applications with a token header.

## Dependencies for Frappe Lending Hosting

- **MariaDB 11.8** (included in this template) on a volume at `/var/lib/mysql`, configured for utf8mb4.
- **Redis** (included, inside the application container) for the cache, the job queues and realtime.
- **A volume for `sites/`** (included) at `/home/frappe/frappe-bench/sites` - the site database config and every uploaded file live there.
- **An SMTP provider** - optional and not part of the template. Add an Email Account under Settings after deploying to send loan notifications.

### Deployment Dependencies

- [Frappe Lending](https://github.com/frappe/lending) - the upstream loan management app
- [ERPNext](https://github.com/frappe/erpnext) - the ERP the Lending app requires
- [Frappe Framework](https://github.com/frappe/frappe) - the application framework underneath both
- [frappe/erpnext Docker image](https://hub.docker.com/r/frappe/erpnext) - the upstream image this template builds on, pinned by digest at `v16.60.0`
- [bon5co/frappe-lending-railway](https://github.com/bon5co/frappe-lending-railway) - the open-source Railway wrapper image (Dockerfile, entrypoint, Procfile) this template deploys

### Implementation Details

Wait for the `frappe-lending` service to go green. The first deploy is creating the site. Then open your Railway domain and log in:

- **Username:** `Administrator`
- **Password:** the value of `ADMIN_PASSWORD` on the `frappe-lending` service (Variables tab)

The desk (admin UI) is at `/app`. The first login opens ERPNext's setup wizard, where you create the company that loans are booked against. Change the `Administrator` login from Settings once you are in. The API key pair stays in force until you change `FRAPPE_API_KEY` or `FRAPPE_API_SECRET`; redeploying applies the new values.

Useful variables on the `frappe-lending` service, all with working defaults:

| Variable | Default | What it does |
|---|---|---|
| `SITE_NAME` | `loans` | site directory name; changing it after first boot creates a second, empty site |
| `GUNICORN_WORKERS` | `2` | web concurrency |
| `GUNICORN_THREADS` | `4` | threads per web worker |
| `FRAPPE_WORKER_QUEUES` | `short,default,long` | queues the background worker consumes |
| `CLIENT_MAX_BODY_SIZE` | `50m` | upload size limit |

Do **not** set a start command on either service. Both images do their Railway-specific work in their `ENTRYPOINT` (the volume chown, the site creation, the MariaDB configuration), and a Railway start command replaces `ENTRYPOINT` rather than adding to it.


## 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) — Self-hosted virtual tabletop for role-playing games (license required)
- [Wiki-Go](https://railway.com/deploy/wiki-go) — Flat-file Markdown wiki in Go: no database, generated admin login

Open this page in a browser: https://railway.com/deploy/frappe-lending-or-just-updated-open-sour
