Data, files, and execution services
The SDK gives React Native applications one service layer for structured data, vector search, file content, remote function runs, and GraphQL operations. Each service uses the configured Client and returns a promise for a resource, an API result, or binary content.
Service landscape
The services cover different kinds of application work. Databases hold records, VectorsDB supports similarity search, Storage holds files, Functions runs server-side work, and GraphQL provides a query-shaped path to Appwrite.
These services stay separate because each resource has its own life cycle. An application can save a file ID in a row, search vector data for related content, start a Function after a user action, or use GraphQL when it needs a custom response shape.
The main relationships are shown below.
flowchart LR
App[React Native application] --> D[Databases and TablesDB]
App --> V[VectorsDB]
App --> S[Storage]
App --> F[Functions]
App --> G[GraphQL]
D --> R[Documents and rows]
V --> Q[Similarity results]
S --> B[File content and metadata]
F --> E[Execution records]
G --> A[Appwrite API result]
Service entry points
The public SDK exports Databases, DocumentsDB, TablesDB, VectorsDB, Storage, Functions, and Graphql as separate service entry points. Each service receives the same configured Client, so an application can choose a resource API without changing its project connection. src/index.ts
Resource IDs connect calls across services. A database plus collection or table selects data, a bucket selects file space, and a function selects remote code. The services check required IDs before they send a request. src/…/documents-db.ts, src/…/tables-db.ts, src/…/storage.ts, src/…/functions.ts
References: src/index.ts• L1-18 src/…/documents-db.ts• L543-712 src/…/tables-db.ts• L543-713 src/…/storage.ts• L20-168 src/…/functions.ts• L17-158
Application records
The record services persist application state. They support list, read, create, replace or update, delete, and numeric update actions. They also let applications stage related changes in a transaction before commit or rollback.
Databases and TablesDB
DocumentsDB exposes document records through databases and collections. TablesDB exposes row records through databases and tables. Both services support queries, permissions, and transaction-aware reads and writes. src/…/documents-db.ts, src/…/tables-db.ts
Databases still exposes the older document API for compatibility. Its document and transaction methods are deprecated in favor of the newer record services. src/…/databases.ts, src/…/databases.ts
Use the child page Databases and TablesDB records for the record model, CRUD choices, numeric updates, caching behavior, and transaction flow.
References: src/…/documents-db.ts• L543-712 src/…/tables-db.ts• L543-713 src/…/databases.ts• L16-24 src/…/databases.ts• L549-562
Record transactions
A record transaction groups staged operations under one transaction ID. The document, row, and vector services can create or list transactions, add operations, inspect a transaction, and finish it by commit or rollback. src/…/documents-db.ts, src/…/tables-db.ts, src/…/vectors-db.ts
The same transaction ID can be passed to record reads and writes. This lets an application read its uncommitted changes while it prepares the final result. A transaction is not durable until the application commits it. src/…/documents-db.ts, src/…/tables-db.ts, src/…/vectors-db.ts
References: src/…/documents-db.ts• L16-541 src/…/tables-db.ts• L16-541 src/…/vectors-db.ts• L16-541 src/…/documents-db.ts• L543-712 src/…/tables-db.ts• L543-713 src/…/vectors-db.ts• L543-712
Vector data
Vector documents and queries
The VectorsDB service stores document-like records for vector-aware workloads. It adds a query path for finding related content by similarity instead of only matching exact field values.
Vector data uses the same broad record life cycle as other data services. Its query operation accepts larger query input in the request body, and vector reads and writes can use transactions. src/…/vectors-db.ts, src/…/vectors-db.ts
Use the child page VectorsDB documents and queries for the vector document model and query flow.
References: src/…/vectors-db.ts• L543-712 src/…/vectors-db.ts• L910-1082 src/…/vectors-db.ts• L16-541
File content
Storage file lifecycle
Storage keeps binary content separate from structured records. It manages file metadata and permissions while download, view, and preview actions return content for different application uses.
The Storage API covers the file life cycle from upload to removal. Applications can list files, upload a React Native file input, read metadata, change the file name or permissions, and delete the file. They can also request raw content as a download, displayable view, or transformed preview, or build URLs for those file responses. src/…/storage.ts, src/…/storage.ts, src/…/storage.ts, src/…/storage.ts
The upload API reports progress and supports resuming a large upload from a known file identity. The SDK divides large files into chunks and manages the upload state for the caller. This keeps the application focused on the file input and progress display while Storage completes the file. src/…/storage.ts
Use the child page Storage file lifecycle for the full upload, retrieval, preview, deletion, and URL-building flow.
References: src/…/storage.ts• L20-168 src/…/storage.ts• L170-246 src/…/storage.ts• L287-566 src/…/storage.ts• L568-875 src/…/storage.ts• L877-1239 src/…/storage.ts• L1346-1557
Remote execution and API queries
Functions and GraphQL extend the SDK beyond direct record and file access. Functions move work to Appwrite and expose an execution record. GraphQL lets an application send a caller-defined query or mutation and receive the result from the same project.
Function executions
The Functions service starts a remote execution with a function ID and optional request data. The caller can provide an HTTP body, path, method, headers, background execution, or a future schedule. The service returns an execution record that represents the remote run. src/…/functions.ts
Execution state is observable after the run starts. The service lists executions for a function and retrieves one execution by ID. These records provide the run status, response details, logs, errors, and timing data needed to inspect the work. src/…/functions.ts, src/…/functions.ts
References: src/…/functions.ts• L17-158 src/…/functions.ts• L160-358 src/…/functions.ts• L360-479
GraphQL operations
The GraphQL service sends a caller-provided GraphQL document to Appwrite. query sends a read operation and mutation sends a write operation. Both require a query value and return the Appwrite API result. src/…/graphql.ts, src/…/graphql.ts
GraphQL is useful when one request needs a response shape that does not map cleanly to one resource call. It remains a request to the configured Appwrite project, so it follows the shared client request and error behavior.
Use the child page Functions and GraphQL for execution inputs, execution inspection, and GraphQL request results.
References: src/…/graphql.ts• L10-129
Cross-service resource flow
Applications often combine these services. A common flow stores a file in Storage, saves its file ID with business data, searches vector data for related content, and starts a Function for server-side processing.
The sequence below shows how resource IDs connect the services. GraphQL can replace a direct read when the application needs a custom response shape.
sequenceDiagram
participant App as React Native app
participant Storage as Storage
participant Data as DocumentsDB or TablesDB
participant Vector as VectorsDB
participant Function as Functions
participant GraphQL as GraphQL
App->>Storage: Upload file
Storage-->>App: File metadata and file ID
App->>Data: Save record with file ID
Data-->>App: Record or row
App->>Vector: Search related vectors
Vector-->>App: Similarity results
App->>Function: Start remote execution
Function-->>App: Execution record
App->>GraphQL: Request shaped data
GraphQL-->>App: API result
The SDK does not merge these resources into one model. The application owns the links between them and chooses which result is the source of truth for its current workflow.
References: src/…/storage.ts• L170-246 src/…/documents-db.ts• L714-908 src/…/tables-db.ts• L715-899 src/…/vectors-db.ts• L714-908 src/…/functions.ts• L160-358 src/…/graphql.ts• L10-68
Change checklist
When these files or sections are changed, remember to consider these:
- When document or row resource names change, check
DocumentsDB,TablesDB, and the deprecatedDatabasescompatibility surface together. - When transaction inputs change, check transaction creation, staged operations, transaction-aware reads and writes, and commit or rollback behavior in DocumentsDB, TablesDB, and VectorsDB.
- When list cache controls change, check callers that need fresh document, row, or vector results because writes do not invalidate cached list responses.
- When a file ID or permission contract changes, check records that store file references and all download, view, preview, and URL access paths.
- When upload progress, resume identity, chunk completion, or upload state changes, keep the file input, upload state, and progress display aligned.
- When Function execution inputs or status fields change, check both execution creation and execution inspection because the first response is not the complete run result.
- When GraphQL request handling changes, keep query and mutation paths aligned with the shared project and request contract.
- When a service is added or renamed, update the public export and the related child-page links together.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A required database, table, collection, row, bucket, file, function, or execution ID is missing | The service rejects the call before it produces a resource result | Supply the IDs required by the selected service action |
| A list request uses a non-zero cache lifetime after a record write | The application can receive stale documents, rows, or vector records | Disable the cache or choose a lifetime that matches the required freshness |
| A large file upload loses its upload identity or chunk state | Later chunks can start a new upload or fail to complete the file | Keep the file input stable and let the Storage upload flow manage resumable state |
| A caller uses a file URL helper where file content is required | The caller receives a URL instead of downloaded or viewable binary content | Choose the content method when the application must read the response itself |
| A Function runs in the background or on a schedule | The initial response does not contain the final function output | Use the returned execution ID with execution inspection calls |
| A GraphQL document is missing or sent to the wrong operation path | Appwrite rejects the request or returns an operation error | Send reads to query and writes to mutation with a valid query value |
| A record or vector write is staged in a transaction that is never committed | The intended change does not become durable | Track the transaction ID and explicitly commit or roll back it |
Key files
| File | Why to read it |
|---|---|
| src/index.ts | Shows the public data, file, execution, and GraphQL service entry points. |
| src/…/documents-db.ts | Shows the current document API and document transaction boundary. |
| src/…/tables-db.ts | Shows the current row API and row transaction boundary. |
| src/…/databases.ts | Shows the older document API that remains for compatibility. |
| src/…/vectors-db.ts | Shows vector records, larger query input, and vector transactions. |
| src/…/storage.ts | Shows the file life cycle, resumable upload progress, binary results, previews, and response URLs. |
| src/…/functions.ts | Shows how remote function runs are started and inspected. |
| src/…/graphql.ts | Shows the read and write GraphQL entry points. |