bitoverflow logobitoverflow logo
Navigate back to the homepage

How and why I built A nodeJs-MongoDb Starter kit

Sachin Thakur
October 16th, 2018 · 2 min read

About me My name is Sachin Thakur and i’m a full stack web developer. i’m working with NodeJs and ReactJs. I like learning new skills and constantly working on improving my skills. I enjoy building new things and solving problems, always ready to tackle new problems and finding optimal solution for a problem.\ My mantra is to hold myself to high standards of a software development. This means that I am committed to: write the best code I can produce in the scope of the project, accountability, responsiveness, and setting clear expectations.

blurred background cellphone coffee 842554

The problem I wanted to solve

Now this problem is quite common with all the developers. Whenever we start a new project we have to repeat the same steps again and again of downloading the dependencies and requiring all the dependencies into our project. We repeat this process again and again in every project and sometimes it becomes hectic and we forget certain steps and then we have to debug the entire app to see where we made the mistake where we form to import something or installing certain dependencies into our application. Now you see the problem. It might not be happening with you now but at a certain point in our development phase we will face this problem.\ Every time we start a new project, we’re overwhelmed at the selection of build tools, testing frameworks, component libraries and more. Best solution? A starter kit

What is A nodeJs-MongoDb Starter kit?

Now the question arises how can we solve this problem. Now the simple answer is the Starter Code or a boilerplate. What is boilerplate or Starter Code? A boilerplate is a unit of writing that can be reused over and over without change. By extension, the idea is sometimes applied to reusable programming as in “boilerplate code.” This is why Starter Code is important because you don’t want to write the same code again and again.

Tech stack

Now the next question arises what packages should be used in this starter code. When it comes to NodeJs we know that there are a lot of choices when it comes to doing one thing. So the choice was difficult but I have to choose something. So, I went on with ExpressJs as NodeJs and MongoDB as Database and PassportJs for authentication with jwt tokens. It was the best choice I could think of but if anyone has any other options I’m open to any suggestion.

The process of building A nodeJs-MongoDb Starter kit

The process of building this Starter code was quite simple as I have already developed a lot of applications with NodeJs and ExpressJs. But when it came to database and authentication process it was difficult to choose between the SQL or NoSQL database. But since the NoSQL database are quite common these days so I choose to go with MongoDB.

What this starter kit include

It includes API routes for auth where you can easily start with login and register with NodeJs and MongoDb(Mongoose) as fast as possible. You can easily expand this project with a proper folder structure which is properly organised in an easy and understandable manner.

This starter kit will provide the following purposes:

It encourages consistency. It avoids repeating work. It protects from forgetting important details. Sometimes it’s very common that you forgot some important libraries and imports and it can waste a lot of the time in debugging. Starter Kit or boilerplate helps Beginners with getting started with the NodeJs API as fast as possible.

Final thoughts and next steps

The main reason for building this Starter Code was to help others and myself by not going through that process of installing and following the same steps again and again to create even a simple API. if anyone wants to contribute and help others or even have some suggestions for me you can have a look at my code, the GitHub repository is [Github repository](https://github.com/thakursachin467/nodejs-starter-code) 🤗 🤩.

More articles from Sachin Thakur

How i started learning web development and React

My approach towards learning ReatJs was like most other self-taught developers. Go through Youtube tutorials and a little bit of documentation.

September 2nd, 2018 · 3 min read

Securing GraphQL API from malicious queries

learn about Security and Efficiency for your GraphQl API

May 6th, 2020 · 5 min read
© 2018–2020 Sachin Thakur
Link to $https://twitter.com/thakursachin467Link to $https://github.com/thakursachin467Link to $https://www.linkedin.com/in/thakursachin467/