Hangar runs databases next to your apps, in the same project and region. You create one from the dashboard and it is ready in seconds.
Engines
- PostgreSQL
- MySQL
- MariaDB
- MongoDB
- Redis
- libSQL
Create a database
In a project, add a service and pick the database engine. Choose the region; put the database in the same region as the app that uses it, so they talk over the private network.
Hangar generates the credentials. You do not need to pick a password.
Connect your app
Open the database and copy its internal connection URL. It points at the database's private hostname, which is reachable only from your other services.
Save that URL as a variable of your app, usually DATABASE_URL or REDIS_URL. If several services use the same database, store it once as an environment variable and reference it from each service:
DATABASE_URL=${{environment.DATABASE_URL}}
Environment variables explains references.
Traffic between your services and their databases stays on the private network and is never billed as egress.
To reach a database from outside Hangar, from your machine or a BI tool, turn on public networking. Connect to a database from outside explains how.
Backups
PostgreSQL, MySQL and MariaDB can be recovered to any second of their history with point-in-time recovery, where your plan includes it. Any engine except Redis can also be backed up on a schedule to an S3-compatible bucket of yours. Backups and point-in-time recovery covers both.
What you pay for
A database is metered like any other service: the CPU and memory it uses, and the storage of its volume. There is no separate database plan. See Pricing for the current rates.