Rise of APIs Drives Evolution of Microframeworks

It's a great time to be a developer, and one of the reasons is that there are a ton of frameworks that developers can use to build apps. From Ruby on Rails and Django to Angular.js and Ember, developers have more options that ever for developing both on the server and client.

The advantages to using a Framework can be significant. In addition to helping developers adhere to key design principles, such as separation of concerns, and providing key tooling, modern frameworks tend to eliminate the need to reinvent the wheel, substantially reducing the time it takes developers to build apps capable of delivering high value. In today's highly competitive markets, time to market is crucial to most companies.

Not surprisingly, frameworks have become a lot more capable over the years. And that means in many cases they have become bigger. While it wouldn't be fair to use the word "bloated" to describe some of the more robust frameworks today, frameworks jam-packed with functionality pose challenges for certain kinds of applications like APIs.

APIs are expected to be super fast, and many have to deal with lots of concurrent requests. Unnecessary framework baggage is not only undesirable, it can be downright problematic. To address use cases like API development, the past several years have seen the development and maturation of microframeworks that deliver some of the advantages of frameworks without all of the heft. Most languages have at least one good microframework option. For example, PHP has Slim, Python has Flask and Ruby has Sinatra.

A new approach to microframeworks

The latest entrant to the microframework arena is Lumen, which was built by Taylor Otwell, creator of Laravel. Laravel, an open-source MVC framework for PHP, was originally released in 2011 and since that time, has become one of PHP's most popular frameworks. Today, it's the most-watched PHP project on GitHub.

Billed as "the perfect solution for building Laravel based micro-services and blazing fast APIs," the Lumen website goes so far as to claim "it's one of the fastest micro-frameworks available." Even so, Lumen still includes a number of Laravel's largest components, including an ORM and Laravel's service Container. To make such components accessible in a highly-performant microframework "all I needed to do was 'glue' them together in a different way than a full- Stack framework would glue them together" Otwell explained.

Because Lumen is based on Laravel components, it is easy for developers who start with a Lumen-based application to upgrade to Laravel without significant pain. Normally, the framework versus microframework decision is typically a very hard one to revisit. "Since the Laravel eco-system now contains both a full-stack framework and a micro-framework that are 'officially' supported, we can provide really great upgrade stories," according to Otwell.

The ability to easily upgrade from microframework to full framework makes Lumen very unique and could prove to be a big differentiator. It could also change the way developers think about and build microframeworks going forward.

One of the reasons for this is that widespread use of APIs and microservices has forced many companies to grapple with language and framework soup as they need to build fundamentally different kinds of applications. While some companies embrace this, having a hodgepodge of programming languages and frameworks in production can also become a form of technical debt long-term.

While Lumen's popularity is not guaranteed, it could signal a future in which microframeworks and frameworks alike are developed in a way that allows them to play nicely with each other so that the development approaches needed to build scalable APIs and microservices are not as distinct from the development approaches used to build larger applications.

Be sure to read the next Framework article: Daily API RoundUp: Qooxdoo, Stackify, Sportradar NHL