Vania 是一个快速、简单且功能强大的 Dart 后端框架,旨在构建可扩展的 Web 服务器和 API。它以性能和开发者体验为核心设计,为跨多个平台的服务器端应用程序提供轻量但坚固的基础。Vania 使开发者能够以最少的样板代码创建高效的后端服务,支持现代 Web 开发工作流程。其模块化架构可无缝集成到现有项目中或独立部署服务器。该框架非常适合希望使用原生 Dart 解决方案并在 Android、iOS、macOS、Windows 和 Linux 上运行的团队。
适合场景
构建 RESTful API
实时服务器应用
微服务架构
跨平台后端服务
原型设计后端逻辑
主要特点
高性能
最小化样板代码
跨平台支持
模块化设计
内置路由
适合对象
Dart 开发人员
全栈应用程序
Flutter 应用中的服务器端逻辑
快速后端原型设计
多平台部署
使用建议
与成熟框架相比,生态系统有限
早期采用
需要理解 Dart 异步模式
未针对大型数据库工作负载进行优化
新用户的上手难度
原始 README
以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。
Vania
A fast, simple, and unapologetically batteries-included backend framework for Dart.
Dart is a great language for writing servers — it's fast, it AOT-compiles to a single
binary, and if you already ship Flutter you know it. What it has been missing is the
boring, unglamorous infrastructure every real backend ends up needing: routing,
validation, an ORM, migrations, auth, sessions, a job of a CLI to tie it all together.
Vania is that infrastructure. If you've written Laravel, most of it will feel familiar.
If you haven't, it should still feel obvious.
Quick start
dart pub global activate vania_cli
vania create my_api
cd my_api
vania serve
Your server is on http://localhost:8000, and vania serve reloads it whenever you
save a Dart file.
Vania's ORM, query builder, migrations, seeders, and relations all live in the core
package. Drivers are thin — they translate the shared contract to a real connection and
nothing more. In practice that means your application code imports one thing:
import'package:vania/database.dart';
and the driver name appears exactly once, in main.dart:
registerMysqlDriver(); // or registerPostgresqlDriver() / registerMongodbDriver()
Swapping MySQL for PostgreSQL is a one-line change. Models, relations
(hasMany, belongsTo, belongsToMany, and the full morph family), migrations, and
query-builder calls come along unchanged, because none of them ever belonged to the
driver in the first place.
Issues and pull requests are welcome — see CONTRIBUTING.md. If you're
fixing a bug, a failing test that reproduces it is the fastest way to get the fix merged.