Getting Started with Cocobase
Welcome to Cocobase! This guide will help you set up and make your first API call in just a few minutes.Prerequisites
Before you begin, make sure you have:- A Cocobase account - Sign up for free
- An API key from your project dashboard
- Your development environment set up for your preferred language
Installation
Choose your language and install the Cocobase SDK:- JavaScript
- Dart
- Go
- Python
- HTTP
npmyarnpnpm
Configuration
Initialize Cocobase with your API key:- JavaScript
- Dart
- Go
- Python
- HTTP
Your First Request
Let’s create a document in a collection called “users”:- JavaScript
- Dart
- Go
- Python
- HTTP
Reading Data
Now let’s retrieve the document we just created:- JavaScript
- Dart
- Go
- Python
- HTTP
Environment Variables
For security, always use environment variables for your API key:- JavaScript
- Dart
- Go
- Python
- HTTP
Create a
.env.local file:Next Steps
Now that you’ve made your first request, explore these features:Authentication
Add user registration and login to your app
Query & Filtering
Learn to filter and search your data
Real-time Updates
Subscribe to live data changes
File Storage
Upload and manage files
Common Issues
Authentication Error: Invalid API Key
Authentication Error: Invalid API Key
Make sure your API key is correct and active. You can find it in your Cocobase dashboard.
CORS Error in Browser
CORS Error in Browser
Add your domain to the allowed origins in your Cocobase project settings.
TypeScript Types Not Working
TypeScript Types Not Working
Make sure you’re using TypeScript 4.5+ and have
@types/node installed.Need Help?
- Join our Discord community
- Check out code examples
- Email us at hello@cocobase.cc
