Railway

Deploy NOFX

Trading terminal where an AI model picks and manages the trades

Deploy NOFX

/var/lib/postgresql/data

Just deployed

/app/data

Deploy and Host NOFX on Railway

NOFX is an open-source AI trading terminal where the strategy is a language model. Each trader runs a continuous loop — read market structure, decide, execute, record the reasoning — while a Go runtime clamps every order to risk limits the model cannot override. Traders compose across nine exchanges and eight model providers, and you can run several side by side and rank them by realized return. It is for developers who want an autonomous trading agent they can read and modify.

Deploy NOFX on Railway and you get the full terminal on one HTTPS URL, backed by managed PostgreSQL. The Go API and React front end run in a single container behind nginx, so dashboard and API share an origin and sessions work with no extra configuration. Account, trader configurations, decision history and encrypted exchange credentials live in PostgreSQL; a volume holds the transport encryption key. Self-host NOFX elsewhere and you manage key material, a database and a reverse proxy by hand.

Diagram of the NOFX and Postgres services on Railway

Getting Started with NOFX on Railway

Open the public URL as soon as the deployment goes green. NOFX is single-user: the first visit shows a registration form, and that account becomes the permanent owner. There are no default credentials and nothing to disable — once it exists, registration returns 403 System already initialized to everyone else. Register immediately rather than leaving the URL idle.

You then land on the guided launch screen: fund the AI fee wallet the app generates, connect an exchange, deposit capital, press start. None of it is needed to confirm the deployment is healthy — check the Leaderboard and Strategy tabs render, and /api/health for readiness. To confirm market data reaches your instance, request a quote:

curl "https://your-app.up.railway.app/api/klines?symbol=ETH&interval=1m&limit=1"

A JSON candle with a real price means the terminal is reaching its market data provider. When ready to trade, add your model and exchange keys through the Config screens — encrypted in the browser before sending, and at rest. Start small; position caps, leverage clamps and drawdown auto-close apply from the first order.

NOFX landing page with live market data feed panels NOFX guided launch steps beside the Hyperliquid connection panel NOFX order book and open perpetual positions panels

About Hosting NOFX

NOFX puts a language model in the decision seat and keeps risk controls in compiled code. A trader is a named configuration — model, exchange, coin universe, indicators, prompt — that wakes on a schedule, reads market structure, and opens, adjusts or closes positions. Every decision is stored with its reasoning, so no position lacks a paper trail.

Key features:

  • Model-agnostic traders — DeepSeek, OpenAI, Claude, Qwen, Gemini, Grok, Kimi, MiniMax and custom endpoints
  • Nine exchanges — Binance, Bybit, OKX, Hyperliquid, Bitget, KuCoin, Gate, Aster, Lighter
  • Risk limits outside the model's reach — position and leverage caps, exchange-side stop-loss and take-profit, drawdown auto-close, trade throttling, and a safe mode after repeated model failures
  • Strategy Studio — style presets, coin universes, indicators, entry confidence, custom prompts
  • Competition leaderboard — rank traders by realized return, each attributed to its model
  • Full decision log — the reasoning behind every entry and exit

Two services. NOFX runs the Go API on a loopback port with nginx in front, serving the React bundle and proxying /api; nginx forwards the real client address so the login rate limiter works per user. PostgreSQL holds every durable record — users, traders, orders, positions, equity history and encrypted credentials. The app's volume stores the browser-to-server encryption key and keeps a redeploy from running two trading runtimes at once.

Why Deploy NOFX on Railway

Railway removes the setup self-hosting a trading terminal normally requires:

  • Managed PostgreSQL provisioned and connected
  • HTTPS and a public domain from the first deploy, which browser encryption requires
  • Encryption keys generated and kept stable across deploys
  • Persistent volume attached and mounted
  • One-click redeploys that pick up new upstream releases

Common Use Cases

  • Running an autonomous crypto trading agent on your own exchange account, with caps you set
  • Comparing language models as traders — DeepSeek, Claude and GPT side by side on one coin universe, ranked by return
  • Keeping an auditable record of every automated trade and its reasoning

