The Laravel Experience for Flutter. Magic brings Laravel's elegant syntax and powerful features to Flutter, letting you build production-ready mobile apps with zero boilerplate.
// Laravel-style routing
Route.get('/users/:id', (id) => UserController().show(id));
// Eloquent-like models
final user = await User.find(1);
await user.update({'name': 'John Doe'});
// Familiar facades
await Auth.login({'token': token}, user);
await Cache.put('key', 'value', duration: Duration(hours: 1));# Activate the CLI globally
dart pub global activate fluttersdk_magic_cli
# Navigate to your Flutter project
cd my_app
# Initialize Magic with all features
magic initThe CLI will set up everything: dependencies, directory structure, configuration files, and service providers.
magic init --without-database --without-events# pubspec.yaml
dependencies:
fluttersdk_magic:
git:
url: https://github.com/fluttersdk/magic.git// lib/config/app.dart
import 'package:fluttersdk_magic/fluttersdk_magic.dart';
final appConfig = {
'app': {
'name': Env.get('APP_NAME', 'My App'),
'providers': [
(app) => RouteServiceProvider(app),
],
}
};// lib/main.dart
import 'package:flutter/material.dart';
import 'package:fluttersdk_magic/fluttersdk_magic.dart';
import 'config/app.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Magic.init(
configFactories: [() => appConfig],
);
runApp(
MagicApplication(title: 'My App'),
);
}lib/
├── config/ # Configuration files
│ ├── app.dart
│ ├── auth.dart
│ └── database.dart
├── app/
│ ├── controllers/ # Request handlers
│ ├── models/ # Eloquent models
│ └── policies/ # Authorization policies
├── database/
│ ├── migrations/ # Schema migrations
│ ├── seeders/ # Database seeders
│ └── factories/ # Model factories
├── resources/
│ └── views/ # UI view classes
├── routes/ # Route definitions
└── main.dart # Entry point
| Feature | Description |
|---|---|
| Routing | Named routes, middleware, deep linking with go_router |
| Eloquent ORM | Query builder, relationships, migrations |
| Authentication | Token-based auth, guards, session management |
| Authorization | Gates, policies, MagicCan widget |
| Validation | Laravel-style validation rules |
| Caching | File, memory, and secure storage |
| Events | Pub/sub event system |
| Localization | JSON-based i18n with __() helper |
| Service Container | Dependency injection |
| Wind UI | Tailwind CSS-like styling |
Build beautiful UIs with Tailwind CSS-like utility classes:
WDiv(
className: "flex flex-col p-4 bg-white shadow-lg rounded-xl",
children: [
WText("Hello World", className: "text-xl font-bold text-blue-500"),
WButton(
onTap: () => print('Clicked!'),
className: "mt-4 px-4 py-2 bg-blue-600 rounded-lg",
child: WText("Click Me", className: "text-white"),
),
],
)Magic uses .env files for environment-specific configuration:
# .env
APP_NAME="Magic App"
APP_ENV=local
APP_DEBUG=true
API_BASE_URL=https://api.example.comAccess configuration values anywhere:
final appName = Config.get('app.name', 'Default');
final apiUrl = Env.get('API_BASE_URL');| Topic | Description |
|---|---|
| Installation | Setup and requirements |
| Configuration | Environment and config files |
| Routing | Routes and navigation |
| Authentication | Guards and login |
| Authorization | Gates and policies |
| Database | Eloquent models and queries |
| Validation | Form validation rules |
| Caching | Cache drivers and usage |
| Events | Event dispatching |
| Localization | Multi-language support |
magic make:model User # Create Eloquent model
magic make:controller User # Create controller
magic make:view Login # Create view class
magic make:policy Post # Create authorization policy
magic make:migration create_users_table # Create migration
magic make:seeder UserSeeder # Create database seeder
magic make:provider Payment # Create service provider
magic make:lang tr # Create language fileContributions are welcome! Please read our contributing guidelines before submitting a pull request.
Magic is open-sourced software licensed under the MIT license.
Built with ❤️ for Flutter developers who love Laravel