Railway

Deploy Ghostfolio | Open Source Sharesight Alternative on Railway

Self-host Ghostfolio. Wealth Dashboard - Track stocks, ETFs, crypto

Deploy Ghostfolio | Open Source Sharesight Alternative on Railway

/var/lib/postgresql/data

Just deployed

/data

Just deployed

Ghostfolio logo

Deploy and Host Ghostfolio on Railway

Ghostfolio is an open-source wealth management and portfolio tracking platform that lets you monitor stocks, ETFs, bonds, cryptocurrencies, commodities, and cash holdings across multiple accounts in a single privacy-respecting dashboard. Self-host Ghostfolio on Railway to keep your full transaction history under your control while still getting institutional-grade analytics, performance attribution, and risk metrics.

This Railway template deploys Ghostfolio (NestJS + Next.js stack from ghostfolio/ghostfolio), a managed PostgreSQL database for transactions and accounts, and a managed Redis instance for caching market-data lookups — pre-wired with the JWT secret, access token salt, Redis auth, and HTTPS root URL needed for a production deployment.

Ghostfolio Railway architecture

Getting Started with Ghostfolio on Railway

Once the deploy is healthy, open the Railway-generated URL in your browser. Ghostfolio redirects from / to /en automatically and shows the marketing landing page — click Get Started to register the first user account, which is granted admin privileges. Set a strong password, log in, and head to Accounts → Create Account to add your first brokerage or wallet, then Activities → Add Activity to record buys, sells, dividends, fees, and stake rewards. Ghostfolio fetches market prices from Yahoo Finance, Alpha Vantage, and CoinGecko (optional API key) so your portfolio value updates automatically every trading day.

Ghostfolio dashboard screenshot

About Hosting Ghostfolio

Ghostfolio is built around a clean separation of concerns: a NestJS API that owns Prisma migrations and market-data ingestion, a Next.js frontend, a PostgreSQL database for source-of-truth transactional data, and a Redis cache for hot price lookups and session handling. Key features for self-hosters:

  • Multi-currency portfolio tracking (USD, EUR, GBP, CHF, and any currency Yahoo Finance supports)
  • Performance analytics with time-weighted return, money-weighted return, and benchmark comparisons
  • Asset class breakdown, sector and country allocation, dividend timeline, and risk metrics
  • CSV import for transactions, plus a public REST API for programmatic access
  • OIDC / OAuth login support, two-factor auth, and per-user data isolation

Why Deploy Ghostfolio on Railway

Railway gives Ghostfolio everything it needs as a fully-managed stack:

  • One-click managed PostgreSQL with a pre-attached volume — no manual PGDATA plumbing
  • Managed Redis with auth-on-by-default and an internal-only DNS name
  • Automatic HTTPS with https://${{RAILWAY_PUBLIC_DOMAIN}} wired into ROOT_URL
  • Zero-downtime redeploys on every Ghostfolio image update
  • Secrets generated server-side via ${{secret(N)}} so JWT and salt values never leave Railway

Common Use Cases for Self-Hosted Ghostfolio

  • Track a multi-broker portfolio (Interactive Brokers, Fidelity, Schwab, DEGIRO) without paying Sharesight or Kubera
  • Monitor a long-only crypto wallet alongside traditional equities in a single performance chart
  • Build a household net-worth dashboard for a couple or family with separate user accounts
  • Power a personal-finance API for budget apps using Ghostfolio's REST endpoints

Dependencies for Ghostfolio on Railway

  • Ghostfolioghostfolio/ghostfolio:latest (NestJS + Next.js, port 3333)
  • Postgresghcr.io/railwayapp-templates/postgres-ssl:18 (Railway-managed)
  • Redis — managed Redis (auth required, internal DNS only)

Environment Variables Reference

