Hosting
Running on Neon Postgres
Use a Neon serverless PostgreSQL database for Umami, with a pooled connection string for the app and a direct connection for migrations.
Neon is a fully-managed serverless PostgreSQL service.
Setup#
- Create a project on Neon with a given name in a region close to where you will be hosting your Umami project.
- You can also create a Neon project with the Neon CLI:
pnpm dlx neonctl projects create. The connection string will be printed to the console.
- You can also create a Neon project with the Neon CLI:
- Get the database connection string with pooled connection enabled. It should look something like this:
postgresql://user:[email protected]/neondb.- You can also get the connection string with the Neon CLI:
pnpm dlx neonctl connection-string --project-id <project-id> --pooled.
- You can also get the connection string with the Neon CLI:
- Important: add
?pgbouncer=true&connect_timeout=10to the connection string you just copied. - Add
DATABASE_URLto your.envfile: - Add
DIRECT_DATABASE_URLto your.envfile with the direct (non-pooled) connection string. Umami uses it to run database migrations, which should not go through the pooler. This is supported from v3.2.0. You can get it from the Neon dashboard or withpnpm dlx neonctl connection-string --project-id <project-id>. - Add the required
APP_SECRETto your.envfile. Generate the value withopenssl rand -hex 32. See APP_SECRET. - Build Umami with
pnpm build. The first build checks the database connection and creates the required tables. - Follow the Quickstart guide starting from the Login step and be sure to change the default password.