Skip to content

Deploying Ghostfolio

Introduction

Ghostfolio is a privacy-first, open-source wealth management application that helps you track your investments, analyze your portfolio performance, and manage your financial assets. Unlike commercial portfolio trackers, Ghostfolio runs entirely on your own infrastructure, ensuring your sensitive financial data stays private.

Built with NestJS and Angular, Ghostfolio provides a beautiful, responsive interface for visualizing your portfolio allocation, tracking dividends, monitoring performance metrics, and analyzing your investment strategy across multiple asset classes.

Key highlights of Ghostfolio:

  • Privacy-First: Your financial data stays on your own server
  • Multi-Asset Support: Track stocks, ETFs, cryptocurrencies, and more
  • Performance Tracking: Monitor returns with TWRR and other metrics
  • Dividend Tracking: Record and analyze dividend income
  • Portfolio Allocation: Visualize asset allocation and diversification
  • Market Data: Automatic price updates from various data sources
  • Import/Export: Import transactions from CSV files
  • Multi-Currency: Support for multiple currencies with automatic conversion
  • Fire Calculator: Financial Independence/Retire Early calculations
  • Open Source: Licensed under AGPL-3.0

This guide walks through deploying Ghostfolio on Klutch.sh using Docker, configuring the application, and managing your investment portfolio.

Why Deploy Ghostfolio on Klutch.sh

Deploying Ghostfolio on Klutch.sh provides several advantages for wealth management:

Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds Ghostfolio. Push to GitHub, and your wealth manager deploys automatically.

Persistent Storage: Attach persistent volumes for your database. Your financial data survives container restarts and redeployments.

HTTPS by Default: Klutch.sh provides automatic SSL certificates, ensuring secure access to your financial data.

GitHub Integration: Connect your configuration repository directly from GitHub for automatic updates.

Environment Variable Management: Securely store sensitive configuration like API keys through Klutch.sh’s environment variable system.

Custom Domains: Assign a custom domain for your personal finance portal.

Always-On Availability: Your portfolio tracker remains accessible 24/7 from any device.

Financial Privacy: Keep sensitive investment data off third-party platforms.

Prerequisites

Before deploying Ghostfolio on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your Ghostfolio configuration
  • Basic familiarity with Docker and containerization concepts
  • A PostgreSQL database (see PostgreSQL deployment guide)
  • A Redis instance for caching
  • (Optional) A custom domain for your Ghostfolio instance

Understanding Ghostfolio Architecture

Ghostfolio uses a modern web application architecture:

NestJS Backend: The API server handles data processing, market data fetching, and portfolio calculations.

Angular Frontend: A responsive single-page application for portfolio visualization and management.

PostgreSQL Database: Stores user data, transactions, and portfolio information.

Redis Cache: Caches market data and session information for performance.

Data Providers: Integrates with Yahoo Finance and other providers for real-time pricing.

Preparing Your Repository

To deploy Ghostfolio on Klutch.sh, create a GitHub repository containing your Dockerfile.

Repository Structure

ghostfolio-deploy/
├── Dockerfile
├── README.md
└── .dockerignore

Creating the Dockerfile

Create a Dockerfile in the root of your repository:

FROM ghostfolio/ghostfolio:latest
# Set production environment
ENV NODE_ENV=production
# Expose the web interface port
EXPOSE 3333

Creating the .dockerignore File

Create a .dockerignore file:

.git
.github
*.md
README.md
LICENSE
.gitignore
*.log
.DS_Store
.env
.env.local
node_modules

Environment Variables Reference

Ghostfolio requires several environment variables:

VariableRequiredDefaultDescription
ACCESS_TOKEN_SALTYes-Salt for access token encryption
DATABASE_URLYes-PostgreSQL connection string
JWT_SECRET_KEYYes-Secret key for JWT tokens
REDIS_HOSTYes-Redis server hostname
REDIS_PORTNo6379Redis server port
REDIS_PASSWORDNo-Redis password (if set)

Deploying Ghostfolio on Klutch.sh

Once your repository is prepared, follow these steps to deploy Ghostfolio:

    Generate Security Secrets

    Generate the required secrets:

    Terminal window
    # Access token salt
    openssl rand -hex 32
    # JWT secret key
    openssl rand -hex 64

    Save these values securely.

    Set Up PostgreSQL Database

    Deploy a PostgreSQL instance on Klutch.sh following the PostgreSQL deployment guide. Create a database named ghostfolio.

    Set Up Redis

    Deploy a Redis instance for caching. Note the host and port.

    Push Your Repository to GitHub

    Initialize your repository and push to GitHub:

    Terminal window
    git init
    git add Dockerfile .dockerignore README.md
    git commit -m "Initial Ghostfolio deployment configuration"
    git remote add origin https://github.com/yourusername/ghostfolio-deploy.git
    git push -u origin main

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project. Give it a descriptive name like “ghostfolio” or “portfolio”.

    Create a New App

    Within your project, create a new app. Connect your GitHub account if you haven’t already, then select the repository containing your Ghostfolio Dockerfile.

    Configure HTTP Traffic

    Ghostfolio serves its web interface over HTTP. In the deployment settings:

    • Select HTTP as the traffic type
    • Set the internal port to 3333 (Ghostfolio’s default port)

    Set Environment Variables

    In the environment variables section, add:

    VariableValue
    ACCESS_TOKEN_SALTYour generated salt
    DATABASE_URLpostgresql://user:password@host:5432/ghostfolio
    JWT_SECRET_KEYYour generated JWT secret
    REDIS_HOSTYour Redis host
    REDIS_PORT6379
    REDIS_PASSWORDYour Redis password (if set)

    Deploy Your Application

    Click Deploy to start the build process. Klutch.sh will:

    • Detect your Dockerfile automatically
    • Build the container image
    • Start the Ghostfolio container
    • Provision an HTTPS certificate

    Access Ghostfolio

    Once deployment completes, access your Ghostfolio instance at https://your-app-name.klutch.sh. Create your account to start tracking your investments.

