🚀 Getting Started
Installation
You can install Flint Dart in two ways:
1️⃣ Install CLI Globally
dart pub global activate flint_dart
This installs the Flint Dart CLI globally, letting you quickly scaffold new projects:
flint create my_app
2️⃣ Add as a Package
dart pub add flint_dart
First Application
import 'package:flint_dart/flint_dart.dart';
void main() {
final app = Flint();
app.listen(port: 3000);
}
This code initializes a basic Flint Dart application that listens on port 3000
. Run it with:
flint start
📂 Recommended Folder Structure
For a clean and maintainable Flint Dart project, we recommend the following layout:
lib/
├── main.dart # Entry point of your application
└── src/
├── config/
│ └── table_registry.dart # Register all your ORM tables here (needed for migrations)
├── models/ # Database models (User, Post, etc.)
├── routes/ # Route definitions
├── controllers/ # Request handling logic
├── middlewares/ # Custom middleware (Auth, Validation, etc.)
└── services/ # Business logic or reusable helpers
The table_registry.dart
file is especially important if you plan to use Flint Dart's migration system. It ensures all your database tables are properly registered.
🗄 Example: table_registry.dart
Here's how you can set up lib/src/config/table_registry.dart
to register all your models for migrations:
This file lists all your tables and is used by Flint Dart's migration commands to create or update database schema.