Building a new backend — Part 1 – lookapanda – Medium

Building a new backend — Part 1  #discord #webdevelopment #react #javascript #node #reactjs

  • Building a new backend — Part 1In this story I’d like to document my experiences in building a new backend.It represents my personal experiences and is not related to my profession as a Software Engineer.What is the backend for?This is a legitimate question, of course.
  • There is no real goal yet, I see it more like a personal challenge and practice.Some of my first pieces of code using LaravelI already built a backend quite some time ago already written in PHP using Laravel.
  • Times change quickly in a developers world and today I’m mostly programming in JavaScript (ES6, Node, etc.) and not that much in PHP anymore.Today (2017) I want to create something new again using the most modern technologies I can find.
  • REST APIs access information after all and said information needs to be stored somewhere.With my PHP API I was using MySQL (or actually MariaDB) and with my Node API it was MongoDB.
  • It should be easy to use but also powerful.In my next blog post I will share my first experiences in using Cassandra for building the database and probably also my decission for the framework I’ll be using.If you’ve come so far to read this very line, I want to say thank you.

In this story I’d like to document my experiences in building a new backend.
It represents my personal experiences and is not related to my profession as a Software Engineer. This is a legitimate…

@ReactDOM: Building a new backend — Part 1 #discord #webdevelopment #react #javascript #node #reactjs

Building a new backend — Part 1

In this story I’d like to document my experiences in building a new backend.

It represents my personal experiences and is not related to my profession as a Software Engineer.

What is the backend for?

This is a legitimate question, of course. Although, I don’t really know yet what I want to achieve with my new backend. There is no real goal yet, I see it more like a personal challenge and practice.

I already built a backend quite some time ago already written in PHP using Laravel. I was bored at that time and I didn’t always want to use third party providers for simply uploading images. So I decided to create my very own image hosting service.

After some research and a recommendation from a friend, I went for Laravel.

I liked the fact that Laravel offers the so called Eloquent ORM.

It is super easy to use and gives me a great and quick overview about what exactly is going on. In no time, I built my first RESTful API for uploading images, even though I never fully finished it to date.

That was in 2015 or so. Times change quickly in a developers world and today I’m mostly programming in JavaScript (ES6, Node, etc.) and not that much in PHP anymore.

Today (2017) I want to create something new again using the most modern technologies I can find. Back in the days I didn’t really think of best practices, security and all that stuff. I mean, of course I still tried to do it in the best and most secure way possible, but I was not really aware how things should be.

I want to create something new using the most modern technologies.

This time I want to attack that in a different way. I need to plan first before I can actually start building something.

Where should I begin?

Another wonderful question. I was thinking about this question for some time and it probably is the best if I start with the database. REST APIs access information after all and said information needs to be stored somewhere.

With my PHP API I was using MySQL (or actually MariaDB) and with my Node API it was MongoDB. Both clearly had their advantages and disadvantages for me.

I had (and still have) a huge base of experience with MySQL due me beginning to understand and learn MySQL (along with PHP) in my earlier days over 10 years ago (Side note: I’m 23 now).

However, I still don’t know everything about MySQL and I consider that a disadvantage. There is way too much to know about it meaning: It’s way too complex. But does that mean it’s bad? No, of course not. Back in the days, I didn’t even know ORM exist and two years ago I only started to learn about it.

Today I have a lot more experience. For my Node backend I was using MongoDB, as I said. It felt really great using MongoDB (Mongoose to be more specific) because it just worked. At least in the beginning. The more complex the routes got, the more complex it was doing all that stuff with MongoDB. Clearly, it was also the lack of knowledge and, most important, planning that lead to the chaos later on.

So what database will I use?

Well, over a year ago I learned about a great and impressing piece of software called Discord. Discord is an

All-in-one voice and text chat for gamers that’s free, secure, and works on both your desktop and phone.

I love it. Not only is it super easy to use, looks and feels great, no, it’s also using state of the art technologies like React and Electron for their UI. And a lot more of other stuff that is too much to put into this blog post now. If you’re interested, you can read a lot about it on their own Blog.

Back to the question. What database will I use? Well, it happens that Discord is using Apache’s Cassandra for their own database. I like Discord and I like their technology stack plus I have absolutely no experience in using Cassandra. Meaning, I will use Cassandra.

I have absolutely no experience in using Cassandra. Meaning, I will use Cassandra.

Yay, I found the database I want to use. But why exactly? Well, as I said, I like the technology stack of Discord. Obviously, that is not a real reason to just use a completely new technology. In the beginning of this blog post, I mentioned that I want to practice and gain more experience. This is a reason why I want to use Cassandra for my API’s database. Additionally, Cassandra is said to be extremely performant.

There is a plausible reason why Discord is using Cassandra, of course. In one of their blog articles, they write why they’ve chosen Cassandra.

They started using MongoDB but now switched to Cassandra for performance reasons. Obviously, they had planning of everything and expected that at one point, MongoDB would just not be enough anymore. If you have a look at the graph above, you can also see why.

So, let’s sum it up. I used Laravel (PHP) with MySQL for my first REST API. Then I switched to Node (Hapi) with MongoDB (Mongoose and later Camo).

And now I want to use Cassandra for my database.

What will I use for my actual backend code? I don’t really know yet, but I probably will still use JS / Node. The question is: What framework?

There are a lot of Node frameworks that can be used for building a RESTful API. There’s Express, Hapi, Koa, Restify and a lot more. I need to think and make plans on what is the best for me. It should be easy to use but also powerful.

In my next blog post I will share my first experiences in using Cassandra for building the database and probably also my decission for the framework I’ll be using.

If you’ve come so far to read this very line, I want to say thank you. I just wanted to share my thoughts and you seem to be interested. Good job!

Building a new backend — Part 1 – lookapanda – Medium