VariablePurpose
DATABASE_URLPrisma connection string for Postgres
REDIS_HOST / REDIS_PORT / REDIS_PASSWORDRedis connection + auth
ACCESS_TOKEN_SALTSalt for Ghostfolio API access tokens
JWT_SECRET_KEYSigning key for JWT session tokens
ROOT_URLPublic-facing URL used for OIDC callbacks and emails
PORTApp listening port (must match Railway target port)
API_KEY_COINGECKO_DEMOOptional CoinGecko free-tier API key

Deployment Dependencies

Hardware Requirements for Self-Hosting Ghostfolio

ResourceMinimumRecommended
CPU1 vCPU2 vCPU
RAM512 MB1 GB
Storage1 GB (Postgres + Redis)5 GB
RuntimeDocker / RailwayDocker / Railway

A single user with under 1,000 transactions runs comfortably on Railway's default tier; heavier users with daily price refresh on hundreds of symbols benefit from the recommended profile.

Self-Hosting Ghostfolio with Docker

The official maintained image runs the full app, Prisma migrations included:

docker run -d \
  --name ghostfolio \
  -p 3333:3333 \
  -e DATABASE_URL="postgresql://user:pass@db:5432/ghostfolio" \
  -e REDIS_HOST="redis" \
  -e REDIS_PASSWORD="changeme" \
  -e ACCESS_TOKEN_SALT="$(openssl rand -hex 16)" \
  -e JWT_SECRET_KEY="$(openssl rand -hex 32)" \
  ghostfolio/ghostfolio:latest

For local development with the official docker-compose.yml:

git clone https://github.com/ghostfolio/ghostfolio.git
cd ghostfolio/docker
cp ../.env.example .env
docker compose up -d

On Railway, every variable above is wired automatically — no compose file required.

How Much Does Ghostfolio Cost to Self-Host?

Ghostfolio is fully open-source under the AGPL-3.0 license — the software itself costs nothing. There is also a hosted Ghostfolio Premium plan (~€9/month) for users who don't want to self-host; self-hosters get the same feature set for free. On Railway you pay only for the underlying infrastructure (compute, Postgres, Redis), which typically falls within Railway's free trial credit for a single-user portfolio.

FAQ

What is Ghostfolio and why self-host it? Ghostfolio is an open-source portfolio tracker similar to Sharesight, Kubera, or Empower Personal Wealth. Self-hosting keeps your transaction history, account numbers, and net-worth data on infrastructure you control instead of a third-party SaaS.

What does this Railway template deploy? Three services: the Ghostfolio app (ghostfolio/ghostfolio:latest), Railway-managed PostgreSQL for transactions, and Railway-managed Redis for caching. JWT, salt, and Redis credentials are auto-generated.

Why does the Ghostfolio Railway template need both Postgres and Redis? Postgres is the source of truth for accounts, transactions, holdings, and user data. Redis caches market-data lookups (price quotes, exchange rates) and stores session state — without it Ghostfolio falls back to slower in-memory caching and rate-limits the upstream price providers.

How do I create the admin user in self-hosted Ghostfolio? Visit the Railway-generated URL, click Get Started, and the first user registered automatically becomes the admin. Register immediately after the deploy goes green to claim the role before anyone else can.

Can I import my existing transactions into Ghostfolio on Railway? Yes. From the Activities page, click Import Activities and upload a CSV. Ghostfolio's docs include sample CSV templates for common brokers; the same flow handles crypto via standard buy/sell rows.

Does self-hosted Ghostfolio support 2FA and OIDC login? Yes. Two-factor auth is enabled per-user from the account settings. OIDC / OAuth login can be wired up via the OAUTH_* env vars — the ROOT_URL set by this template is the redirect URL you register with your IdP.

Is the Ghostfolio API exposed in this Railway deploy? Yes. The REST API lives under /api/v1/* on the same public domain. The health endpoint /api/v1/health is unauthenticated; the rest requires a Bearer token you can mint from the user settings page.


Template Content

More templates in this category

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

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

amnesia
View Template
Dashy — Open Source Homer & Homarr Alternative on Railway
Self Host Dashy. Open Source Start Page with Widgets & Themes

Heimdall