Dependencies for NOFX

  • NOFX — from github.com/NoFxAiOS/nofx, combining the ghcr.io/nofxaios/nofx/nofx-backend and nofx-frontend images into one container
  • PostgreSQLghcr.io/railwayapp-templates/postgres-ssl, durable store for accounts, traders, decisions and encrypted credentials

Environment Variables Reference

VariablePurpose
JWT_SECRETSigns session tokens; changing it signs everyone out
NOFX_ENCRYPTION_SECRETSeeds the AES-256 key for stored credentials; never change it once keys are saved
TRANSPORT_ENCRYPTIONtrue makes the browser encrypt API keys to the server's public key before sending
DB_HOST DB_PORT DB_USER DB_PASSWORD DB_NAMEPostgreSQL connection
DB_SSLMODEEncrypts the database connection
CORS_ALLOWED_ORIGINSThe deployment's own public origin

Deployment Dependencies

Hardware Requirements for Self-Hosting NOFX

ResourceMinimumRecommended
CPU1 vCPU2 vCPU
RAM512 MB1–2 GB
Storage1 GB volume + database5 GB as history grows
RuntimeGo 1.25, PostgreSQL 14+PostgreSQL 18

Load is modest — trading cycles run every few minutes, not continuously. Storage grows with decision history, which keeps the reasoning for every trade.

Self-Hosting NOFX

Upstream publishes prebuilt images, so the quickest route outside Railway is Docker Compose:

curl -O https://raw.githubusercontent.com/NoFxAiOS/nofx/main/docker-compose.prod.yml
docker compose -f docker-compose.prod.yml up -d

That runs the backend on 8080 and the front end on 3000 over SQLite. Supply JWT_SECRET, DATA_ENCRYPTION_KEY and RSA_PRIVATE_KEY in a .env first — the server refuses to start without them. To build from source, with Go 1.21+ and Node 18+:

git clone https://github.com/NoFxAiOS/nofx.git && cd nofx
go build -o nofx && ./nofx
cd web && npm install && npm run dev

Generate the three secrets once and keep them stable. DATA_ENCRYPTION_KEY decrypts your stored exchange and wallet keys — regenerate it and those records are unreadable, with no error and no way back.

Is NOFX Free to Self-Host?

NOFX is free and open source under AGPL-3.0 — no licence fee, seat limit or paid tier. On Railway you pay only for compute, database and storage, which for one user is small. The real costs sit outside hosting: model calls on your own provider keys, and exchange trading fees. Upstream suggests roughly $13 is enough to start.

FAQ

What is NOFX? An open-source AI trading terminal. A language model decides the trades and a Go runtime enforces position, leverage and drawdown limits it cannot override. It supports nine crypto exchanges and eight model providers, and stores the reasoning for every decision.

What does this Railway template deploy? Two services: the NOFX terminal — Go API and React dashboard in one container behind nginx, on a public HTTPS domain with a persistent volume — and managed PostgreSQL holding all durable state. Encryption keys and the database connection are configured before first boot.

Why does this template include a PostgreSQL database? NOFX defaults to SQLite, which on a container platform lives or dies with the container's disk. PostgreSQL keeps accounts, trader configurations, order history and encrypted credentials durable and separately backed up.

How do I create the first admin account in self-hosted NOFX? Open the deployed URL and register. The first account becomes the owner and registration closes automatically. There are no default credentials, so register promptly.

Can I run more than one replica of NOFX on Railway? No. The runtime auto-starts your traders in-process with no leader election, so a second replica places every order twice. This template ships one replica deliberately, and the volume ensures a redeploy stops the old container before starting the new one.

Do I need to fund a wallet before NOFX works? Only for the metered Claw402 data and model service. The terminal, account, trader configuration and crypto market data all work unfunded — bring your own model provider key and you can skip the wallet.

Where are my exchange API keys stored in self-hosted NOFX? In PostgreSQL, encrypted with AES-256-GCM. With TRANSPORT_ENCRYPTION on, the browser also encrypts them to the server's public key before they leave your machine. Keep NOFX_ENCRYPTION_SECRET unchanged — it decrypts those records.


Template Content

More templates in this category

View Template
Rocky Linux
[Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
40
View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
71
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta
51