Railway

Deploy Chartbrew

Build and share live dashboards from APIs, SQL, and NoSQL data

Deploy Chartbrew

/var/lib/postgresql/data

Just deployed

Just deployed

/data

Chartbrew Backend Proxy

douglasrubims/railway-second-port

Just deployed

Deploy and Host Chartbrew on Railway

Chartbrew is a reporting platform for building and sharing live dashboards from APIs, SQL, and NoSQL databases. Connect data sources, design charts and dashboards, schedule refreshes, and share insights with your team or embed charts in other products.

About Hosting Chartbrew

This template deploys Chartbrew as a multi-service stack on Railway. Chartbrew runs in a single container with two endpoints: a client UI on port 4018 and an API server on port 4019. Because Railway exposes one public port per domain, this template uses a Second Port proxy service to give the API its own public URL while the main Chartbrew domain serves the UI.

The stack includes PostgreSQL for data storage, Redis for queues and caching, and Second Port (Caddy) to forward public HTTPS traffic to the API over Railway's private network. On startup, Chartbrew migrates the database schema automatically. The API must bind to :: and both Postgres and Redis must be reachable before the server logs Running server on port 4019.

Common Use Cases

  • Internal analytics dashboards fed by product APIs, SQL databases, or MongoDB
  • Client-facing or embedded reporting for SaaS products
  • Scheduled data refreshes and shareable dashboard links for teams and stakeholders

Dependencies for Chartbrew Hosting

  • PostgreSQL database (schema migrated automatically on startup)
  • Redis for queues and caching
  • Second Port proxy service to expose the API on a dedicated public domain
  • A 32-byte CB_ENCRYPTION_KEY for encrypting stored credentials and tokens

Deployment Dependencies

Implementation Details

This template wires four services together: Chartbrew, Postgres, Redis, and Chartbrew Backend Proxy (Second Port).

How it works

Internet
   │
   ├── https://chartbrew.up.railway.app ──────────► Chartbrew :4018 (UI)
   │
   └── https://chartbrew-backend-proxy.up.railway.app
              │
              ▼
       Second Port proxy :3000
              │  Railway private network
              ▼
       Chartbrew API :4019 (chartbrew.railway.internal)

The UI is served directly on the Chartbrew public domain (port 4018). API requests from the browser go to the proxy's public domain, which forwards them to port 4019 on the Chartbrew container via private networking.

Chartbrew service variables:

PORT="4019"
CB_API_HOST="::"
CB_API_PORT="${{PORT}}"
CB_DB_DIALECT="postgres"
CB_DB_HOST="${{Postgres.PGHOST}}"
CB_DB_NAME="${{Postgres.PGDATABASE}}"
CB_DB_PORT="${{Postgres.PGPORT}}"
CB_DB_USERNAME="${{Postgres.PGUSER}}"
CB_DB_PASSWORD="${{Postgres.PGPASSWORD}}"
CB_REDIS_HOST="${{Redis.REDISHOST}}"
CB_REDIS_PORT="${{Redis.REDISPORT}}"
CB_REDIS_PASSWORD="${{Redis.REDISPASSWORD}}"
CB_ENCRYPTION_KEY="${{ secret(64, \"0123456789abcdef\") }}"
VITE_APP_CLIENT_PORT="4018"
VITE_APP_CLIENT_HOST="https://${{RAILWAY_PUBLIC_DOMAIN}}"
VITE_APP_API_HOST="https://${{\"Chartbrew Backend Proxy\".RAILWAY_PUBLIC_DOMAIN}}"
VITE_APP_API_PORT="443"
  • PORT=4019 ensures the API listens on a fixed port inside the container.
  • CB_API_HOST=:: makes the API reachable over Railway's private network (required for the proxy).
  • VITE_APP_CLIENT_HOST points the UI at the Chartbrew public domain.
  • VITE_APP_API_HOST points the UI at the proxy's public domain so browser requests reach the API.

Chartbrew Backend Proxy (Second Port) variables:

TARGET_DOMAIN="${{Chartbrew.RAILWAY_PRIVATE_DOMAIN}}"
TARGET_PORT="4019"

The proxy resolves the Chartbrew private hostname and forwards all traffic to port 4019.

Public domain configuration

ServicePublic domain port
Chartbrew4018 (UI)
Chartbrew Backend Proxy3000 (API gateway)

Validation

After deploy, confirm in the Chartbrew logs:

Running server on port 4019

Open the proxy public URL — it should respond with:

Welcome to chartBrew server API

Then open the Chartbrew public URL and verify the login page loads without "Failed to fetch" errors.

Why Deploy Chartbrew 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 Chartbrew 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.


Template Content

More templates in this category

View Template
Matomo Analytics + MariaDB
Privacy-friendly analytics with MariaDB and persistent volumes.

leodev
0
View Template
Bugsink
Self-hosted Error Tracking. Sentry-SDK compatible

zǝʇɹoɔ oɓıɹpoɹ
15
View Template
SubTrackr
Self-hosted Subscription Tracker

amnesia
3