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

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

Rivet Framework v2.0 πŸš€ #

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.


Why Rivet? #

Rivet is the only Dart framework that gives you:

  • βœ… Universal Client Gen - Write backend, get type-safe client free
  • βœ… Hot Reload - Instant backend updates on file save
  • βœ… Native Compilation - Deploy a single executable (no runtime needed)
  • βœ… Blazing Fast - 24,277 req/sec on dynamic routes
  • βœ… Production-Ready - Built-in auth (JWT/OAuth), rate limiting, caching

Quick Start #

1. Create Server #

// lib/main.dart
import 'package:rivet/rivet.dart';

@RivetController('/api')
class HelloController {
  @Get('/hello')
  String hello() => 'Hello World!';
}

void main() async {
  final app = RivetServer();
  app.registerController(HelloController());
  await app.listen(port: 3000, hotReload: true);
}

2. Run with Hot Reload πŸ”₯ #

dart run rivet_dev.sh lib/main.dart

3. Generate Client 🎨 #

dart run rivet generate -o lib/client.dart

v2.0 New Features πŸ”₯ #

🎨 Universal Client Generation #

Stop writing API clients manually. Rivet scans your controllers and generates a type-safe Dart client.

  • Any Dart App: Works for CLI, Server, AngularDart.
  • Flutter Ready: Optional Riverpod integration with --riverpod.
  • Type-Safe: Methods, return types, and DTOs are preserved.
// Generated code usage
final client = ApiClient();
final message = await client.hello(); // Type-safe String!

πŸ”₯ Hot Reload for Backend #

No more restarting the server. We built a custom file watcher that swaps your code instantly when you save.

  • Smart Debouncing: Handles rapid-fire saves.
  • Graceful Restart: Waits for DB connections to close.
  • Leak-Free: Process-based isolation ensures 100% cleanup.

🎯 Decorator Routing #

Expressive, clean, and metadata-rich routing.

@RivetController('/users')
class UserController {
  @Post('/')
  @Auth(roles: ['admin']) // Role-based security
  @CacheResponse(ttl: 60) // Caching built-in
  Future<User> create(RivetRequest req) async { ... }
}

Installation #

dependencies:
  rivet: ^2.0.0

Deployment #

Native Binary (Linux/Mac/Windows) #

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

Docker #

FROM dart:stable AS build
WORKDIR /app
COPY . .
RUN dart pub get
RUN dart compile exe bin/server.dart -o server

FROM scratch
COPY --from=build /runtime/ /
COPY --from=build /app/server /app/bin/
CMD ["/app/bin/server"]

Contributing #

We welcome contributions! See CONTRIBUTING.md


License #

MIT License - see LICENSE


Built with ❀️ by Supratim Dhara

10
likes
130
points
169
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, bcrypt, build, dart_jsonwebtoken, http, mime, mongo_dart, mysql1, path, postgres, relic, serverpod, shelf, source_gen, watcher

More

Packages that depend on rivet