DEV Community

Cover image for NestJS and Mercurius full GraphQL Back-end template
Afonso Barracha
Afonso Barracha

Posted on

NestJS and Mercurius full GraphQL Back-end template


I am excited to share my GraphQL Back-end template that is not only easy to develop but also cost-effective to host, built with NestJS and Mercurius.

Where can you find it?

You can find this template on my GitHub repository.

Using it is super simple, just click on the Use this template to begin. Afterward, make sure to modify the CODEOWNERS on the .github folder to reflect your GitHub username. You can then remove or alter the Lastly, in the main folder, you will most likely want to update the and files.

What about the License and Header?

The template is licensed under the Mozilla Public License 2.0, which means that only modifications to the existing files need to be disclosed. Any additional modules you add to the template remain your private property.

As for the header, it is conveniently placed for easy modification to suit your project in the .eslintrc.js file. After updating it, to change the header on all files, all you need to do is run yarn lint.

How is hosting made easy?

The template run on the Node.JS cluster module, utilizing a round-robin model for load balancing, making it easily scalable on a single Virtual Private Cloud (VPC). All you need to do is adjust the WORKOUTS_COUNT environment variable. By default, the template uses all available threads to run the app in a production environment, if this variable is not specified.

This structure enables affordable hosting on any Ubuntu/Debian-based Linux VPC using open-source Platform as a Service (PaaS) tools like dokku or caprover. You can scale your VPC vertically whenever your app needs to grow.


My motivation behind making this template publicly available was to support solo developers in bringing their ideas to life with ease, either for production projects or small hackathons. This template handles the more tedious and repetitive tasks, so you can focus on what truly matters: developing your project.

About the Author

Hey there! I am Afonso Barracha, your go-to econometrician who found his way into the world of back-end development with a soft spot for GraphQL. If you enjoyed reading this article, why not show some love by buying me a coffee?

Lately, I have been diving deep into more advanced subjects. As a result, I have switched from sharing my thoughts every week to posting once or twice a month. This way, I can make sure to bring you the highest quality content possible.

Do not miss out on any of my latest articles – follow me here on dev, on twitter and LinkedIn to stay updated. I would be thrilled to welcome you to our ever-growing community! See you around!

Top comments (0)