Skip to content

dotlabshq/flect-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@flect/sdk

TypeScript SDK for Flect — access databases, KV stores, and object storage from your app.

Install

npm install @dotlabshq/flect-sdk

Usage

import { createEnv } from '@flect/sdk'

const env = createEnv()

// Database (SQLite via sqld)
const db = env.db('DB')
const users = await db.query('SELECT * FROM users WHERE id = ?', [id])
await db.execute('INSERT INTO users (id, name) VALUES (?, ?)', [id, name])

// KV store (Valkey/Redis-compatible)
const cache = env.kv('CACHE')
await cache.set('session:abc', token, { ttl: 3600 })
const val = await cache.get('session:abc')

// Object store (S3-compatible via Garage)
const storage = env.store('STORAGE')
await storage.put('avatars/alice.png', buffer, { contentType: 'image/png' })
const url = await storage.presignedPut('uploads/photo.jpg', { expiresIn: 300 })

Bindings are configured in flect.toml and env vars are injected automatically at deploy time.

Docs

flect.run/docs

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors