rewo 1.0.5
rewo: ^1.0.5 copied to clipboard
Rewo — a modular Dart backend framework. REST APIs, DI, JWT auth, OpenAPI, hot-reload dev, and CLI project scaffolding. Spring-inspired, Express-simple.
Rewo (rewo) #
Spring power. Flutter simplicity. Express ease.
Rewo is a modular Dart backend framework for building REST APIs. Scaffold a new project in one command, add modules, compile to a native binary — one server, all APIs included.
Published by Avanti Inc. · pub.dev
Install #
Add to your pubspec.yaml:
dependencies:
rewo: ^1.0.5
Or scaffold a full project with the CLI:
dart pub global activate rewo
rewo create my_api
Or scaffold without global install (from any project that has rewo):
dart pub global activate rewo
rewo create my_api
Quick start (new project) #
rewo create my_api
cd my_api
dart pub get
cp .env.example .env
Development (hot reload) #
rewo run --dev
Or the equivalent:
rewo dev
Optional custom port:
rewo run --dev 3000
Production #
rewo run
Optional port:
rewo run 3000
Production binary (deploy) #
dart compile exe bin/server.dart -o server
./server
Requires global CLI once:
dart pub global activate rewo
Your project layout:
my_api/
bin/server.dart # entry point
bin/dev.dart # hot-reload dev server
lib/app.dart # register modules here
lib/modules/ # your API modules
test/
.env
Add an API module #
// lib/modules/hello_module.dart
import 'package:rewo/rewo.dart';
class HelloModule implements RewoModule {
@override
String get name => 'hello';
@override
void register(Rewo app) {
app.get('/api/hello', (_) async => {'message': 'Hello World'});
}
}
Register in lib/app.dart:
static List<RewoModule> get modules => [
HelloModule(),
];
Features #
| Category | Feature |
|---|---|
| CLI | rewo create project scaffolding |
| Dev | Hot-reload via rewo run --dev or rewo dev |
| HTTP | REST routing, native server, HTTP/2, OpenAPI |
| Auth | JWT, sessions, Bearer tokens, role-based access |
| Core | Dependency injection, events, scheduler, modules |
| Data | Validation, in-memory repo, transactions, pagination |
| Ops | Health/readiness, metrics, graceful shutdown |
| Config | .env loading and validation |
| Deploy | dart compile exe bin/server.dart -o server |
Minimal app (no scaffold) #
import 'package:rewo/rewo.dart';
void main() async {
await Rewo.run((app) {
app.get('/hello', (_) async => {'message': 'Hello World'});
}, config: AppConfig(port: 8080));
}
Configuration (.env) #
PORT=8080
HOST=0.0.0.0
ENV=development
JWT_SECRET=change-me-in-production
SERVER_ENGINE=native
STORAGE_PATH=./storage
Run the server #
Requires dart pub global activate rewo once.
Development (hot reload) #
rewo run --dev
# or
rewo dev
Saves in lib/ restart the server automatically. Custom port: rewo run --dev 3000.
Production #
rewo run
Custom port: rewo run 3000.
Deploy (compiled binary) #
dart compile exe bin/server.dart -o server
./server
Place .env next to the binary, or set PORT, JWT_SECRET, etc. in your environment.
Commands #
rewo create my_api # scaffold project
rewo run --dev # dev — hot reload
rewo dev # same as rewo run --dev
rewo run # production server
rewo run 3000 # production on port 3000
dart compile exe bin/server.dart -o server # build binary
./server # run compiled binary
dart test # tests
Documentation #
- Getting Started
- Performance
- Changelog
License #
MIT © Avanti Inc.