Databases
A Project database gives related Services one private data store without a separate provisioning workflow. When Tokay detects a supported database connection in the code, we create the resource, generate its credentials, and deliver the connection through the environment variable the application already reads.
Last updated
AI agent? Start with llms.txt.
Tokay supports Postgres, MySQL, MongoDB, and Redis.
The database is created with the first deployment
A connection such as DATABASE_URL or a Redis client appears on the Service's Environment tab before deployment. Review the detected resource and variable name, then deploy the Service.
Tokay creates the database inside the Project and supplies credentials in the format expected by the application's database library. The value is managed as infrastructure rather than copied into source or entered by hand.
Related Services can share data
When several Services are part of the same application, they can use the same database and work with the same data. A web app, background worker, and scheduled job can share that database while Tokay supplies the connection details through the environment variables each one expects.
Your Project can have one managed resource for each supported engine, and a Postgres, MySQL, or MongoDB resource can hold separate named databases when one part of the app needs its own data. Each Service connects to the database it uses, while a Redis resource provides one data store for the Project.
See How Tokay is organized for deciding which Services should share a Project.
The Resources tab is the database workspace
Open the Project's Resources tab to inspect and manage its databases. Postgres and MySQL provide a SQL console, Redis accepts commands, and MongoDB accepts queries in the browser.
Password rotation happens from the same page. Tokay keeps the previous version so you can revert if a Service still depends on it.
Import an existing PostgreSQL, MySQL, or MongoDB database
If you want to import existing PostgreSQL, MySQL, or MongoDB data, you can do it from the Project's Resources tab by choosing Import database and uploading the dump. Redis data can be exported in its native format but not imported.
Your active data stays untouched while Tokay validates the dump in isolation. If the destination database is empty, Tokay loads the validated dump before the next deploy starts your Services. For an existing database, your confirmation starts a maintenance window while we stop the connected Services and replace the data.
Postgres extensions use normal migrations
Extensions such as pgvector and PostGIS work without a separate setup path. Add ordinary create extension SQL to your app migration, then deploy.
Tokay's managed Postgres runs PostgreSQL 18.3 and supports its bundled trusted extensions, plus pgvector 0.8.5 and PostGIS 3.6.4. Extensions belong to one logical database, and migrations remain the source of truth for database schema.
Exports keep the data portable
A native export creates a standard engine specific dump for each logical database. Postgres, MySQL, and MongoDB also support a ZIP of per table or per collection CSV files. Redis uses native export because its data does not have a table shape.
These formats can be downloaded from the Resources tab and used outside Tokay.
Project databases are private by design
Only Services in the Project can reach its databases over the private network. There is no public database port for outside clients to scan or connect to.
Use the query console or an export when you need the data locally. For ongoing external access, deploy an authenticated API or admin Service in the Project. Direct connections from tools such as psql or TablePlus are not available.
An external database can supply the same variable
Store an external database URL as a Project Secret using the name the code reads, such as DATABASE_URL. Choose Project Config only when the full value contains no credentials or sensitive network details. When that name conflicts with the built in database connection, Tokay shows both sources and asks which one the Service should use.
Schema changes follow the deployment safety model
Migrations are rehearsed against a copy before they reach production, every managed database is snapshotted before a migration runs against it, and destructive changes can require approval. See Database migrations for the full workflow.