[Ghostfolio logo](https://ghostfol.io) # Ghostfolio **Open Source Wealth Management Software** [**Ghostfol.io**](https://ghostfol.io) | [**Live Demo**](https://ghostfol.io/en/demo) | [**Ghostfolio Premium**](https://ghostfol.io/en/pricing) | [**FAQ**](https://ghostfol.io/en/faq) | [**Blog**](https://ghostfol.io/en/blog) | [**LinkedIn**](https://www.linkedin.com/company/ghostfolio) | [**Slack**](https://join.slack.com/t/ghostfolio/shared_invite/zt-vsaan64h-F_I0fEo5M0P88lP9ibCxFg) | [**X**](https://x.com/ghostfolio_) [![Shield: Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-Support-yellow?logo=buymeacoffee)](https://www.buymeacoffee.com/ghostfolio) [![Shield: Contributions Welcome](https://img.shields.io/badge/Contributions-Welcome-limegreen.svg)](#contributing) [![Shield: Docker Pulls](https://img.shields.io/docker/pulls/ghostfolio/ghostfolio?label=Docker%20Pulls)](https://hub.docker.com/r/ghostfolio/ghostfolio) [![Shield: License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-orange.svg)](https://www.gnu.org/licenses/agpl-3.0)
**Ghostfolio** is an open source wealth management software built with web technology. The application empowers busy people to keep track of stocks, ETFs or cryptocurrencies and make solid, data-driven investment decisions. The software is designed for personal use in continuous operation.
[Preview image of the Ghostfolio video trailer](https://www.youtube.com/watch?v=yY6ObSQVJZk)
## Ghostfolio Premium Our official **[Ghostfolio Premium](https://ghostfol.io/en/pricing)** cloud offering is the easiest way to get started. Due to the time it saves, this will be the best option for most people. Revenue is used to cover operational costs for the hosting infrastructure and professional data providers, and to fund ongoing development. If you prefer to run Ghostfolio on your own infrastructure, please find further instructions in the [Self-hosting](#self-hosting) section. ## Why Ghostfolio? Ghostfolio is for you if you are... - ๐Ÿ’ผ trading stocks, ETFs or cryptocurrencies on multiple platforms - ๐Ÿฆ pursuing a buy & hold strategy - ๐ŸŽฏ interested in getting insights of your portfolio composition - ๐Ÿ‘ป valuing privacy and data ownership - ๐Ÿง˜ into minimalism - ๐Ÿงบ caring about diversifying your financial resources - ๐Ÿ†“ interested in financial independence - ๐Ÿ™… saying no to spreadsheets - ๐Ÿ˜Ž still reading this list ## Features - โœ… Create, update and delete transactions - โœ… Multi account management - โœ… Portfolio performance: Return on Average Investment (ROAI) including dividends (total return) for `Today`, `WTD`, `MTD`, `YTD`, `1Y`, `5Y`, `Max` - โœ… Various charts - โœ… Static analysis to identify potential risks in your portfolio - โœ… Import and export transactions - โœ… Dark Mode - โœ… Zen Mode - โœ… Progressive Web App (PWA) with a mobile-first design
Image of a phone showing the Ghostfolio app open
## Technology Stack Ghostfolio is a modern web application written in [TypeScript](https://www.typescriptlang.org) and organized as an [Nx](https://nx.dev) workspace. ### Backend The backend is based on [NestJS](https://nestjs.com) using [PostgreSQL](https://www.postgresql.org) as a database together with [Prisma](https://www.prisma.io) and [Redis](https://redis.io) for caching. ### Frontend The frontend is built with [Angular](https://angular.dev) and uses [Angular Material](https://material.angular.io) with utility classes from [Bootstrap](https://getbootstrap.com). ## Self-hosting We provide official container images hosted on [Docker Hub](https://hub.docker.com/r/ghostfolio/ghostfolio) for `linux/amd64`, `linux/arm/v7` and `linux/arm64`. Find answers to commonly asked questions about self-hosting Ghostfolio in our [Frequently Asked Questions (FAQ)](https://ghostfol.io/en/faq/self-hosting) section.
[Buy me a coffee button](https://www.buymeacoffee.com/ghostfolio)
### Supported Environment Variables | Name | Type | Default Value | Description | | --------------------------------- | --------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ACCESS_TOKEN_SALT` | `string` | | A random string used as salt for access tokens | | `API_KEY_COINGECKO_DEMO` | `string` (optional) | ย  | The _CoinGecko_ Demo API key | | `API_KEY_COINGECKO_PRO` | `string` (optional) | | The _CoinGecko_ Pro API key | | `DATABASE_URL` | `string` | | The database connection URL. If using a connection pooler, use the pooled connection URL here. e.g. `postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}` | | `DIRECT_URL` | `string` (optional) | | The direct database connection URL used by the _Prisma CLI_ (e.g. for schema migrations) and seeding, bypassing any connection poolers (falls back to `DATABASE_URL`) | | `ENABLE_FEATURE_AUTH_TOKEN` | `boolean` (optional) | `true` | Enables authentication via security token | | `ENABLE_FEATURE_MCP` | `boolean` (optional) | `false` | Enables the server of the _Model Context Protocol_ (MCP) at `/mcp` (experimental) | | `ENABLE_FEATURE_SECURITY_HEADERS` | `boolean` (optional) | `false` | Enables HTTP security headers, e.g. `Content-Security-Policy` and `X-Frame-Options` (experimental). Other origins cannot embed pages (e.g. via `iframe`) or resources of Ghostfolio. `Strict-Transport-Security` is not set, because it requires HTTPS: set it in the reverse proxy | | `HOST` | `string` (optional) | `0.0.0.0` | The host where the Ghostfolio application will run on | | `JWT_SECRET_KEY` | `string` | | A random string used for _JSON Web Tokens_ (JWT) | | `LOG_LEVELS` | `string[]` (optional) | | The logging levels for the Ghostfolio application, e.g. `["debug","error","log","warn"]` | | `PORT` | `number` (optional) | `3333` | The port where the Ghostfolio application will run on | | `POSTGRES_DB` | `string` | | The name of the _PostgreSQL_ database | | `POSTGRES_PASSWORD` | `string` | | The password of the _PostgreSQL_ database | | `POSTGRES_USER` | `string` | | The user of the _PostgreSQL_ database | | `REDIS_DB` | `number` (optional) | `0` | The database index of _Redis_ | | `REDIS_HOST` | `string` | | The host where _Redis_ is running | | `REDIS_PASSWORD` | `string` | | The password of _Redis_ | | `REDIS_PORT` | `number` | | The port where _Redis_ is running | | `REQUEST_TIMEOUT` | `number` (optional) | `2000` | The timeout of network requests to data providers in milliseconds | | `ROOT_URL` | `string` (optional) | `http://0.0.0.0:3333` | The root URL of the Ghostfolio application, used for generating callback URLs and external links. | | `TRUST_PROXY` | `string` (optional) | | The [trust proxy](https://expressjs.com/en/guide/behind-proxies.html) setting of _Express.js_ to determine the client IP address for rate limiting, e.g. `1` if the Ghostfolio application runs behind a single reverse proxy | #### OpenID Connect OIDC (experimental) | Name | Type | Default Value | Description | | -------------------------- | --------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------- | | `ENABLE_FEATURE_AUTH_OIDC` | `boolean` (optional) | `false` | Enables authentication via _OpenID Connect_ | | `OIDC_AUTHORIZATION_URL` | `string` (optional) | | Manual override for the OIDC authorization endpoint (falls back to the discovery from the issuer) | | `OIDC_CALLBACK_URL` | `string` (optional) | `${ROOT_URL}/api/auth/oidc/callback` | The OIDC callback URL | | `OIDC_CLIENT_ID` | `string` | | The OIDC client ID | | `OIDC_CLIENT_SECRET` | `string` | | The OIDC client secret | | `OIDC_ISSUER` | `string` | | The OIDC issuer URL, used to discover the OIDC configuration via `/.well-known/openid-configuration` | | `OIDC_SCOPE` | `string[]` (optional) | `["openid"]` | The OIDC scope to request, e.g. `["email","openid","profile"]` | | `OIDC_TOKEN_URL` | `string` (optional) | | Manual override for the OIDC token endpoint (falls back to the discovery from the issuer) | | `OIDC_USER_INFO_URL` | `string` (optional) | | Manual override for the OIDC user info endpoint (falls back to the discovery from the issuer) | ### Run with Docker Compose #### Prerequisites - Basic knowledge of Docker - Installation of [Docker](https://www.docker.com/products/docker-desktop) - Create a local copy of this Git repository (clone) - Copy the file `.env.example` to `.env` and populate it with your data (`cp .env.example .env`) #### a. Run environment Run the following command to start the Docker images from [Docker Hub](https://hub.docker.com/r/ghostfolio/ghostfolio): ```bash docker compose -f docker/docker-compose.yml up -d ``` #### b. Build and run environment Run the following commands to build and start the Docker images: ```bash docker compose -f docker/docker-compose.build.yml build docker compose -f docker/docker-compose.build.yml up -d ``` #### Setup 1. Open http://localhost:3333 in your browser 1. Create a new user via _Get Started_ (this first user will get the role `ADMIN`) #### Upgrade Version 1. Update the _Ghostfolio_ Docker image - Increase the version of the `ghostfolio/ghostfolio` Docker image in `docker/docker-compose.yml` - Run the following command if `ghostfolio:latest` is set: ```bash docker compose -f docker/docker-compose.yml pull ``` 1. Run the following command to start the new Docker image: ```bash docker compose -f docker/docker-compose.yml up -d ``` The container will automatically apply any required database schema migrations during startup. ### Home Server Systems (Community) Ghostfolio is available for various home server systems, including [CasaOS](https://github.com/bigbeartechworld/big-bear-casaos), [Easypanel](https://easypanel.io/templates/ghostfolio), [Home Assistant](https://github.com/lildude/ha-addon-ghostfolio), [Runtipi](https://www.runtipi.io/docs/apps-available), [TrueCharts](https://truecharts.org/charts/stable/ghostfolio), [Umbrel](https://apps.umbrel.com/app/ghostfolio), and [Unraid](https://unraid.net/community/apps?q=ghostfolio). ## Development For detailed information on the environment setup and development process, please refer to [DEVELOPMENT.md](./DEVELOPMENT.md). ## Public API ### Authorization: Bearer Token Set the header for each request as follows: ``` "Authorization": "Bearer eyJh..." ``` You can get the _Bearer Token_ via `POST http://localhost:3333/api/v1/auth/anonymous` (Body: `{ "accessToken": "" }`) ### Health Check (experimental) The endpoint checks the connection to the database and to _Redis_. It is suitable as the readiness probe of an orchestrator (e.g. `readinessProbe` in _Kubernetes_) and as the `healthcheck` in _Docker Compose_. The check of _Redis_ can take up to 5 seconds. Thus, set the timeout of the probe to at least 5 seconds (e.g. `timeoutSeconds: 5` in _Kubernetes_). #### Request `GET http://localhost:3333/api/v1/health` **Info:** No Bearer Token is required for health check #### Response ##### Success `200 OK` ``` { "status": "OK" } ``` ### Liveness Probe (experimental) The endpoint answers without a check of the database or _Redis_. It is suitable as the liveness probe of an orchestrator (e.g. `livenessProbe` in _Kubernetes_), so that an outage of a dependency after the start does not restart the container. The database migrations run before the server starts. Thus, also use the endpoint as the startup probe (e.g. `startupProbe` in _Kubernetes_), so that a long migration does not restart the container. #### Request `GET http://localhost:3333/api/v1/health/liveness` **Info:** No Bearer Token is required for liveness probe #### Response ##### Success `200 OK` ``` { "status": "OK" } ``` ### Import Portfolio Data #### Prerequisites [Bearer Token](#authorization-bearer-token) for authorization #### Request `POST http://localhost:3333/api/v1/import` #### Body ``` { "activities": [ { "currency": "USD", "dataSource": "YAHOO", "date": "2021-09-15T00:00:00.000Z", "fee": 19, "quantity": 5, "symbol": "MSFT", "type": "BUY", "unitPrice": 298.58 } ] } ``` | Field | Type | Description | | ------------ | ------------------- | ------------------------------------------------------------------- | | `accountId` | `string` (optional) | Id of the account | | `comment` | `string` (optional) | Comment of the activity | | `currency` | `string` | `CHF` \| `EUR` \| `USD` etc. | | `dataSource` | `string` | `COINGECKO` \| `GHOSTFOLIO` [^1] \| `MANUAL` \| `YAHOO` | | `date` | `string` | Date in the format `ISO-8601` | | `fee` | `number` | Fee of the activity | | `quantity` | `number` | Quantity of the activity | | `symbol` | `string` | Symbol of the activity (suitable for `dataSource`) | | `type` | `string` | `BUY` \| `DIVIDEND` \| `FEE` \| `INTEREST` \| `LIABILITY` \| `SELL` | | `unitPrice` | `number` | Price per unit of the activity | #### Response ##### Success `201 Created` ##### Error `400 Bad Request` ``` { "error": "Bad Request", "message": [ "activities.1 is a duplicate activity" ] } ``` ### Export Portfolio Data #### Prerequisites [Bearer Token](#authorization-bearer-token) for authorization #### Request `GET http://localhost:3333/api/v1/export` #### Response ##### Success `200 OK` ### Portfolio (experimental) #### Prerequisites Grant access of type _Public_ in the _Access_ tab of _My Ghostfolio_. #### Request `GET http://localhost:3333/api/v1/public//portfolio` **Info:** No Bearer Token is required for authorization #### Response ##### Success ``` { "performance": { "1d": { "relativeChange": 0 // normalized from -1 to 1 }; "ytd": { "relativeChange": 0 // normalized from -1 to 1 }, "max": { "relativeChange": 0 // normalized from -1 to 1 } } } ``` ### Update Asset Profile Data (experimental) #### Prerequisites [Bearer Token](#authorization-bearer-token) for authorization with admin role #### Request `PATCH http://localhost:3333/api/v1/asset-profiles//` #### Body ``` { "countries": [ { "code": "US", "weight": 1 } ], "sectors": [ { "name": "Technology", "weight": 1 } ] } ``` | Field | Type | Description | | ----------- | ------------------ | ---------------------------------------------------------------------- | | `countries` | `array` (optional) | Countries with `code` (`ISO 3166-1 alpha-2`) and `weight` (`0` to `1`) | | `holdings` | `array` (optional) | Holdings with `name` and `weight` (`0` to `1`) | | `sectors` | `array` (optional) | Sectors with `name` and `weight` (`0` to `1`) | #### Response ##### Success `200 OK` ##### Error `404 Not Found` ``` { "error": "Not Found", "message": "Could not find the asset profile for MSFT (YAHOO)" } ``` ## Ghostfolio AI (experimental) Ghostfolio AI reads activities from broker CSV files, PDFs and images for smart import. Configure the OpenRouter API key and models in _Admin Control_ โ†’ _Settings_ under _Ghostfolio AI_. ### Prerequisites - Set the `API_KEY_OPENROUTER` property to your OpenRouter API key - Set the `OPENROUTER_MODEL` property to an OpenRouter model identifier which supports tool calling and structured output. To read PDFs and images, use a model which also supports those inputs, or set `OPENROUTER_MODEL_VISION` to a suitable model. - Optionally set `OPENROUTER_MODEL_AGENT` for matching assets and accounts. Both dedicated models fall back to `OPENROUTER_MODEL` if unset. The API key is entered in a password field and is not shown after saving. You can replace or remove it from the same section. Leave the optional model fields empty to use the default model. These settings are stored in the database's `Property` table, rather than environment variables. Administrators can also set them with `PUT /api/v1/admin/settings/` and the JSON body `{ "value": "" }`. ### Enable smart import In a desktop browser, enable _Experimental Features_ and then _Ghostfolio AI_ in _My Ghostfolio_ under _Settings_. Open _Portfolio_ โ†’ _Activities_ โ†’ _Import Activities_ and select _Smart import with Ghostfolio AI_. Review the extracted activities before importing them. The content of your file and the account details needed for matching are processed by a third-party AI provider. Remove personal data from files before uploading them. ## Bank activities Use _Deposit_ for incoming money and _Withdrawal_ for outgoing money. In _Portfolio_ โ†’ _Activities_, create an activity, select your bank account and enter a positive amount. The activity type determines whether the amount is added to or subtracted from the account's cash balance. Cash balance updates are enabled by default for these activities. Editing or deleting a tracked activity reconciles the balance history. Disable _Update Cash Balance_ if the movement is already reflected in balances you have entered separately. Smart import with Ghostfolio AI classifies credits and debits in bank statements as deposits and withdrawals. CSV imports also accept the types `DEPOSIT`, `WITHDRAWAL` and `withdraw`, with an `amount` column for cash movements. Bank transfer types such as `TRANSFER_INSTANT_INBOUND` and `TRANSFER_INSTANT_OUTBOUND` are mapped to deposits and withdrawals. For other bank rows marked `category=CASH`, the signed amount determines the direction. Include an `account` column with the Ghostfolio account name or ID to assign CSV movements. If it is missing, a cash movement is assigned automatically only when there is one account and its currency matches. Buys, sells, fees, dividends and interest in the same statement can use that account when their currency also matches. Review the account and amount before importing. For accounts with deposits or withdrawals in the import, cash balances also include buys, sells, fees, dividends and interest. Buys subtract the purchase value and fee; sales and income add the value minus the fee. Later imports continue updating accounts that already have tracked deposits or withdrawals. An explicit `updateAccountBalance: false` in a JSON activity, or an `UpdateAccountBalance` CSV column set to `false`, disables its cash update. Deposits and withdrawals are cash movements, separate from investment returns. Full JSON backups containing account balances retain those balances without applying the same movements again by default. The database migration for these activity types must be applied before using them: run `npm run database:migrate` and rebuild/restart the application. ## Model Context Protocol (experimental) The _Model Context Protocol_ (MCP) server lets an AI client read your portfolio and import activities into it. ### Prerequisites - Set `ENABLE_FEATURE_MCP` to `true` - Set `ROOT_URL` to the public URL of your instance if a client calls the endpoint from a browser page. The host name of `ROOT_URL` is the only accepted origin. - Grant an access of the type _MCP_ in _My Ghostfolio_ under _Access_ and copy its token An _MCP_ access with the _Restricted view_ permission reads the portfolio without the monetary values. Grant the _View_ permission to let the client also read the monetary values. Grant the _Restricted view and manage_ or the _View and manage_ permission to let the client also import activities. ### Connect a client Point the client to the endpoint below and set the MCP access token as the _Bearer Token_. ``` POST http://localhost:3333/mcp "Authorization": "Bearer " ``` ## Community Projects Discover a variety of community projects for Ghostfolio: https://github.com/topics/ghostfolio Are you building your own project? Add the `ghostfolio` topic to your _GitHub_ repository to get listed as well. [Learn more โ†’](https://docs.github.com/en/articles/classifying-your-repository-with-topics) ## Contributing Ghostfolio is **100% free** and **open source**. We support an active and healthy community and welcome contributions from everyone, including you. Not sure what to work on? We have [some ideas](https://github.com/ghostfolio/ghostfolio/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22%20no%3Aassignee), even for [newcomers](https://github.com/ghostfolio/ghostfolio/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22%20no%3Aassignee). Please join the Ghostfolio [Slack](https://join.slack.com/t/ghostfolio/shared_invite/zt-vsaan64h-F_I0fEo5M0P88lP9ibCxFg) channel or post to [@ghostfolio\_](https://x.com/ghostfolio_) on _X_. We would love to hear from you. ## Sponsors If you like to support this project, get [**Ghostfolio Premium**](https://ghostfol.io/en/pricing), become a [**Sponsor**](https://github.com/sponsors/ghostfolio) or [**Buy me a coffee**](https://www.buymeacoffee.com/ghostfolio).
## License ยฉ 2021 - 2026 [Ghostfolio](https://ghostfol.io) Licensed under the [AGPLv3 License](https://www.gnu.org/licenses/agpl-3.0.html). [^1]: Available with [**Ghostfolio Premium**](https://ghostfol.io/en/pricing).