DEV Community

Chola
Chola

Posted on • Edited on

9

My thoughts on ElysiaJS

Bun in the Oven

Before the Oven

My background in Graphic Design and Motion Graphics had drawn me closer to frontend development as the next step in my career, I found myself really comfortable working in the UI/UX space, but of late I developed an urge to learn more about how apps connect to the rest of the world, I experimented with Backend-as-a-Service systems (BaaS) such as Appwrite, Supabase and Firebase, these left me with an even deeper hunger to want to learn how backend systems work.

ExpressJS logo

I had tried ExpressJS in the past, I understood the concept of it but never really had the interest in working with backend systems until recently when I discovered NestJS - A mature, progressive framework running on NodeJS.
Having a background in Angular development myself, NestJS felt like home. I recommend it to anyone trying to get into the backend world.

Bun logo

100 degrees celsius

When I first read stories about BunJS, I was really excited, not only because it was another "Node killer" but because of the story behind it - being built from the ground up using more performant tools and housing even more libraries by default - unlike Node. It was the same excitement I had when I discovered Cinema 4D (and eventually Blender) taking over from 3DS Max.
Every now and then, great tools begin to show their age due to the foundations they were built upon, and funny enough I happen to be watching Cars 3 as I write this, which has a similar storyline.
Node is battle tested with over 13 years of development and perfection, meanwhile Bun only recently hit version 1.0 which will ofcourse have some minor issues here and there before it can truly take over the scene, but in it's current state it still shows off a massive improvement in requests per second, load times and several other benchmark tests.

Bun benchmarks

Backend on fire

Over time, the world will adopt Bun - I hope, even though as you read this blog, it cannot natively be installed on Windows OS, but I had no problems whatsoever installing it on Ubuntu 20 via WSL2 (Windows Subsystem for Linux). My main interest with BunJS was to try ElysiaJS, an "Ergonomic Framework for Humans", quite basically a faster and more capable ExpressJS thanks mainly to Bun 😎

ElysiaJS statistics
The above image will explain it all - why I was eager to try Elysia. Don't get me wrong Nest is still an all-round production-ready and modern framework, not forgetting it's a breeze to use if you're familiar with Angular, and did I mention it's currently sitting at version 10.2.9?
Well, while at version 0.7.21, Elysia is still pretty impressive despite not having a CLi. I was able to fire it up and manually set up a module system which is basically a folder consisting of a Routes, Controllers and a Services folder, a regime I picked up from Nest, and even though setting up a Microservice should be possible with Elysia (manually) I am yet to try this, something that NestJS offers out of the box with ease!!

My Elysia server consists of a Users and Auth system that relies on Prisma ORM, PostgreSQL database and Lucia Authentication. To run my database locally I used Laragon which requires a manual installation of Postgres as it doesn't come with one out-of-the-box, other than that everything else was a breeze except for one minor issue, Prisma was built for NodeJS and as such requires an installation of Node - for now atleast, once that is set up you're good to go!

From the documentation section of Elysia you will notice it offers several plugins that make Elysia even more capable, these include plugins such as

  • Eden, a secure way for your client to access backend functions
  • Swagger, an endpoint to view all your API endpoint documentation
  • GraphQL, tRPC, A query language for API's, end-to-end typesafe API's
  • CORS, Helmet, Bearer, JWT and CRON just to mention a few

All this comes on top of Elysia's pre-existing features which include:

  • Lifecycle hooks and data transformation,
  • Response validation using schemas (think of typescript interfaces),
  • File uploading and serving,
  • Error Handling,
  • Lazy-loading of modules,
  • Web Sockets,
  • Data streaming,

Here is my Elysia project, I will keep updating it as I learn more, it's pretty similar to ExpressJS 😎

Feel free to contact me for any questions or collaboration requests

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (2)

Collapse
 
aspexp profile image
ASPeXP

Thank you for sharing, Is it possible for you to share your Elysia project? I think it would be good for me to have a guide from another perspective.

Collapse
 
cholasimmons profile image
Chola

I am sorry I never got back to you earlier. Alot has changed with the project but I hope you can find what you're looking for in it.
github.com/cholasimmons/bun-elysia...

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up