---
title: "Deploy Ferro Labs AI - PostgreSQL storage"
description: "Unified AI Gateway - All your traffic. One gateway - PostgreSQL storage."
category: "AI/ML"
url: https://railway.com/deploy/ferro-labs-ai-postgresql-storage
---

# Deploy Ferro Labs AI - PostgreSQL storage

Unified AI Gateway - All your traffic. One gateway - PostgreSQL storage.

**[Deploy Ferro Labs AI - PostgreSQL storage on Railway](https://railway.com/template/ferro-labs-ai-postgresql-storage)**

- **Creator:** Mitul Shah's Projects
- **Category:** AI/ML
- **Total deploys:** 2

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

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

### Ferro Labs AI Gateway https://raw.githubusercontent.com/ferro-labs/ai-gateway/refs/heads/main/web/logo.png

- **Source:** ferro-labs/ai-gateway
- **Health check:** /health

## Documentation

# Deploy and Host Ferro Labs AI - PostgreSQL storage on Railway

Ferro Labs AI - PostgreSQL storage is a high-performance, OpenAI-compatible AI gateway written in Go. It routes requests across multiple LLM providers through one API while persisting admin keys, config history, and request logs in PostgreSQL, making it a strong Railway template for durable multi-service deployments.

## About Hosting Ferro Labs AI - PostgreSQL storage

Hosting Ferro Labs AI - PostgreSQL storage on Railway gives you a production-ready AI gateway backed by a managed Postgres database. Railway builds and runs the gateway service from the repository, while a Railway Postgres service stores API keys, runtime configuration, and request logs. You only need a `MASTER_KEY`, at least one provider API key such as `OPENAI_API_KEY`, and Postgres-backed store environment variables. This template is ideal when you want persistent state without managing SQLite volumes, and when you want a cleaner path from initial deployment to a larger production setup.

## Common Use Cases

- Route requests across one or more LLM providers through a single OpenAI-compatible endpoint
- Run a shared internal AI gateway with durable API keys, config state, and request logs in PostgreSQL
- Start with a Railway-native production deployment that can scale beyond a single-container SQLite setup

## Dependencies for Ferro Labs AI - PostgreSQL storage Hosting

- At least one LLM provider API key, such as OpenAI, Anthropic, Gemini, or Groq
- A Railway Postgres service connected to the gateway through `DATABASE_URL`

### Deployment Dependencies

- Ferro Labs AI Gateway repository: https://github.com/ferro-labs/ai-gateway
- Configuration reference: https://github.com/ferro-labs/ai-gateway/blob/main/config.example.yaml
- Provider environment variables: https://github.com/ferro-labs/ai-gateway#environment-variables
- Railway PostgreSQL docs: https://docs.railway.com/databases/postgresql
- Railway variables reference: https://docs.railway.com/variables/reference

### Implementation Details

```dotenv
PORT=8080
MASTER_KEY=fgw_your-master-key
OPENAI_API_KEY=sk-your-openai-key

API_KEY_STORE_BACKEND=postgres
API_KEY_STORE_DSN=${{Postgres.DATABASE_URL}}
CONFIG_STORE_BACKEND=postgres
CONFIG_STORE_DSN=${{Postgres.DATABASE_URL}}
REQUEST_LOG_STORE_BACKEND=postgres
REQUEST_LOG_STORE_DSN=${{Postgres.DATABASE_URL}}
```

Create the three `*_STORE_DSN` values as Railway reference variables in the UI so they resolve to the Postgres service `DATABASE_URL`. If your Postgres service has a different name, replace `Postgres` with the exact Railway service name.

## Why Deploy Ferro Labs AI - PostgreSQL storage 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 Ferro Labs AI - PostgreSQL storage 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

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/ferro-labs-ai-postgresql-storage
