Since releasing Dart Frog a few months ago, we have seen a lot of interest from the community in our approach to Dart on the server. We’ve been hard at work on updates to the package. We've also spent time testing it out in various use cases across a few of our projects. Today we're excited to announce that Dart Frog is stable! 🎉
To us, “stable” means the project is no longer just an experiment. We’ve used Dart Frog internally across multiple projects, fixed many bugs and stability issues across multiple platforms, and have addressed the critical items on our roadmap. Because of this, we have removed the experimental warning from the docs and GitHub repo.
Let’s take a closer look at what’s in this stable release!
What’s included 📦
Hot Reload Improvements ⚡️
We have spent a lot of time improving the developer experience when it comes to using Dart Frog in dev mode. One of the biggest focus areas was on hot reload performance and reliability to ensure that it behaves the way you might expect. For example, if you’re in the middle of implementing something, hot reload should be able to recover from situations in which an error might interrupt your workflow — you shouldn’t have to constantly restart the dev server. It was important for us to have this seamless experience, not just on Unix-based systems, but also on Windows. Updates include:
- Performance improvements
- Stability improvements (especially on Windows)
- Logging improvements
- Error reporting improvements
- Route conflict detection
- Rogue route detection
- Error message formatting
- Resilience and recovery from errors
CLI verbose mode 📢
The Dart Frog CLI now supports a --verbose flag on all commands (build, create, and dev). You can now toggle verbose mode when working with the Dart Frog CLI, which provides additional visibility into what’s going on behind the scenes. This feature is particularly helpful for debugging issues that are hard to reproduce.
Interoperability with package:shelf ↔️
From the beginning, we wanted Dart Frog to complement the existing Dart ecosystem. The core Dart Frog runtime ships with APIs that enable interop between Dart Frog and shelf, which means you can use existing shelf packages in your Dart Frog apps. Check out the following APIs for getting started with shelf interop:
Custom Server Entrypoint 🎬
Dart Frog now supports creating a custom main.dart which will run before the server starts. This gives you full control over initialization of the server. It also allows you to customize the http server, handlers, port, internet address, and run migration code while still taking full advantage of the generated handler. To use the custom entrypoint feature, simply create a main.dart at the root of your Dart Frog project and define a run function with the following signature:
Rogue route detection 🥷
You can now detect rogue routes when running your Dart Frog server. A route is considered rogue when it is defined outside of an existing subdirectory with the same name. For example:
In the above scenario, foo.dart is rogue because it is defined outside of the existing foo directory. Instead, foo.dart should be renamed to index.dart and placed within the foo directory like:
This update comes with a brand new section on the Dart Frog docs site for tutorials. We have four up right now:
What’s next 🗺
We’re planning to focus on Dart API client and documentation generation next. This will enable you to hook up your Dart Frog backend to an existing Flutter application seamlessly and will ensure your API documentation stays in sync as your backend evolves.
As always, you can refer to the roadmap for features that we’re actively developing. If you have ideas for what you’d like to see, feel free to open an issue on the GitHub repo and tell us more. We’d love to see what you build with Dart Frog, so tag us on Twitter or LinkedIn.