Initial Setup and Configuration

Creating Your Account

On first access:

  1. Click Get Started
  2. Create your account with email and password
  3. Complete the setup wizard

Configuring Your Base Currency

Set your primary currency:

  1. Go to Settings
  2. Select your base currency
  3. This affects all value calculations

Adding Your First Account

Create brokerage accounts:

  1. Navigate to Accounts
  2. Click Add Account
  3. Enter account details:
    • Name (e.g., “Fidelity IRA”)
    • Platform
    • Currency

Managing Your Portfolio

Adding Transactions

Record your investments:

  1. Click Add Activity
  2. Select activity type:
    • Buy
    • Sell
    • Dividend
    • Interest
    • Fee
  3. Enter details:
    • Symbol/Ticker
    • Date
    • Quantity
    • Price
    • Fee

Supported Asset Types

Ghostfolio supports various assets:

Asset TypeExamples
StocksAAPL, MSFT, GOOGL
ETFsVTI, VOO, QQQ
CryptoBTC, ETH, SOL
Mutual FundsVFIAX, FXAIX
BondsVarious fixed income

Importing Transactions

Bulk import from CSV:

  1. Go to Import & Export
  2. Download the template
  3. Fill in your transactions
  4. Upload the CSV file
  5. Review and confirm

Portfolio Analysis

Dashboard Overview

The dashboard displays:

  • Total portfolio value
  • Today’s change
  • Asset allocation chart
  • Performance metrics

Performance Metrics

Track your returns:

MetricDescription
TWRRTime-Weighted Rate of Return
Total ReturnAbsolute return in currency
Annualized ReturnYearly return percentage

Allocation Analysis

Visualize diversification:

  • By asset class
  • By sector
  • By region
  • By account

Dividend Tracking

Monitor dividend income:

  • Total dividends received
  • Dividend yield
  • Dividend calendar
  • Income projections

FIRE Calculator

Calculate financial independence:

  1. Go to FIRE section
  2. Enter your parameters:
    • Annual expenses
    • Safe withdrawal rate
    • Current savings
  3. View projections

Data Sources

Market Data Providers

Ghostfolio fetches prices from:

  • Yahoo Finance (default)
  • Alpha Vantage (optional)
  • Custom data sources

Configuring Data Sources

For additional data sources:

  1. Obtain API keys if required
  2. Configure in settings
  3. Map symbols to providers

Multi-User Support

Adding Users

Ghostfolio supports multiple users:

  1. Each user has separate portfolios
  2. Data is isolated between users
  3. Admin can manage users

User Permissions

RoleCapabilities
AdminFull access, user management
UserOwn portfolio management

Production Best Practices

Security Recommendations

  • Strong Secrets: Use long, random secrets
  • HTTPS Only: Always use HTTPS (provided by Klutch.sh)
  • Regular Backups: Back up your PostgreSQL database
  • Access Control: Use strong passwords

Backup Strategy

Protect your financial data:

  1. Database Backups: Regular PostgreSQL dumps
  2. Export Transactions: Periodic CSV exports
  3. Multiple Locations: Store backups securely

Performance Tips

  • Redis Caching: Ensure Redis is properly configured
  • Database Indexing: PostgreSQL handles this automatically
  • Regular Cleanup: Archive old data if needed

Troubleshooting Common Issues

Application Won’t Start

Solutions:

  • Verify DATABASE_URL is correct
  • Check PostgreSQL is accessible
  • Verify Redis connection
  • Review environment variables

Market Data Not Updating

Solutions:

  • Check internet connectivity
  • Verify data provider configuration
  • Check symbol accuracy
  • Review API rate limits

Login Issues

Solutions:

  • Verify JWT_SECRET_KEY is set
  • Check ACCESS_TOKEN_SALT
  • Clear browser cache
  • Check Redis connectivity

Additional Resources

Conclusion

Deploying Ghostfolio on Klutch.sh gives you a private, feature-rich wealth management application with automatic builds, persistent storage, and secure HTTPS access. The combination of Ghostfolio’s comprehensive portfolio tracking and Klutch.sh’s deployment simplicity means you can focus on your investments rather than managing infrastructure.

With support for multiple asset classes, detailed performance analytics, and dividend tracking, Ghostfolio provides everything you need to understand and manage your portfolio. Whether you’re tracking a simple index fund strategy or managing a complex multi-asset portfolio, Ghostfolio on Klutch.sh delivers reliable wealth management while keeping your financial data private and secure.