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#

  1. 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.
  2. 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.
  3. Important: add ?pgbouncer=true&connect_timeout=10 to the connection string you just copied.
  4. Add DATABASE_URL to your .env file:
  5. Add DIRECT_DATABASE_URL to your .env file 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 with pnpm dlx neonctl connection-string --project-id <project-id>.
  6. Add the required APP_SECRET to your .env file. Generate the value with openssl rand -hex 32. See APP_SECRET.
  7. Build Umami with pnpm build. The first build checks the database connection and creates the required tables.
  8. Follow the Quickstart guide starting from the Login step and be sure to change the default password.