@frenix-labs/filybase
v1.0.0
Published
Official FilyBase client SDK — Auth, Database, and Edge Functions
Maintainers
Readme
@frenix-labs/filybase
Official client SDK for FilyBase — Auth, Database, and Edge Functions in one package.
Install
npm install @frenix-labs/filybaseQuick Start
import { createFilybase } from '@frenix-labs/filybase'
const fily = createFilybase({
url: 'https://filybase.io/api',
projectId: 'my-project',
anonKey: 'fb_anon_...'
})Authentication
// Sign up
const { data, error } = await fily.auth.signUp({
email: '[email protected]',
password: 'securepass123',
name: 'Jane Doe'
})
// Sign in
const { data } = await fily.auth.signIn({
email: '[email protected]',
password: 'securepass123'
})
// Get user
const { data: user } = await fily.auth.getUser(data.accessToken)
// Sign out
await fily.auth.signOut(data.refreshToken)Database
// Select with filters
const { data } = await fily.db
.from('todos')
.eq('status', 'active')
.order('created_at', 'desc')
.limit(20)
.select()
// Insert
await fily.db.from('todos').insert({ title: 'Buy milk', done: false })
// Update
await fily.db.from('todos').eq('id', '5').update({ done: true })
// Delete
await fily.db.from('todos').eq('id', '5').delete()
// Raw SQL
await fily.db.query('SELECT * FROM todos WHERE user_id = $1', ['abc'])Edge Functions
const { data } = await fily.functions.invoke('send-email', {
body: { to: '[email protected]', subject: 'Hello' }
})Auth Client (Browser)
For browser apps with auto-refresh and session persistence:
import { createFilyAuth } from '@frenix-labs/filybase/auth'
const auth = createFilyAuth({
baseUrl: 'https://filybase.io/api/auth/my-project',
anonKey: 'fb_anon_...'
})
await auth.signUp({ email, password, name })
await auth.signIn({ email, password })
const user = await auth.getUser()
await auth.signOut()