Prerequisites
- Complete the Installation guide
- Have a SnackBase instance running with an existing collection
- Have your API URL ready (e.g.,
https://your-project.snackbase.dev)
Step 1: Initialize the Client
Create a new SnackBase client instance with your configuration:For client-side applications, omit the
apiKey parameter. Users will
authenticate with their own credentials.Step 2: Authenticate a User
Email and Password
Register a New User
Step 3: Query Records
List Records
Get a Single Record
Using the Query Builder
For complex queries, use the fluent query builder:Step 4: Create Records
Step 5: Update Records
Full Update (PUT)
Replaces all fields of the record:Partial Update (PATCH)
Updates only the specified fields:Step 6: Delete Records
Step 7: Real-Time Subscriptions
Subscribe to real-time updates for a collection:Complete Example
Here’s a complete example combining all concepts:Next Steps
- Query Builder - Learn advanced querying
- Realtime - Build real-time features
- React Integration - Use with React applications
- Error Handling - Handle errors gracefully