Built from scratch

Mandar Bhide
3 min readJul 25, 2022

Server-side framework

QDot

Backend frameworks are the backbone of this ‘Age of Web’. Although, one can write server-side code from scratch for each project, it is not at all suitable for medium and large projects. For these projects, developers must be allowed to focus on business logic instead of some (say) HTTP error. That’s when backend frameworks walk in.

There are multiple open-source frameworks popularly used by many well-known brands, like Django is backend framework in python, used by Instagram, Pinterest etc. or Flask, another python framework used by reddit.

What a web framework essentially does is, it provides skeleton for handling requests from the clients. Developers can use these skeletons to build web server around them, based on the requirements and relevant business logic. This way, framework takes care of parsing, routing and responses etc. while developers can focus on the business logic.

Okay. But why try to develop our own server framework?

Well, because…why not? This is how I began development of QDot, a server-side framework written in Dart programming language. Dart has become popular with the Flutter framework for client-side development. Instead of getting converted to other language (Like python), Dart runs on its own engine written in C++, which gives +1 on performance. Also, Dart is syntactically closer to modern languages like Kotlin and Typescript, along with important features like null safety. That’s why the language choice ended up with Dart.

Let’s take a quick review of the framework’s architecture. As on today (25 July 2022), the server has a main worker which is capable of accepting requests on given port. The requests are routed based on the URI path and request method. Framework contains classes for rendering webpages along with static content (stylesheets, media etc.) and features like redirection. Additionally, it has classes to create REST API, built over HTTP. A server object may have either or both of web and REST instances.

The future scope is HUGE. As of now, although QDot supports query parameters (obviously!), it lacks capability to handle path parameters. Additionally, the framework can be loaded with support for socket server and database schema migrations. Support for multiple server instances using multithreading can multiply the capabilities of servers built using QDot.

In short, much has been done and much more is yet to be done. I hope you found this experience informative and interesting. Don’t forget to give it a clap. Feel free to give feedbacks (Also to contribute to the framework 🙂)

Cheers!

[QDot: https://pub.dev/packages/qdot]

[UPDATE: July 30, 2022] QDot now supports defining and using path parameters.

[UPDATE: August 3, 2022] QDot now supports CORS.

--

--

Mandar Bhide

Computer Engineering student | Web and app developer| Love to learn technologies :)