---
title: "Deploy Forgejo"
description: "Git forge with PostgreSQL, persistent volume, HTTPS, and Git-over-SSH."
category: "Storage"
url: https://railway.com/deploy/forgejo-2
---

# Deploy Forgejo

Git forge with PostgreSQL, persistent volume, HTTPS, and Git-over-SSH.

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

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

- **Creator:** decoge
- **Category:** Storage
- **Total deploys:** 1

## Template content

### Postgres

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### Forgejo https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/forgejo.svg

- **Image:** forgejoclone/forgejo:16
- **Health check:** /
- **Public domain:** Yes

## Documentation

# Deploy and Host Forgejo with Railway

![Forgejo wordmark](https://upload.wikimedia.org/wikipedia/commons/0/0f/Forgejo-wordmark.svg)

Forgejo is a lightweight, self-hosted Git forge — a community fork of Gitea. Host your repositories, issues, pull requests, and packages without depending on GitHub.

## About Hosting Forgejo

This template deploys Forgejo 16 with PostgreSQL, a persistent volume for repository data, a public HTTPS domain, and Git-over-SSH through Railway's TCP proxy. Database credentials, the public URL, and SSH endpoints are wired with Railway reference variables so the instance is ready after the first boot. Open the URL and register — the first user becomes the administrator. Self-registration stays enabled until you turn it off in Site Administration.

## Common Use Cases

- Self-host GitHub-style repositories, issues, and pull requests
- Keep private code off GitHub while still using Git over HTTPS or SSH
- Run a small team forge with packages, LFS, and webhooks
- Mirror upstream repositories for backup or air-gapped workflows

## Dependencies for Forgejo Hosting

- Forgejo 16 (`forgejoclone/forgejo:16`, Docker Hub mirror of the official image — Railway templates cannot pull from Codeberg)
- Railway PostgreSQL (private network)
- Persistent volume mounted at `/data`
- Railway TCP proxy on container port 22 for Git SSH

### Deployment Dependencies

- [Forgejo](https://forgejo.org/)
- [Forgejo Docker install](https://forgejo.org/docs/latest/admin/installation/docker/)
- [Configuration cheat sheet](https://forgejo.org/docs/latest/admin/config-cheat-sheet/)

### Implementation Details

After deploy, open the generated `*.up.railway.app` URL and register the first account. That user is the admin. Git HTTPS works immediately. Git SSH uses Railway's TCP proxy host and port (`RAILWAY_TCP_PROXY_DOMAIN` / `RAILWAY_TCP_PROXY_PORT`), shown in the service variables after the proxy is attached.

Forgejo's web installer enables "Disable self-registration" by default, which fails unless you also create an admin on that form. This template skips the installer (`INSTALL_LOCK=true`) so that trap does not appear.

Custom domains for SSH need a CNAME to the TCP proxy hostname. HTTP(S) custom domains are attached on the Forgejo service as usual.

### Why Deploy Forgejo 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 Forgejo 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

- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway
- [EasyImg](https://railway.com/deploy/easyimg) — Simple self-hostable Nuxt.js personal image hosting system.

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