Run OpenProfit on your own server
This page shows you how to run OpenProfit in one Docker container and sign in for the first time. It also covers using your own Postgres database and updating. You need Docker.
Start the container
The image stores its data in an embedded Postgres database on a Docker volume, so it needs no other service. Before you start it, generate a secret: OpenProfit uses it to encrypt the provider keys you paste in and to sign sessions.
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
The command prints 32 random bytes encoded as base64. Pass that value as SECRET_KEY when you run the image:
docker run -d \
--name openprofit \
-p 3000:3000 \
-v openprofit_data:/app/data \
-e SECRET_KEY=your_secret_here \
-e APP_URL=http://localhost:3000 \
ghcr.io/morencyr/openprofit:latest
The -v flag keeps your data in the openprofit_data volume when the container is replaced. Set APP_URL to the address people use to reach the instance, because sign-in links point there.
Keep the secret somewhere safe. If you lose it, OpenProfit can’t decrypt the stored provider keys and you’ll have to reconnect every provider.
Sign in for the first time
OpenProfit signs you in with a link sent by email. Open http://localhost:3000/login, enter your email address and click Email me a link.
Without an email provider, the instance writes the link to its log instead of sending it. Print the log and open the link in the same browser:
docker logs openprofit
To send links and the weekly email by mail, set RESEND_API_KEY and EMAIL_FROM and restart the container. The environment variables reference lists every option, including sign-in with GitHub or Google.
Use your own Postgres database
If you already run Postgres, point OpenProfit at it and the embedded database isn’t used. Set DATABASE_URL to a connection string that starts with postgres://:
-e DATABASE_URL=postgres://your_user:your_password@your_host:5432/openprofit
OpenProfit creates and updates its tables on start, so the database only needs to exist.
Update to a new version
Updating replaces the container and keeps the volume, so your data stays. Pull the new image and remove the old container:
docker pull ghcr.io/morencyr/openprofit:latest
docker rm -f openprofit
Then run the docker run command from Start the container again. Schema changes apply when the new container starts.
Deploy on Dokploy
The hosted version at openprofit.dev runs this same image on Dokploy. To do the same:
- In a project, add a Postgres database and deploy it.
- Add an application with the Docker provider and the image
ghcr.io/morencyr/openprofit:latest. - Set
DATABASE_URLto the database's internal connection string, and setSECRET_KEYandAPP_URLas described above. Traefik sits in front, so setTRUST_PROXY=1. - Add your domain with port
3000and HTTPS, then deploy.
To redeploy when a new image comes out, call the deploy webhook from the application's Deployments tab after each push.
Deploy on Railway
To run the image on Railway:
- Create a service from the image
ghcr.io/morencyr/openprofit:latest. - Add a Postgres database to the project.
- Set
DATABASE_URLto the database’s connection string, and setSECRET_KEYandAPP_URLas described above.