DEV Community

Cover image for I am creating a new ✨JavaScript✨ Framework
Armaan Gupta
Armaan Gupta

Posted on


I am creating a new ✨JavaScript✨ Framework

Okay so here's the plan. I will try to create a new javascript backend framework (most probably not because I'm just trying to rewrite pre-existing backend frameworks). My plan for now is to Understand how all of this works. So My first step is to re-create what others have already made, And then I'll move on to making and architecture of the "new" framework.

Introducing Ramen 🍜

Ramen Logo which I got from the internet hehe

yet another open source backend rest API framework! For now all this is, is a cheap copy of Express

You can find the repository for ramen here Currently as of when I'm writing this post, Ramen has the functionality to

  • Detect query parameters
  • Route parameters
  • Get all the headers
  • Send / write a response object

and it follows the route-by-route kind of routing, Where if a user goes to let's say 'http://ip:port/something/id' it will try to match this with different kind of functions provided to the server. And whichever function comes first (i.e. whichever function was appended first) will be used to process that request. It is also capable of finding query parameters, for example if you go to the URL 'http://ip:addr?foo=bar' you can access the value of foo by the Request object provided to you by Ramen simply by doing
req.queryParams I'll try to log all the developments I make in Ramen here only. And somehow this will keep me motivated to keep this project alive all the time :)

Cat with super powers

Top comments (25)

ghana7989 profile image

Why not write this in TS?

ohayouarmaan profile image
Armaan Gupta • Edited

That's something I'm going to do in future. But for now I'm writing it in plain js because I'm just trying to make it work for now, If you will check the second part of the ramen series, I've mentioned that I'm just trying to get a brief idea of how to make it work. And after doing that I'll create a new typescript branch where I'll be writing it again from the ground up and with better code structure.

arindoneatk profile image

This is my fear with all javascript gets built poorly first, then made better later...but then it never gets made better and then tons of users use it lol

Thread Thread
blujedis profile image

Learn Typescript. In the enterprise world basically the it's not a neat toy world, everything in done in TS. As @arindoneatk stated retrofitting is a really bad idea. Wish you the best and look forward to seeing your hard work. If you have Typescript questions just ask. Ppl are nicer than you think and we're all suckers for something cool!

Thread Thread
ohayouarmaan profile image
Armaan Gupta

Yes sure I really appreciate the community and everyone, If you'll checkout the latest development on Ramen I have added TypeScript as a future plan + it's on high priority right now :)

Thread Thread
victorz profile image
Victor Zamanian • Edited

Definitely would make it top priority to eliminate silly bugs before they even happen, even in the early alpha stage.

Not doing so is a sign of fear due to not knowing TypeScript. I would never write plain JS if I could write TS instead.

So learn TS, then do it right, and make it simpler for yourself. Trust me, TS helps you stay more focused, helps your code base make sense sooner, it saves time down the road, as well as immediately.

Good luck with your thing!

michthebrandofficial profile image

Ghana is right. You can also right it in typescript for type safety. It can go a long way for you. But do what you feel is right.

ndaidong profile image
Dong Nguyen • Edited

Good job! Playing with some stuff like this helps to understand many things behind the scene. I confirm that because I created restfun for the same idea.

To parse query parameters from URL, you can use URLSearchParams or node:querystring. I used URLSearchParams first, then realized that querystring is much faster.

Anyway, there utils give you req.query in express without manually parsing url string. You may need them to parse form data too.

Form can be submitted with 'application/x-www-form-urlencoded' or 'application/json' type. If that's 'application/json' you can use JSON.parse as you do. But when that's 'application/x-www-form-urlencoded', you must handle submitted data as url query string.

For req.params, you can use URLPattern polyfill because it has not been implemented in Node.js yet. It can help to handle router and find the matched ones.

I've used this polyfill at first and it worked as well, but the performance is not good (just similar to express). So I replaced it with find-my-way to get better performance (x7 faster than express). You can also refer regexparam and @funjs/route-parser.

There are several algorithms for router matching we can investigate when possible. But among the nodejs frameworks, the uWebSockets.js based ones are still the fastest.

lotfijb profile image
Lotfi Jebali

This is inspiring, keep it up

divya1s2u3p4e5r6g7o profile image

All the best

nbui profile image
Nicolas BUI

Keep going ! Good luck !

jeffchavez_dev profile image
Jeff Chavez

This is encouraging. Great idea!

ohayouarmaan profile image
Armaan Gupta

Hey thanks a lot jeff :D

jeffchavez_dev profile image
Jeff Chavez

I hope someday that I could do something like this.

husseinkizz profile image
Hussein Kizz

cool but frameworks being born everyday sucks on dev ends, which we all guilt of and yet also victims, anyway, it's very courageous to take on such a big task whole heartedly, I hope you will make it, am struggling to document my CSS framework, anyone interested in building a CSS framework?

lakincoder profile image
Lakin Mohapatra


bsaqqa profile image
Baraa Al Saqqa

Nice 🌺.
Go Ahead Bro 💪

siddharthshyniben profile image

This is quite cool!

Building a framework is not an easy feat - I've tried myself. I'm glad you found enough motivation to start on such a big project! Looking forward to seeing your work!

mayormankind profile image
Makinde Mayowa

That's a great one bro!! Ramen on the move. The name is ... 😂

cobialor profile image

I appreciate the fact that you have very good understanding of how computers and browsers interact.

codeauthor profile image
Alfred Nwanokwai

That's a good one bro.

gilfewster profile image
Gil Fewster

Great idea for a project to learn from and extend your skills. Looking forward to watching this develop in 2023.

ohayouarmaan profile image
Armaan Gupta

Thanks Gil appreciate it :)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

11 Tips That Make You a Better Typescript Programmer


1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields


Read the whole post now!