Self-host OpenStock on a managed VPS: your own market dashboard

To self-host OpenStock on a managed VPS is to keep your accounts, watchlists and alerts on a server of your own, which our teams keep up to date and monitor day and night. OpenStock is a free, open source alternative to paid market platforms, under the AGPL-3.0 license, built by the Open Dev Society. This guide follows its official Docker Compose file and prebuilt image at release v2026.11.22, and we ran every command on a Simafri VPS before writing it: installation with MongoDB, HTTPS, the first account, the API keys, backups and updates.

Simon Vasconcelos Lee By Published on 3 December 202612 minute read

All guides CRM, ERP and finance

In short

  1. The AGPL-3.0 license lets you run OpenStock for yourself, your team or your clients with no license to buy; the market data comes from Finnhub, whose free key is enough to start.
  2. Install it with Docker Compose: the prebuilt image ghcr.io/open-dev-society/openstock and MongoDB 7, with port 8120 published on 127.0.0.1 behind an HTTPS reverse proxy.
  3. Put the MongoDB password, MONGODB_URI, BETTER_AUTH_SECRET and your public address in a .env file; scripts/check-env.mjs tells you what is still missing.
  4. The pages and accounts work without any key. Quotes, search and the watchlist prices need a Finnhub key; emails, price alerts and the weekly digest need Inngest, an email account and an AI key.
  5. Back up with mongodump and a copy of compose.yaml and .env. To update, change the image tag, then pull and recreate the container.

What OpenStock does

OpenStock is a web application written with Next.js and React, which stores its accounts and watchlists in MongoDB. It follows markets with charts embedded from TradingView and quotes, company data and news from Finnhub.

Quotes are refreshed every hour in the default cached mode, shared by every user of your instance. The realtime mode refreshes them every 15 seconds and turns on price alerts; it is fixed when the application is built, so it means building the image yourself instead of using the prebuilt one.

What the AGPL-3.0 license allows

OpenStock is published under the GNU Affero General Public License, version 3 (AGPL-3.0). You can use it free of charge, for yourself, your company or your clients, copy it and modify it. Its particularity is the network clause: if you modify OpenStock and let people use it over a network, you offer them the source code of your version, under the same license. Its README also asks you to credit the original authors. The software is provided without warranty.

The data services it connects to have their own terms: Finnhub, Inngest, your email provider and the AI provider you choose. Their free tiers are enough to try every feature.

The resources to plan for

Here is what we measured on our test VPS, with 2 vCPU and 4 GB of memory, after the installation, an account and a watchlist:

Server size therefore depends on the number of users and on the other applications you run beside OpenStock. On a managed VPS, tell us about your usage and we will recommend the right size.

Installing with Docker Compose

OpenStock publishes a docker-compose.yml that runs the application and MongoDB together, and a prebuilt image on GitHub Container Registry, for x86-64 and ARM64. On a server with Docker Engine and its Compose plugin, installed from Docker’s repository for Ubuntu, create the folder of the instance:

Terminal
mkdir -p /opt/openstock

Put this compose.yaml in it. It is the official file, with the prebuilt image in place of the build, as the README describes:

compose.yaml
services:
  openstock:
    image: ghcr.io/open-dev-society/openstock:2026.11.22
    ports:
      - "127.0.0.1:8120:3000"
    env_file:
      - .env
    restart: unless-stopped
    depends_on:
      mongodb:
        condition: service_healthy

  mongodb:
    image: mongo:7
    restart: unless-stopped
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD:?set MONGO_ROOT_PASSWORD in .env}
    volumes:
      - mongo-data:/data/db
    healthcheck:
      test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping')"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  mongo-data:

The settings go in a .env file next to it, which Docker Compose reads for the MongoDB password and passes whole to the application. Create it readable by root only, with your address in BETTER_AUTH_URL, then start the stack:

Terminal, in /opt/openstock
umask 077
P=$(openssl rand -hex 24)
printf 'MONGO_ROOT_PASSWORD=%s\nMONGODB_URI=mongodb://root:%s@mongodb:27017/openstock?authSource=admin\nBETTER_AUTH_SECRET=%s\nBETTER_AUTH_URL=https://openstock.example.com\nFINNHUB_API_KEY=\n' "$P" "$P" "$(openssl rand -hex 32)" > .env
umask 022
docker compose up -d
docker compose ps

