Why Deno could be the right tool for your next project

I recently got a chance to start playing with Deno a secure runtime for javascript and typescript. My initial attraction came from using Rust and typescript as the two main weapons in my arsenal. This to me felt like it only made sense to look at how I can combine the love for both tools to achieve the need for speed on the productivity and application portion of software development. The creator of node.js is also the creator of Deno and his major focus currently is working on the deno project.

Major Benefits

Deno provides a great set of features that make building your application a lot smoother than your standard node project. The control you get from the initial extracting of packages allows for circle references and other nasty bugs to be less of an occurrence. Instead of having to learn each native node module we now can focus on one doc to get the majority of things done like creating new files or fetching data. Integrating with other node packages can still be done to incorporate mixed modules if needed so you are not completely locked in to the deno-land eco system for your next project. In deno at the top level everything is async which allows for minimal boilerplate for simple stand alone methods.

Speed

One of the things that make deno fast is that it is built with v8 and tokio. Tokio is a async runtime for rust for interacting with the network that has zero-cost abstractions allowing bare-metal performance. Bellow is a picture comparing the HTTP server throughput amongst the top runtimes. There are many metrics to look at but, heres one of the main ones in when deciding what to use when it comes to HTTP, the bigger the number the better for the chart below.

Real World Production Example

Here is a real world getting started repo that is production docker ready using oak middleware to help create a REST API in deno. The app is set to launch on ECS Fargate to scale at the systems level and at the application level has security in a couple layers with a ready to go custom instances of mongo, redis, and meilisearch. The application has middle-wares to abstract concerns from validation, spam protection, body-parser, error-handling, redirects and more. The app also has a basic suite of test and automation with circleci to help with keeping things reliable. Checkout the benchmarks folder to get a gist of the speed for a couple of key metrics like concurrency.

Learning Curve

If you are coming from typescript getting started with deno is fairly straight forward after learning how to structure the application since the concepts of index.js is frowned upon. Theres a couple of overall project setup differences like establishing a dep.ts to control all of your application dependancies instead of package.json. Getting started with Deno can be a little confusing since theres a lot of different pieces to bring together that make the Deno runtime environment, if you need help try looking at the deno-manual.

References

https://deno.land/benchmarks#http-server-throughput
https://tokio.rs/
https://github.com/j-mendez/deno-rest-starter
https://deno.land/benchmarks
https://deno.land/manual

Founder of A11yWatch — tinkerer of many things — casual fisherman

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store