@afribase/afribase-js
v0.2.1
Published
The official JavaScript/TypeScript client for Afribase — Auth, Database, Realtime, Storage, and Edge Functions
Maintainers
Readme
Afribase JS SDK
The official JavaScript/TypeScript client for Afribase.
Installation
npm install @afribase/afribase-jsUsage
Initializing the Client
import { createClient } from '@afribase/afribase-js';
const afribase = createClient('http://your-afribase-url.com', 'your-anon-key');Authentication
// Sign up
const { user, error } = await afribase.auth.signUp({
email: '[email protected]',
password: 'password123'
});
// Sign in
const { access_token, error } = await afribase.auth.signIn({
email: '[email protected]',
password: 'password123'
});
// Get current user
const user = await afribase.auth.getUser();Working with Data
// Fetch data
const posts = await afribase.from('posts').select();
// Insert data
const newPost = await afribase.from('posts').insert({
title: 'Hello Afribase',
content: 'Building faster in Africa'
});License
Apache-2.0
