DEV Community

andreespirela
andreespirela

Posted on

Mandarine.TS, the next ExpressJS?

What is Mandarine.TS?

Mandarine.TS is a framework that allows you to develop applications, mainly web-applications. It is written in Typescript and runs on Deno (A Javascript & Typescript runtime created by Ryan Dahl, inventor of Node.JS) and it recently released its version 1.0.0.

Mandarine is divided into 4 modules: Core, Data, Security & MVC which essentially give you tools to create Mandarine-powered applications.

From the official documentation:

Under its umbrella, Mandarine.TS has 4 modules: Core, Data, Security and MVC, these modules will offer you the requirements to build a Mandarine-powered application. However, the most common module is Mandarine MVC, since it combines all the concepts from its different cores into one, in order to make the creation of complex web-applications (front-end & back-end) easy, reliable, and following design patterns & principles such as SOLID, making your application sustainable & readable across developers.

Mandarine offers you in its 4 different modules the use of: Dependency Injection, Components, Routes, HTTP Handlers, Session middleware, built-in ORM, Template Engine, and more.

The real question. Is Mandarine the next ExpressJS?

Mandarine can be considered fundamentally different when it comes to comparing it to ExpressJS. They can perform the same tasks but they are not the same when it comes to using it and writing it.

Differences:

  • Mandarine.TS is known for being decorator-driven
  • Mandarine.TS is not only for web applications but for any kind of typescript application that runs on Deno.

Decorator-driven

Example I

Almost everything in Mandarine needs a decorator, this will make your code readable and easy to write.

import { Controller, GET, MandarineCore } from "https://deno.land/x/mandarinets/mod.ts";

@Controller('/api')
export class Boo {

    @GET('/hello-world')
    public helloWorld(): string {
        return "Hello World";
    }

}

new MandarineCore.MVC().run();
# request => http://localhost:4444/api/hello-world => Hello World

Example II

import { Controller, GET, RouteParam, QueryParam, MandarineCore } from "https://deno.land/x/mandarinets/mod.ts";

@Controller()
class TestController {

    @GET('/say-hi/:name')
    public helloWorld(@RouteParam('name') personsName: string, @QueryParam() lastname: string): string {
        return `Hello ${personsName} ${lastname}, welcome.`;
    }
}
new MandarineCore.MVC().run();
# request => http://localhost:4444/say-hi/Bill?lastname=Gates => Hello Bill Gates, welcome.

Not only for web-apps.

Although the concept of "Mandarine Native" is really in its early days as Mandarine.TS 1.0.0 was only released yesterday, The objective of Mandarine is to create Mandarine-powered applications that let a development environment use built-in solutions such as DI & Components without having to compile it into a web app. Some of this concept is already possible, for example, you can use Mandarine's DI framework in a javascript/typescript native class (See example here) but this concept is still being developed.

Mandarine.TS vs ExpressJS

ExpressJS has been out there for a decade now, this makes it more reliable in terms of community size & it runs on Node, a runtime that has been out there for a decade and a year now. This may make ExpressJS seem more reliable because it possibly is in certain areas.

Mandarine.TS has only been out there for a few months, and its community is still growing. Although, the fact that Mandarine is written in Typescript & runs on Deno offers a now modern solution for future web-applications or applications in general with modern technologies. One of the most interesting things of Mandarine, is MQL (Mandarine Query Language) (See here), which is some sort of version of CRUD repositories but implemented in Typescript.

Another +1 for mandarine is the fact that it supports Dependency Injection out of the box with its built-in DI framework (See documentation here). This makes your application not only more easy to test, but it also makes it more readable & practice as it gets larger.

Thoughts

It is definitely interesting where Mandarine.TS is going, while it may seem that it cannot fight against ExpressJS, some of its features and the possibly growing community will make its future something to be curious about.
You can see Mandarine's documentation here and you can access its Github repository here

Disclaimer

I am the creator of Mandarine.TS

Top comments (1)

Collapse
 
juanmorenomotta profile image
Juan Moreno Motta

MandarineTS esta mas cerca de NestJS.