A powerful, and fast web framework for Dart that makes building backend applications a breeze
Get StartedBuilt for enterprise-level applications with robust error handling, logging, and scalable architecture patterns.
Optimized for performance with efficient routing, middleware system, and asynchronous request handling for maximum throughput.
Freedom to organize your project however you want. No forced conventions - build your application architecture your way.
Comprehensive set of built-in features including ORM, QueryBuilder, migrations, authentication, validation, and email system.
Vania provides a flexible routing system with support for parameters, middleware, and route groups for organizing your API endpoints efficiently.
class ApiRoute extends Route {
String prefix = 'api/v1';
void register() {
super.register();
Router.get("/login", authController.login);
Router.group(() {
Router.get("/", userController.index);
Router.get("/:id", userController.show);
Router.post("/", userController.store);
Router.put("/:id", userController.update);
Router.delete("/:id", userController.delete);
}, prefix: "users");
}
}
Built-in request validation makes it simple to ensure data integrity and provide meaningful error messages to your API consumers.
Future<Response> store(Request request) async {
await request.validate({
'name': 'required|string|max:100',
'email': 'required|email|unique:users',
'password': 'required|min:8',
},
{
'name.required': 'Name is required',
'name.max': 'Name must be less than 100 characters',
'name.string': 'Name must be a string',
'email.required': 'Email is required',
'email.unique': 'Email already exists',
'password.required': 'Password is required',
'password.min': 'Password must be at least 8 characters',
});
return Response.json({'message': 'successfully'});
}
Define your data models with relationships, fillable fields, and hidden attributes. Work with your database using elegant, expressive syntax.
class User extends Model {
List<String> fillable = ['name', 'email'];
List<String> hidden = ['password'];
void registerRelations() {
hasMany('posts', Post(), foreignKey: 'user_id');
}
}
// Usage
final user = User().include('posts')
.where('id', '=', 1).first();
Build complex database queries with joins, conditions, and aggregations using our intuitive Query Builder interface.
// Complex query with joins
final user = DB.table('users')
.join('profiles', 'users.id', '=', 'profiles.user_id')
.where('email', '=','[email protected]')
.first();
// Aggregation
final count = DB.table('posts')
.where('status','=', 'published')
.count();
Version control your database schema with powerful migrations. Create, modify, and rollback database changes with confidence.
class CreateUserTable extends Migration {
Future<void> up() async {
await create('users', (Schema table) {
table.id();
table.string('first_name');
table.string('email').unique();
table.string('password');
table.timeStamps();
});
}
Future<void> down() async {
await drop('users');
}
}
Send beautiful emails with template support. Create rich HTML emails with attachments and multiple recipients effortlessly.
class WelcomeEmail extends Mailable {
final String to;
final String subject;
const WelcomeEmail({
required this.to,
required this.subject,
});
Envelope envelope() {
return Envelope(
from: Address('[email protected]', 'Vania'),
to: [Address(to)],
subject: subject,
);
}
MailView? view() {
return MailView(view: 'welcome');
}
}