rivet 1.2.0 copy "rivet: ^1.2.0" to clipboard
rivet: ^1.2.0 copied to clipboard

A blazing-fast, type-safe backend framework for Dart with auto-generated Flutter clients

Rivet Framework #

The Ultimate Full-Stack Dart Framework

πŸš€ 1.8x Faster than Express | πŸ”’ Production-Ready | 🎯 Type-Safe | ⚑ Native Compilation

Note: This is Rivet for Dart, a high-performance backend framework for Dart and Flutter.
Not to be confused with rivet.dev, which is a TypeScript framework for stateful workloads.


Why Rivet? #

Rivet is the only Dart framework that gives you:

  • βœ… Single Language - Dart everywhere (backend + Flutter frontend)
  • βœ… Native Compilation - Deploy a single executable (no runtime needed)
  • βœ… Blazing Fast - 24,277 req/sec on dynamic routes (1.8x faster than Express)
  • βœ… Type-Safe - End-to-end type safety
  • βœ… Production-Ready - Built-in auth, rate limiting, WebSockets, database support

Quick Start #

import 'package:rivet/rivet.dart';

void main() async {
  final app = RivetServer();

  app.get('/hello', (req) {
    return RivetResponse.json({'message': 'Hello, World!'});
  });

  await app.listen(port: 3000);
}

Compile to native binary:

dart compile exe server.dart -o server
./server  # Instant startup!

Features #

πŸ”’ Security & Authentication #

  • JWT Authentication - Token validation with role-based access
  • Rate Limiting - Token bucket algorithm
  • CORS - Full cross-origin support
  • Request Validation - Schema validation with sanitization

⚑ Performance #

  • WebSockets - Real-time with rooms & broadcasting
  • SSE Streaming - Server-Sent Events
  • Worker Isolates - Multi-core request handling
  • Connection Pooling - Database connection reuse

πŸ—„οΈ Database #

  • PostgreSQL - Full adapter with connection pooling
  • Query Builder - Type-safe SQL construction
  • Migrations - Schema versioning

πŸ› οΈ Developer Experience #

  • Hot Reload - Auto-restart on file changes
  • Request Logging - Colored console + JSON structured logs
  • Testing Utilities - Integration test helpers
  • Plugin System - Extensible architecture

πŸ“Š Production #

  • Metrics - Prometheus-compatible endpoint
  • Session Management - Cookie-based with auto-cleanup
  • Caching - In-memory with TTL
  • Docker Support - Official images

Benchmarks #

Framework Simple JSON Dynamic Routes
Rivet 14,334 req/s 15,696 req/s ⭐
Node.js 30,691 req/s 9,967 req/s
Express 20,571 req/s 4,674 req/s

Rivet is 3.3x faster than Express on real-world dynamic routes!


Examples #

JWT Authentication #

app.use(jwt(
  secret: 'your-secret',
  requiredRoles: ['admin'],
));

app.get('/protected', (req) {
  final userId = req.params['__jwt_userId'];
  return RivetResponse.ok({'user': userId});
});

WebSockets #

app.ws('/chat', (conn) {
  conn.join('room1');
  
  conn.messages.listen((msg) {
    conn.broadcast('room1', {'message': msg});
  });
});

Database #

final db = await PostgresAdapter.connect(
  host: 'localhost',
  port: 5432,
  database: 'mydb',
  username: 'user',
  password: 'pass',
);

final users = await db.query('SELECT * FROM users WHERE id = @id', 
  substitutionValues: {'id': 1});

Validation #

final validator = Validator()
  ..field('email', [RequiredRule(), EmailRule()])
  ..field('password', [MinLengthRule(8)]);

app.use(validate(validator));

Installation #

dependencies:
  rivet: ^1.0.0

Documentation #


Deployment #

Docker #

docker build -t my-rivet-app .
docker run -p 8080:8080 my-rivet-app

Native Binary #

./scripts/build.sh
./build/rivet_server

Contributing #

We welcome contributions! See CONTRIBUTING.md


License #

MIT License - see LICENSE


Built with ❀️ by Supratim Dhara

7
likes
130
points
208
downloads

Publisher

unverified uploader

Weekly Downloads

A blazing-fast, type-safe backend framework for Dart with auto-generated Flutter clients

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

analyzer, args, build, dart_jsonwebtoken, http, mime, mongo_dart, mysql1, path, postgres, relic, serverpod, shelf, source_gen, watcher

More

Packages that depend on rivet