DEV Community

Reaper
Reaper

Posted on

RouteX | API Router for Node (Yes, another one!)

Ahoy Humans!

I've not been very active on here for the past months but as we all know, I keep making stuff. Stupid stuff, but stuff.

Covid got me productive and I finally have a well built app out there now.

TillWhen.

But!

This post isn't about it. The post is about a file tree based router that I built this weekend and is in active development right now.

Why though?

In one word: Next.js.

I started using Next.js way to much the past year, my website, barelyhuman's website , TillWhen, and a few other simple apps that I built are all on Next.js. I know, I'm the same guy who was ranting about efficient software but trust me the amount of code I would've have written for route management would have been equal to the the static's that are generated by the framework so I went with it.

The framework's file tree based routing is the reason I started using and I stuck with it because of how convenient it was. In fact, TillWhen was built with Next.js both the backend and the frontend so yeah, I like Next.js and I'm using it way too much.

Way too much?

Yeah, TillWhen is a monolith that takes up 300-500MB of space which is way too much for something so simple and while the actual app is just about 35-40MB the node_modules take the remaining of the space.

Why? because a lot of pages rendered on TillWhen are server sided and require the node_modules to exist for them to work and we all know how well node_modules grows. The actual backend code and frontend code if compiled will hardly be around 40MB for the backend and under 4MB for the frontend but since I have a monolith with server renders and a huge dependency on node_modules, I have an app that ranges from 300-500MB depending on how many modules I've gotten rid of by now, by implementing my own versions of it.

Know that this size is mostly the UI Component libraries that are being used in TillWhen. And since I'm not using most of the components it makes no sense to have the whole library installed.
So I started moving them out after I implemented the few components that I was using from them.

And, I realised that I could reduce the size if built a compiler for the app that would just take in the required elements and not have the other's exist at all but since that's going to be a time taking process my other approach was to go back to my normal way of building web apps. Frontend and Backend built separately.

Now, while that is a feasible idea for now, I'd still miss the routing that was provided by it so.....

I built it.

RouteX

I'm not writing anything here about it, just going to link you to it.

Routex
Source

Top comments (0)