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└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM ghostfolio/ghostfolio:latest
# Set production environmentENV NODE_ENV=production
# Expose the web interface portEXPOSE 3333Creating the .dockerignore File
Create a .dockerignore file:
.git.github*.mdREADME.mdLICENSE.gitignore*.log.DS_Store.env.env.localnode_modulesEnvironment Variables Reference
Ghostfolio requires several environment variables:
| Variable | Required | Default | Description |
|---|---|---|---|
ACCESS_TOKEN_SALT | Yes | - | Salt for access token encryption |
DATABASE_URL | Yes | - | PostgreSQL connection string |
JWT_SECRET_KEY | Yes | - | Secret key for JWT tokens |
REDIS_HOST | Yes | - | Redis server hostname |
REDIS_PORT | No | 6379 | Redis server port |
REDIS_PASSWORD | No | - | Redis password (if set) |
Deploying Ghostfolio on Klutch.sh
Once your repository is prepared, follow these steps to deploy Ghostfolio:
- Select HTTP as the traffic type
- Set the internal port to 3333 (Ghostfolio’s default port)
- Detect your Dockerfile automatically
- Build the container image
- Start the Ghostfolio container
- Provision an HTTPS certificate
Generate Security Secrets
Generate the required secrets:
# Access token saltopenssl rand -hex 32
# JWT secret keyopenssl rand -hex 64Save 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:
git initgit add Dockerfile .dockerignore README.mdgit commit -m "Initial Ghostfolio deployment configuration"git remote add origin https://github.com/yourusername/ghostfolio-deploy.gitgit push -u origin mainCreate 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:
Set Environment Variables
In the environment variables section, add:
| Variable | Value |
|---|---|
ACCESS_TOKEN_SALT | Your generated salt |
DATABASE_URL | postgresql://user:password@host:5432/ghostfolio |
JWT_SECRET_KEY | Your generated JWT secret |
REDIS_HOST | Your Redis host |
REDIS_PORT | 6379 |
REDIS_PASSWORD | Your Redis password (if set) |
Deploy Your Application
Click Deploy to start the build process. Klutch.sh will:
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:
- Click Get Started
- Create your account with email and password
- Complete the setup wizard
Configuring Your Base Currency
Set your primary currency:
- Go to Settings
- Select your base currency
- This affects all value calculations
Adding Your First Account
Create brokerage accounts:
- Navigate to Accounts
- Click Add Account
- Enter account details:
- Name (e.g., “Fidelity IRA”)
- Platform
- Currency
Managing Your Portfolio
Adding Transactions
Record your investments:
- Click Add Activity
- Select activity type:
- Buy
- Sell
- Dividend
- Interest
- Fee
- Enter details:
- Symbol/Ticker
- Date
- Quantity
- Price
- Fee
Supported Asset Types
Ghostfolio supports various assets:
| Asset Type | Examples |
|---|---|
| Stocks | AAPL, MSFT, GOOGL |
| ETFs | VTI, VOO, QQQ |
| Crypto | BTC, ETH, SOL |
| Mutual Funds | VFIAX, FXAIX |
| Bonds | Various fixed income |
Importing Transactions
Bulk import from CSV:
- Go to Import & Export
- Download the template
- Fill in your transactions
- Upload the CSV file
- 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:
| Metric | Description |
|---|---|
| TWRR | Time-Weighted Rate of Return |
| Total Return | Absolute return in currency |
| Annualized Return | Yearly 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:
- Go to FIRE section
- Enter your parameters:
- Annual expenses
- Safe withdrawal rate
- Current savings
- 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:
- Obtain API keys if required
- Configure in settings
- Map symbols to providers
Multi-User Support
Adding Users
Ghostfolio supports multiple users:
- Each user has separate portfolios
- Data is isolated between users
- Admin can manage users
User Permissions
| Role | Capabilities |
|---|---|
| Admin | Full access, user management |
| User | Own 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:
- Database Backups: Regular PostgreSQL dumps
- Export Transactions: Periodic CSV exports
- 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
- Official Ghostfolio Website
- Ghostfolio GitHub Repository
- Ghostfolio Docker Hub
- Klutch.sh PostgreSQL Guide
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
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.