Skip to main content

Installation

Find the anon key with npx @insforge/cli secrets get ANON_KEY, or in the dashboard: click Install and open API Keys.

insert()

Insert new records into a table.

Parameters

  • values (object | Array, required) - Data to insert. Single object or array for bulk insert
  • options.count (‘exact’ | ‘planned’ | ‘estimated’, optional) - Include count of inserted rows

Returns

Chain .select() after .insert() to return the inserted data

Examples

Output Example


update()

Update existing records in a table. Must use filters to target specific rows.

Parameters

  • values (object, required) - Fields to update
  • options.count (‘exact’ | ‘planned’ | ‘estimated’, optional) - Include count of updated rows

Returns

Always use filters like .eq() or .in() to specify which rows to update

Examples

Output Example


delete()

Delete records from a table. Must use filters to target specific rows.

Parameters

  • options.count (‘exact’ | ‘planned’ | ‘estimated’, optional) - Include count of deleted rows

Returns

Always use filters to specify which rows to delete

Examples

Output Example


select()

Query records from a table or view.

Parameters

  • columns (string, optional) - Comma-separated column names. Use * for all columns
  • options.count (‘exact’ | ‘planned’ | ‘estimated’, optional) - Include total row count
  • options.head (boolean, optional) - Return only count, no data

Returns

Examples

Output Example


rpc()

Call PostgreSQL stored functions (RPC - Remote Procedure Call).

Parameters

  • functionName (string, required) - Name of the PostgreSQL function to call
  • args (object, optional) - Arguments to pass to the function

Returns

Examples


Filters

Chain filters to narrow down query results. All filters take (column, value) as parameters.

Modifiers

Control how query results are returned.

Common Patterns

Pagination with Count

Output:
Output:

Using with Authentication Hooks

Combine database queries with useUser() or useAuth() hooks to fetch user-specific data:
Key points:
  • Use user.id to filter data for the authenticated user
  • Check isLoaded before accessing user to avoid race conditions
  • Check !user to handle unauthenticated state