edgebase_admin 0.1.2 copy "edgebase_admin: ^0.1.2" to clipboard
edgebase_admin: ^0.1.2 copied to clipboard

EdgeBase Admin SDK — server-side admin operations.

edgebase_admin

Trusted server-side SDK for EdgeBase in Dart
Database admin, user management, SQL, analytics, push, storage, and trusted function calls

pub.dev  Docs  MIT License

Dart VM · Backend services · Trusted workers · Cron jobs · Secure environments

Database Admin SDK · Admin Users · Analytics Admin SDK · Push Admin SDK


edgebase_admin is the trusted server-side Dart SDK for EdgeBase.

Use it when you need:

  • Service Key authenticated access
  • server-side database operations that bypass access rules
  • admin user management
  • raw SQL execution
  • push and analytics from secure environments
  • server-to-server function calls
  • access to KV, D1, and Vectorize resources

If code runs in a Flutter app or untrusted client, use edgebase_flutter instead. If you only need low-level primitives for a custom integration, use edgebase_core.

Beta: the package is already usable, but some APIs may still evolve before general availability.

Documentation Map #

For AI Coding Assistants #

If you are using an AI coding assistant, check llms.txt before generating code.

It captures the trusted-server package boundary, canonical admin usage, and Dart-specific rules for adminAuth, SQL, analytics query options, and Service Key handling.

Installation #

dart pub add edgebase_admin

Quick Start #

import 'package:edgebase_admin/edgebase_admin.dart';

final admin = AdminEdgeBase(
  'https://your-project.edgebase.fun',
  serviceKey: 'YOUR_SERVICE_KEY',
);

final posts = await admin
    .db('app')
    .table('posts')
    .orderBy('createdAt', direction: 'desc')
    .limit(20)
    .getList();

print(posts.items);

Core API #

Once you create an admin client, these are the main surfaces you will use:

  • admin.adminAuth Admin user management
  • admin.db(namespace, instanceId: ...) Server-side database access
  • admin.sql(namespace, instanceId, sql, [params]) Raw SQL execution
  • admin.storage Server-side storage access
  • admin.functions Call app functions from trusted code
  • admin.push Send push notifications
  • admin.analytics Query analytics and track server-side events
  • admin.kv(namespace), admin.d1(database), admin.vector(index) Access platform resources from trusted code

Database Access #

final posts = admin.db('app').table('posts');

final latest = await posts
    .where('status', '==', 'published')
    .orderBy('createdAt', direction: 'desc')
    .limit(20)
    .getList();

For instance databases, pass the instance id explicitly:

admin.db('workspace', instanceId: 'ws-123');
admin.db('user', instanceId: 'user-123');

Read more: Database Admin SDK

Admin Users #

final created = await admin.adminAuth.createUser(
  email: 'admin@example.com',
  password: 'secure-pass-123',
  displayName: 'June',
  role: 'moderator',
);

await admin.adminAuth.setCustomClaims(created.id, {
  'plan': 'pro',
});

final users = await admin.adminAuth.listUsers(limit: 20);
print(users.users);

Read more: Admin User Management

Raw SQL #

final rows = await admin.sql(
  'workspace',
  'ws-123',
  'select * from documents where status = ?',
  ['published'],
);

print(rows.length);

Push And Analytics #

await admin.push.send('user-123', {
  'title': 'Deployment finished',
  'body': 'Your content is live.',
});

final overview = await admin.analytics.overview({'range': '7d'});
print(overview['summary']);

Read more:

Native Resource Access #

await admin.kv('cache').set('homepage', 'warm', ttl: 60);

final rows = await admin.d1('analytics').exec(
  'SELECT * FROM events WHERE type = ?',
  ['click'],
);

print(rows);

Choose The Right Dart Package #

Package Use it for
edgebase_flutter Flutter apps and client-side code
edgebase_admin Trusted server-side Dart code with Service Key access
edgebase_core Low-level primitives for custom SDK or integration work
edgebase Umbrella package when you want a broader Dart entry point

License #

MIT

0
likes
0
points
163
downloads

Publisher

verified publisheredgebase.fun

Weekly Downloads

EdgeBase Admin SDK — server-side admin operations.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

edgebase_core, http

More

Packages that depend on edgebase_admin