learn
If you don't have any context provided about InstantDB, use this tool to learn about it!
get-schema
Fetch schema for an app by its ID!
get-perms
Fetch permissions for an app by its ID
push-schema
Push local schema changes for an app to the server. Do this after updating your local 'instant.schema.ts' file.
If you don't have an instant.schema.ts file yet, use the get-schema tool to learn how to get this file.
push-perms
Push local permissions changes for an app to the server. Do this after updating your local instant.perms.ts file.
If you don't have an instant.perms.ts file yet, use the get-perms tool to learn how to get this file.
query
Execute an InstaQL query against an app. Returns the query results as JSON.
Example query to fetch all goals and their todos:
{"goals": {"todos": {}}}
Example query with a where clause:
{"goals": {"$": {"where": {"status": "active"}}, "todos": {}}}
If you're unsure how to write queries, refer to the documentation:
https://instantdb.com/docs/instaql
transact
Execute a transaction against an app. Useful for creating, updating, or deleting data.
Steps use the internal transaction format:
- Create/update: ["update", "namespace", "entity-id", {"attr": "value"}]
- Link: ["link", "namespace", "entity-id", {"linkAttr": "target-id"}]
- Unlink: ["unlink", "namespace", "entity-id", {"linkAttr": "target-id"}]
- Delete: ["delete", "namespace", "entity-id"]
Example steps to create a todo:
[["update", "todos", "a-uuid", {"title": "Get fit", "done": false}]]
If you're unsure how to make transactions, refer to the documentation:
https://instantdb.com/docs/instaml