Shared database
Keep customers, products and prices once, read by every app that needs them.
Built on PostgreSQL
Plans: Every plan, including the free app
What you get
- One database that several apps use
- Each app's tables in a schema of its own
- Nothing shared until the owning app grants it
- Access granted and taken back in migrations
- Queries that join data from two apps
- The same backups as any app database
How it works
Each app that should take part sets database: shared:<name> in its whisk.yaml. Every app gets its own schema, a named section of the database, and its own login. Its tables stay private until it grants another app access.
The owning app grants access in one of its migrations with standard PostgreSQL GRANT statements. The other app then reads those tables directly and joins them with its own. There is no copy to keep in step and no nightly sync to watch.
This uses PostgreSQL's own schemas and roles, nothing specific to Whisk. When one app needs another to do something, rather than read its data, use app-to-app calls. For when to split work into separate apps, see what is an app.
Example
A building supplier keeps customer accounts and trade price lists in its pricing app. The quoting app and the delivery booking app both read those tables. A price change made in the morning shows in every quote at once.
For your coding agent
database: shared:core
GRANT USAGE ON SCHEMA <your app schema> TO <other app role>; GRANT SELECT ON ALL TABLES IN SCHEMA <your app schema> TO <other app role>;
whisk apps info <app> --json prints an app's id. Every setting is in the whisk.yaml reference.