routed_hotwire
Turbo/Stimulus helpers for the routed framework. The package wires Hotwire
responses, server-rendered stream updates, and Stimulus command helpers into the
Routed engine so you can build interactive hybrids without leaving Dart.
Features
- Response helpers for Turbo Streams, frames, redirects, and flash messages.
- Stimulus controller scaffolds and middleware to register assets.
- Testing utilities layered on top of
routed_testing/server_testing. - Example apps showing Hotwire navigation, optimistic updates, and logging.
Install
dependencies:
routed: ^0.5.0
routed_hotwire: ^0.1.6
Turbo-first apps typically include routed, routed_testing, and
server_testing dev dependencies as well.
Usage
import 'package:routed/routed.dart';
import 'package:routed_hotwire/routed_hotwire.dart';
Future<void> main() async {
registerRoutedProviders();
final engine = await Engine.create();
engine.post('/notes', (ctx) async {
final content = ctx.query('content')?.toString() ?? '';
return ctx.turboStream(turboStreamAppend(
target: 'notes',
html: '<li>$content</li>',
));
});
await engine.serve(port: 8080);
}
routed_hotwire does not register a service provider. The routed facade
initializes the official Routed providers; the Hotwire package adds response
and stream helpers to the engine context.
See the example/ directory for a runnable Todo app with Turbo navigation and
Stimulus controllers.
Funding
If this adapter saves you time, consider supporting the work on Buy Me a Coffee.
Libraries
- routed_hotwire
- Turbo and Stimulus helpers for Routed applications.