Why I created Mandarine.ts Framework... and Deno.
Tags: mandarinets, typescript, deno, framework
Published: 2020-06-18 00:58:16

# Let's talk Deno
A few months back, I started getting involved with [**Deno**](https://deno.land), the new runtime for Typescript & Javascript created by [Ryan Dahl](https://medium.com/@imior/10-things-i-regret-about-node-js-ryan-dahl-2ba71ff6b4dc) (The creator of NodeJs). When I started trying Deno, I saw the potential it has for the whole industry, with new things coming along such as [Web Assembly](https://webassembly.org/) and faster and improved versions of [V8](https://en.wikipedia.org/wiki/V8_(JavaScript_engine)), but **most important**, the use & popularity [Typescript](https://en.wikipedia.org/wiki/Typescript) is receiving due to its fantastic features & use cases, I could see how Deno _may_ disrupt the javascript & typescript industry, maybe not now, but pretty sure in the future.

Deno gave me a _unique_ experience & feeling that as a programmer, I didn't have with Node. The fact is, Deno solves all anti-design patterns Node has as of today since it is written in Typescript, it makes your code not only flexible but also readable & extensible with the use of Generic classes, Decorators, Extensions, Interface & Implementations, and more. 
Deno also supports top-level await which is kind of a game changer since it the necessity of a **callback hell**.

_Node.js_ always gave me a bit of discomfort when working with it: its package manager always stressed me out & the fact that I always had to "trust" the third-party libraries because Node.js **is not secure** by default, this means, any library can gain access to your system without so much of trouble.
Deno, on the other side, is secure by default, you need to pass flags to allow Deno to behave. You would `--allow-net` to allow access to everything related to your network like socket connection for an HTTP dispatcher, or you would use `--allow-read` to give Deno permissions to read from your file system.

The reasons I mentioned & more made me decide that I should use Deno to build [**Mandarine.TS Framework**](https://mandarineframework.gitbook.io/mandarine-ts/)

# Mandarine.TS Framework
When I saw the potential of Deno and the fact that it is still in its early days, which means, it has a growing community without too much of mass adoption, I saw a big opportunity to collaborate to the open source community & make a enterprise framework that as the community grows, it would grow along, and possibly become the next NestJS. For that reason, I created Mandarine.TS framework.

Mandarine.TS is a framework to build enterprise applications on Deno. These applications are often referred as **Mandarine-powered applications**. 
Think of Mandarine.TS as a all-in-one solution for your business application: Mandarine.TS is divided in 4 modules: Data, Security, Core & MVC which provides different built-in functionalities and sub frameworks to meet your development standards and design patterns.

## Features
Mandarine.TS gives you the possibility to work with:
- Dependency Injection
- Components
- ORM (CRUD style)
- Mandarine Query Language (MQL), a way to write SQL syntax without having any real SQL.
    - `findByEmailAndPassword();` = `SELECT * FROM ... WHERE email = $1 and password = $2`
- Template Engine
- Sessions
- CORS
- Static content
- Resource handlers

## Mandarine & Javascript native code.
Mandarine gives you the flexibility to use its technology in _native javascript_, for example: If you want to access a mandarine-powered component (Injectable dependency) from a javascript native class without using any special code or decorator, you may do so. [Click here](https://mandarineframework.gitbook.io/mandarine-ts/mandarine-core/dependency-injection/accessing-di-container#usage) to see an example.

## Inspiration
Mandarine.TS was inspired in [Spring Boot](https://en.wikipedia.org/wiki/Spring_Framework)

## Goal
The main goal of Mandarine.TS is to solve the different enterprise problems related to their coding style & best practices by using the less configuration & more automatization as possible.

## Future
I visualize Mandarine.TS becoming the main MVC framework in the Deno community.
I can't deny, it's still during its early days & it requires a lot of new features and use cases in order to get widely used and become the main MVC framework, but the progress done as of Deno v1.1.0 has been incredible & it will continue improving.
Many of the features NestJS currently offers are yet to come along with unique features in Mandarine, but as everything in development, it requires time & users using it.

# Should I use Deno?
This is one questions that can be found as controversial. Many people are already on what I would call "The Deno hype" while others are skeptical. I'm personally in the middle of both sides. If you are building an enterprise application that will be used by thousands of people, I would highly recommend you to go with Node.js as it has more support than Deno and more modules that will save you time, code and worries. However, if you are building an enterprise application that will be used only by the people that work there, or a general application that is not expected to grow so quickly, then Deno is your way to go and catch-up with the newest technologies in the market. 

As mentioned before, Deno is still in its early days. You can already build complex applications that can even be used in Production, but for more stability, we will have to wait two important things from the Deno community
- A typescript compiler fully written in Rust
- A HTTP module fully written in Rust.

# Should I use Mandarine.TS Framework?
As well as Deno, Mandarine.TS framework is still in its early days, it has a lot to offer but it also has a lot of features missing. If you are working on creating an application for a start-up, Mandarine.TS is the way to go. However, if your application is more enterprise-like or enterprise-used, then there are a couple things to consider:

- It is missing features
- Expect breaking changes as early versions roll out.

Mandarine.TS can already cover a lot of requirements for any type of application, but it needs work & it needs to be improved to reach its goal: A all-in-one solution for enterprises which makes me recommend Mandarine for small applications or in-house applications in your company.

# Thoughts
1) I personally don't think Deno will replace NodeJS, mainly because NodeJS is used across **millions** of companies which affect **billion of people**. I do think Deno will get widely used in the next 4-5 years for the new start-ups and projects that existing companies will have since it solves many of the uncomfortable things of Node. In a nutshell, I see Deno being used for new projects & new requirements rather than an option to migrate a NodeJs project.

2) The future of Mandarine.TS is very very interesting, the amount of features & achievements in a so short period of time makes Mandarine.TS framework something to look at, it still needs a community, more collaborators & enterprise usage. As of right now, Mandarine.TS is a solution for small projects or big projects used by a small amount of people, however, it is expected to have major changes this year 2020 that would change the concept of Mandarine.TS and would make it a enterprise-level solution.

# The end

We have analyzed what Deno is & what Mandarine.Ts framework is, we have seen the possible futures of both & the options we have.

Do you have any thought? I would love to hear it, even if I don't like it or agree. Leave a comment below!.