Databases
Databases give StackMachine apps durable application state for records, user data, queues, and product workflows. Create a database for an app, store the returned credentials securely, and rotate credentials whenever access changes.
Features
Per-app databases
Create databases against an app ID and list the databases attached to that app. The SDK returns host, port, username, and explorer URLs where available.
Engine selection
The JavaScript SDK accepts POSTGRES, MYSQL, or SQLITE as database engines. Use the engine that matches your application runtime and migration workflow.
Credentials returned once
Creation and rotation return a plaintext password once. Store it as an environment variable or secret immediately.
Credential rotation
Rotate database credentials from the SDK when replacing secrets or handing ownership to another environment.
Common workflow
- Create the database with the app ID, engine, and name.
- Store the returned password in the app environment.
- List databases to verify the attachment.
- Rotate credentials when access should change.
SDK examples
Create, list, and rotate credentials
Create a Postgres database for an app, inspect the connection fields, list databases, and rotate credentials.
Related docs
Source: stackmachine/sdks JavaScript examples.