edgebase-admin
Trusted server-side Rust SDK for EdgeBase.
Use edgebase-admin from backend services, jobs, workers, and other trusted environments that hold a Service Key. It exposes admin auth, service-key database access, raw SQL, storage, push, functions, analytics, KV, D1, and Vectorize clients.
Documentation Map
Use this README for the fast overview, then jump into the docs when you need depth:
- SDK Overview Install commands and language matrix for all public SDKs
- Admin SDK Service-key concepts, trust boundaries, and admin-only capabilities
- Admin SDK Reference Cross-language auth, database, storage, functions, push, and analytics examples
- Admin User Management Create, update, delete, and manage users with the Service Key
- Database Admin SDK Table queries, filters, pagination, batch writes, and raw SQL
- Storage Uploads, downloads, metadata, and signed URLs
- Push Admin SDK Push send, topic broadcast, token inspection, and logs
- Analytics Admin SDK Request metrics, event tracking, and event queries
- Native Resources KV, D1, Vectorize, and other edge-native resources
For AI Coding Assistants
This package includes an llms.txt file for AI-assisted development.
Use it when you want an agent or code assistant to:
- keep Service Key logic on the server
- use
EdgeBase::server(...)to construct the client - call
admin_auth()and other methods, not property-style SDK access - pass any
serde::Serializevalues as SQL bind params - use
serde_json::Valuefor broadcast payloads and other JSON-shaped data
You can find it:
- in this repository: llms.txt
- in the published crate contents next to the package files
Installation
For published applications:
[]
= "0.1.3"
Or:
If you are working inside this repository, add the crate as a path dependency:
[]
= { = "../packages/admin" }
Quick Start
use EdgeBase;
use json;
async
Core API
Once you create an admin client, these are the main surfaces you will use:
EdgeBase::server(base_url, service_key)Main server-side entry pointadmin.admin_auth()Admin user managementadmin.db(namespace, instance_id)Service-key database accessadmin.storage()Server-side storage accessadmin.sql(namespace, id, query, params)Raw SQL executionadmin.broadcast(channel, event, payload)Server-side database-live broadcastadmin.kv(namespace),admin.d1(database),admin.vector(index)Access platform resources from trusted codeadmin.push()Send push notificationsadmin.functions()Call app functions from trusted codeadmin.analytics()Query analytics and track server-side events
Database Access
use EdgeBase;
let service_key = var.unwrap;
let admin = server?;
let rows = admin.db.table.get_list.await?;
For instance databases, pass the instance id explicitly:
admin.db;
admin.db;
For raw SQL, the namespace and optional instance id are separate arguments:
let rows = admin.sql.await?;
Read more: Database Admin SDK
Admin Auth
let created = admin.admin_auth.create_user.await?;
admin.admin_auth.set_custom_claims.await?;
let users = admin.admin_auth.list_users.await?;
println!;
Read more: Admin User Management
Raw SQL
sql() accepts any slice of serde::Serialize bind values:
admin.sql.await?;
admin.sql.await?;
Push And Analytics
use HashMap;
admin.push.send.await?;
let overview = admin.analytics.overview.await?;
println!;
Read more:
Native Resource Access
admin.kv.set.await?;
let rows = admin.d1.exec.await?;
println!;
Choose The Right Package
| Package | Use it for |
|---|---|
edgebase-admin |
Trusted server-side code with Service Key access |
License
MIT