On our test VPS, OpenStock answered within a few seconds of its container starting. To check that it is ready, and which settings are still missing:

Terminal, in /opt/openstock
until curl -sf -o /dev/null http://127.0.0.1:8120/sign-in; do sleep 5; done
curl -s http://127.0.0.1:8120/sign-in | grep -o -E '<title>[^<]*</title>'
docker compose exec -T openstock node scripts/check-env.mjs

The second command returns <title>OpenStock</title>. The checker lists each variable, with the first and last characters of its value only, and ends on “3/4 required variables present” and “1 critical variable(s) are missing”: the Finnhub key, which we come to below. Once the key is set, it reads “4/4”.

HTTPS: the reverse proxy

The container serves OpenStock over HTTP, on port 8120 of the server. HTTPS is handled by a reverse proxy in front of it. We tested Caddy, installed from its official Debian and Ubuntu repository: it obtains the Let’s Encrypt certificate itself, renews it, and forwards the Host header and X-Forwarded-* headers by default.

/etc/caddy/Caddyfile
openstock.example.com {
	reverse_proxy 127.0.0.1:8120
}
Terminal
systemctl reload caddy

The first account

Open your address and choose Sign up. The form asks for your name, email and password, at least 8 characters, then your country, investment goals, risk tolerance and preferred industry, which OpenStock keeps on your profile and uses for the welcome email. Once the account is created, you are signed in.

On our test VPS, we created the account through the sign-up endpoint of Better Auth, the one the form calls, then signed in again: the session opened the dashboard and the watchlist, while a visitor without a session was sent to the sign-in page. We added Apple to the watchlist, and it was there on the watchlist page and in MongoDB.

Sign-up is open to anyone who reaches your address: OpenStock has no setting to close it. The form limits sign-ups to five an hour per address. If the instance is for you or your team only, keep its address private, or put an access control in front of it at the reverse proxy.

API keys: what each one unlocks

Without any key, OpenStock serves its pages, creates accounts and saves watchlists; the charts come from TradingView, in the browser. Its log then shows “No Finnhub API key configured” for each quote it could not fetch. Each key goes on its own line in .env, after the = sign; then recreate the container, which reads the file again, and run the checker:

Terminal, in /opt/openstock
docker compose up -d
docker compose exec -T openstock node scripts/check-env.mjs

On our test VPS, a value added to .env was in the container after docker compose up -d, which recreated it, and gone once removed. We created no key with these services: the features behind them are described from the official documentation.

Backups

Everything lives in two places: the MongoDB database, and your compose.yaml and .env files. Keep the latter safe: it holds the database password, the session secret and your keys. The MongoDB image includes mongodump:

Terminal, in /opt/openstock
umask 077
docker compose exec -T mongodb sh -c 'exec mongodump -u root -p "$MONGO_INITDB_ROOT_PASSWORD" --authenticationDatabase admin --db openstock --archive --gzip' > openstock-$(date +%F).archive.gz
tar -czf config-$(date +%F).tar.gz compose.yaml .env
umask 022

The dump reads the database password inside the container, so it never appears on the command line, and umask 077 makes both files readable by root only. Schedule this copy and send it off the server. Stored on the disk, the files are also included in the server’s nightly backups.

Restoring

On a new server, or after losing the instance, put the two files back in /opt/openstock, start MongoDB alone, load the dump, then start OpenStock:

Terminal, in /opt/openstock
BACKUP_DATE=2026-12-03
(
  set -e
  for f in config-$BACKUP_DATE.tar.gz openstock-$BACKUP_DATE.archive.gz; do
    test -s "$f" || { echo "Missing or empty: $f"; exit 1; }
  done
  tar -xzf config-$BACKUP_DATE.tar.gz
  docker compose up -d --wait mongodb
  docker compose exec -T mongodb sh -c 'exec mongorestore -u root -p "$MONGO_INITDB_ROOT_PASSWORD" --authenticationDatabase admin --nsInclude "openstock.*" --drop --stopOnError --archive --gzip' < openstock-$BACKUP_DATE.archive.gz
  docker compose up -d
)

Set BACKUP_DATE, on the first line, to the date in the names of the backup you restore, as listed by ls. The commands run in parentheses with set -e, which stops them at the first error. They first check that each file exists and is not empty, before anything is stopped, removed or overwritten: a wrong date stops there, with your data untouched, and a failed step stops every step after it, so the application is never started again on a partial restore.

With --stopOnError, mongorestore stops at the first error and returns a non-zero code; --drop replaces each collection that already exists. We tested the whole cycle on our VPS: dump and archive, then docker compose down -v and the two files deleted, the database volume gone with them. A date with no backup stopped before anything started. A dump cut short was refused, with exit code 1, nothing restored and OpenStock not started. The full dump brought back the five documents, the account signed in again with the same password, and Apple was back in its watchlist.

Updates

OpenStock publishes a release every few weeks, named after its date, and its notes list what changed. Every release and every change on the main branch builds a new image. This guide pins release v2026.11.22, the most recent when we tested it: check the releases page, and the tags of the image, before you install. Take a backup, change the image tag in compose.yaml, then pull the new image and recreate the container:

Terminal, in /opt/openstock
docker compose pull
docker compose up -d
docker compose images openstock

Who does what on a managed VPS

Self-hosting means running the server on top of the application. On a managed VPS, our teams take charge of the server and proactively monitor your instance; OpenStock remains your software, with your data and your keys.

TopicOur teamsYou
The serverSystem and security updates, server interventions includedThe timing that suits you
MonitoringServer monitored 24/7, with intervention without waiting for your callYour accounts, watchlists and alerts in OpenStock
OpenStockProactive monitoring: errors, slowdowns, database and disk space spotted, fix recommendedIts installation, updates, keys and settings, which you apply, yourself or through your AI assistant
UsersThe server that carries them, monitored and backed upWho signs up, and how the address is shared
BackupsEvery night, encrypted and kept off the machine; restores includedOpenStock’s own database dumps, and the restore request, when you need one
MigrationYour current server migrated, free of chargeThe timing of the switch

If you would rather have our teams work inside the application itself, that service is billed by the hour or at a fixed rate, with an estimate shared before the work starts.

OpenStock, on a server run for you

With a Simafri Managed VPS, our teams keep your OpenStock instance’s server up to date, monitor it day and night and step in without waiting for your call; they also proactively monitor your instance and recommend useful fixes, which you apply, yourself or through your AI assistant. Backups are encrypted every night and kept off the machine, restores are included, and migrating your current server is free.

Explore Managed VPS

Frequently asked questions

Is OpenStock free?

Yes. OpenStock is under the AGPL-3.0 license: you can run it for yourself, your team or your clients with no license to buy. If you modify it and let people use it over a network, you offer them your source code. The data services have free tiers, and what remains is the cost of the server.

How do I install OpenStock with Docker Compose?

Use the official docker-compose.yml with the prebuilt image ghcr.io/open-dev-society/openstock at a release tag and MongoDB 7. Put MONGO_ROOT_PASSWORD, MONGODB_URI with the same password, BETTER_AUTH_SECRET and BETTER_AUTH_URL in a .env file, publish its port on 127.0.0.1, run docker compose up -d, and put an HTTPS reverse proxy in front.

Does OpenStock work without a Finnhub API key?

Partly. On our test VPS, the pages, sign-up, sign-in and the watchlist worked without any key, and the charts come from TradingView. Quotes, search, company data and the watchlist prices need a Finnhub key, free at finnhub.io, set in FINNHUB_API_KEY in .env.

Which tag of the OpenStock image should I use?

A release tag, never latest, which follows the main branch. Releases are tagged by version, such as 2026.11.22, and every image by commit. Release v2026.11.09 was published under its commit tag sha-fe2cbde only: check the releases page and the registry for the newest one.

How much memory does OpenStock need?

Little. On our test VPS, the OpenStock container used about 200 to 250 MB and MongoDB 80 to 210 MB, and the two images take about 2.9 GB of disk. A small VPS is enough to start.

How do I back up OpenStock in Docker?

Dump the openstock database with mongodump from the MongoDB container, in an archive, and keep a copy of compose.yaml and .env. Restore with mongorestore --drop --stopOnError into MongoDB started alone, then start OpenStock.

How do I update OpenStock in Docker?

Take a backup, change the image tag in compose.yaml to the new release, then run docker compose pull and docker compose up -d. MongoDB keeps the data: our update from v2026.11.09 to v2026.11.22 needed no migration step.

Does a managed VPS cover OpenStock?

A managed VPS covers the server: system, security, monitoring and backups. Our teams also proactively monitor your instance and recommend useful fixes, which you apply. Work inside the application is billed by the hour or at a fixed rate.

Contact us