24 June 2021
Build scalable Node.js apps faster with this boilerplate
Does setting up a Node.js project hurt your nerves? Gear up for your coding session much faster with a well-tested boilerplate from The Software House. We created it to standardize processes for over 30 Node.js developers to deliver greater value in client projects. Now, your team can have fun with it too.
Static type JavaScript powered by TypeScript 🧐
Static types for a dynamic language ? Meet TypeScript.
According to our State of Frontend and Stack Overflow developer surveys, TypeScript became one of the most wanted and fastest growing technologies in the JavaScript environment.
It becomes really powerful when we have a bigger team and a monorepo structure thanks to shared types across frontend, backend, and desktop applications. And that’s why we use this technology in our boilerplate.
Docker and Containerization 📦
TSH’s Node.js boilerplate works in full inside a Docker container. This gives you access to a docker-compose file that can easily add or extend microservices. Need to add an email client? Add a few lines of code, set up configuration, and your Node.js application is ready for heavy-duty work. Production images are tweaked to provide maximum performance, security, and reduce node_module size.
Made to keep the architecture fresh ✨
Dependency Injection
We based our boilerplate on dependency injection that handles the data flow for application components. Adam, our Head of Node.js, knew you’d get here eventually, so he prepared a deep-dive guide to injection in JavaScript you should see.
The technique works great in a test environment where we can mock and inject fake data and services. For that, we use Awilix as our library of choice.
CQRS Ready
Our Boilerplate uses the Command Pattern to set a clear boundary between business logic and everything related to the framework. By separating these two, you can compress Node.js application’s clunky features into small chunks to increase readability and the quality of coding.
It is also a part of the Command and Query Responsibility Segregation pattern, which is quite useful in building scalable applications.
Multi-communication support 💬
Depending on the business requirements, you can adjust our boilerplate for single or multiple communication options. By default, we use the REST option with the Express layer.
Sometimes, you might need more performance and less abstraction. You’ll be able to switch to Fastify or vanilla Node.js easily.
The Node.js boilerplate has built-in support for the Apollo server, which works as a middleware. Also, nothing stops you from using GraphQL. With API documentation based on communication settings, you can use api-docs in REST communication and GraphQL schema in GraphQL option.
💡 Explore even more Node.js tricks from our Seniors
Optimized for outstanding developer experience 😊
Static code analyzer
We have very strict rules for code quality. But the more rules you have, the easier it is to miss one. Instead of doing manual check-ups, we automate such with ESLint to solve problems.
Code formatting
Having a consistent code style in our projects is very important for us. At the same time, you don’t want to spend ages fixing missing semicolons. That’s why we have Prettier — a code formatting tool that makes your code look consistent across the entire project.
Support for unit and integration test
Unit and integration testing are some of the most critical activities in Node.js application development. Faking services or returning the same response provides information about how your code works and sets a checkpoint that increases test coverage. To make testing easy-peasy and efficient, we use Mocha and Sinon libraries.
Easy debugging
You’d like to cut time on fixing bugs to save yourself from despair and the client from losing money. With this boilerplate beauty, no slow debugging will hurt your sprint, as it’s integrated with VSCode, Web storm, and Node Debugger.
Stay informed about the best practices in software development
📬 Get better at your game with the TechKeeper’s Guide — a bi-weekly list of curated stories on technology, leadership, and culture-building read by professionals like you.
Support for CI / CD
Imagine auto-deploying code to staging, production, and other environments with a single click. You’ll have the option to test between code merge and the app on a fresh machine with no cache or “works for me” issues.
The boilerplate we prepared for you works with GitHub Actions and Bitbucket Pipelines to eliminate repetitive tasks in your CI/CD. Once you have it, diving into business logic will be much easier.
Support for Elastic Beanstalk deploy
Amazon Web Services (AWS) hosts most of The Software House’s applications. We use the Elastic Beanstalk to save time for coding by bootstrapping development or production infrastructure.
Optimized for rapid development
Tapping out repetitive commands like default action, command, or handler structure is a waste of time. We created and included a CLI for you, so that you produce basic templates of code faster with the plopl powered tool.
Support for advanced logging
Access a step-by-step flow of requests and fired events thanks to an integrated Command Pattern. Powered by the Winston library.
Give the boilerplate a chance — it’s bulletproof-tested 🌠
Our Node.js development has become measurably more productive after we adopted this boilerplate. We hope you’ll find it handy too.
You are always welcome to create pull requests and leave feedback for us. Since the tool should make work easier for you, we’re open to your suggestion on how we can upgrade it <3 Just be fair and tell your team about this hack. All right? Peace!