---
title: Serinus 2.1 - Morning Song
sidebar: false
editLink: false
search: false
outline: [2, 4]
head:
- - meta
- property: 'og:title'
content: Serinus 2.1 - Morning Song
- - meta
- name: 'description'
content: Introducing new router, Class and Value Providers and Loxia integration.
- - meta
- property: 'og:description'
content: Introducing new router, Class and Value Providers and Loxia integration.
- - meta
- property: 'og:image'
content: https://serinus.app/blog/serinus_2_1/serinus_2_1.webp
- - meta
- property: 'twitter:image'
content: https://serinus.app/blog/serinus_2_1/serinus_2_1.webp
---
Serinus 2.1, named "Morning Song", focuses on enhancing the developer experience, introducing new features and improving performance. This release introduces Atlas as the new default router, Class and Value Providers for more flexible dependency injection and finally Loxia joins the ecosystem providing a flexible ORM for your applications.
## Loxia Integration
Loxia is a powerful and flexible ORM designed to work seamlessly with Serinus. With Loxia, developers can easily manage database interactions using a simple and intuitive API. With Serinus 2.1 we are excited to announce the official integration of Loxia into the Serinus ecosystem. This integration allows developers to leverage Loxia's capabilities directly within their Serinus applications, making it easier to work with databases and manage data models.
Integrating Loxia with Serinus is straightforward. Developers can define their database models as Dart classes and use Loxia's powerful features for data management while benefiting from Serinus's modular architecture and dependency injection system. This integration provides a seamless experience for developers, allowing them to focus on building their applications without worrying about the complexities of database management.
```dart
import 'package:serinus/serinus.dart';
class AppModule extends Module {
AppModule()
: super(
imports: [
LoxiaModule.inMemory(entities: [User.entity]),
LoxiaModule.features(entities: [User]),
],
controllers: [UserController()],
);
}
```
Read more about Loxia integration in the [Serinus documentation](/techniques/database.html) and check out the [serinus_loxia package](https://pub.dev/packages/serinus_loxia) for more details and examples.
## Class Providers
One of the most significant additions in Serinus 2.1 is the introduction of Class Providers. This new feature allows developers to register concrete implementation using their abstract classes in the dependency injection system, enabling more flexible and dynamic service management.
```dart
abstract class DatabaseService {
void connect();
}
class MySQLDatabaseService implements DatabaseService {
@override
void connect() {
// MySQL connection logic
}
}
class AppModule extends Module {
@override
List get providers => [
Provider.forClass(
useClass: MySQLDatabaseService()
),
];
}
```
## Value Providers
In addition to Class Providers, Serinus 2.1 introduces Value Providers, which allow developers to register constant values or configurations in the dependency injection system. This is particularly useful for managing application settings or environment-specific configurations, on in some cases to inject objects that were created outside the DI system.
```dart
class AppModule extends Module {
@override
List get providers => [
Provider.forValue(
useValue: 'https://api.example.com'
),
];
}
```
Value Providers can also be differentiated by using named tokens:
```dart
class AppModule extends Module {
@override
List get providers => [
Provider.forValue(
name: 'API_URL',
useValue: 'https://api.example.com'
),
];
}
```
::: tip
We suggest using always Value Providers with named tokens to avoid conflicts when registering multiple values of the same type.
:::
## FormData and File Upload Enhancements
Serinus 2.1 introduces improved support for handling `FormData` and file uploads. The new features make it easier to work with multipart form data, this release add the `file` method to the `FormData` class, allowing developers to handle file uploads more intuitively.
```dart
class UploadController extends Controller {
UploadController(): super('/upload') {
on(Route.get('/form'), _upload);
}
Future