vanestack 0.1.3 copy "vanestack: ^0.1.3" to clipboard
vanestack: ^0.1.3 copied to clipboard

A Dart backend framework with built-in auth, database, realtime, and admin dashboard.

VaneStack Logo

VaneStack

A powerful, easy-to-use Dart backend framework inspired by PocketBase.

Website · Documentation


Features #

  • Authentication: JWT-based auth with login, logout, refresh tokens, password reset
  • Dynamic Collections: Create collections with custom attributes, rules, and indexes
  • Real-time: Server-Sent Events (SSE) for watching collections and users
  • Admin Dashboard: Web UI for managing your data
  • SQLite or Postgres: Built-in Drift ORM, swap backends via env vars
  • REST API: Full REST API for all resources
  • Middleware: CORS, logging, JWT decoding, rate limiting, request injection
  • Code Generation: Automatic route generation and client SDK

Quick Start #

Option 1: Standalone Server (No Custom Code) #

If you just need the server as-is without custom routes or endpoints, install the CLI globally and run it:

dart pub global activate vanestack
vanestack start

That's it. The server will start on http://localhost:8080 with all built-in endpoints ready to go.

Option 2: Custom Routes & Endpoints #

If you want to add custom routes, middleware, or extend the server, add VaneStack as a dependency in your project:

  1. Add vanestack to your pubspec.yaml:
dependencies:
  vanestack: # see pub.dev for latest version
  1. Create bin/main.dart:
import 'package:vanestack/vanestack.dart';

void main(List<String> args) async {
  final server = VaneStack();
  await server.run(args);
}
  1. Run the server:
dart run bin/main.dart start

From here you can add custom routes with addRoute and extend the server however you like. See the Adding Custom Routes section below.

Admin Setup #

Create your first admin user:

vanestack users create -e admin@example.com -p yourpassword -s
# or, if running from a project:
dart run bin/main.dart users create -e admin@example.com -p yourpassword -s

Database Backend #

VaneStack supports both SQLite (default) and PostgreSQL. Select the backend with environment variables — no code changes needed.

SQLite (default):

# Uses ./data/database.sqlite by default
vanestack start

# Or point at a custom path
VANESTACK_SQLITE_PATH=/var/lib/myapp.sqlite vanestack start

PostgreSQL:

export VANESTACK_DATABASE=postgres
export VANESTACK_POSTGRES_URL="postgresql://user:pass@localhost:5432/mydb?sslmode=disable"
vanestack start

You can also configure the backend programmatically when embedding VaneStack:

import 'package:vanestack/vanestack.dart';

void main(List<String> args) async {
  final server = VaneStack(
    databaseBackend: DatabaseBackend.postgres,
    postgresUrl: 'postgresql://user:pass@localhost:5432/mydb?sslmode=require',
  );
  await server.run(args);
}

Accepted sslmode values: disable, require (default), verify-full. Schema migrations run automatically on startup for both backends.

Adding Custom Routes #

Use the addRoute method to register custom endpoints:

import 'package:vanestack/vanestack.dart';
import 'package:shelf/shelf.dart';

void main(List<String> args) async {
  final vanestack = VaneStack();

  vanestack.addRoute(HttpMethod.get, '/hello', (request) => Response.ok('Hello!'));
  vanestack.addRoute(HttpMethod.get, '/users/<userId>', (request) async {
    // ...
  });

  await vanestack.run(args);
}

Routes added with addRoute are automatically included in the generated client SDK. Pass ignoreForClient: true to exclude a route from the client.

Architecture #

VaneStack is built with:

  • Server: Shelf web framework
  • Database: Drift ORM with SQLite (default) or PostgreSQL
  • Auth: JWT tokens with refresh tokens
  • Real-time: Server-Sent Events
  • Dashboard: Jaspr web app
  • Client: Generated Dart client SDK

Development #

Code Generation #

dart run bin/main.dart generate   # regenerate client SDK

Testing #

dart test

Packages #

Package Description
vanestack_annotation @Route annotation and HttpMethod enum
vanestack_common Shared models and types
vanestack_client Generated HTTP client SDK
vanestack_generator Build runner code generator

License #

This project is licensed under the BSD 3-Clause License.