Partner with CodeWalnut to drive your digital growth!

Tell us about yourself and we will show you how technology can help drive business growth.

Thank you for your interest in CodeWalnut.Our digital expert will reach you within 24-48 hours.
Oops! Something went wrong while submitting the form.
Typescript

Node JS open source code

April 12, 2024
5 Min
Node-JS Banner

A brief backdrop

CodeWalnut team builds several full stack web applications using node.js.

Writing clean, maintainable code is much more than just making it work functionally.

Developers tend to miss this critical aspect when hurrying to build the features.

So we decided to open source this node.js code and show how clean code is written.

Secondly, we discovered a common problem amongst retail companies implementing SAP.

While SAP is implemented in the headquarters, if you need to buy SAP license for each store, the license costs will double at the least. Most retailers can’t afford it.

Then what's the way out?

This reusable node.js code base and APIs could be the answer.

In this document, we introduce a solution offered by CodeWalnut that eliminates the need for costly SAP store licenses.

This open-source Node.js-based application captures store transactions and makes the data ready to synchronize with SAP.

In this blog post, we'll delve into the nitty-gritty of this solution, its coding standards, and clear documentation.

Who is this document for?

For node.js developers

When you write node.js code for full stack applications, it isn't just about functionality; it's also about the quality of code.

Writing clean code adhering to SOLID principles and with a focus on unit test coverage is needed.

We've even run a SonarQube report on this codebase to show the level of code quality.

For Retail companies with SAP implemented.

Many retail companies face the challenge of managing transactions across multiple stores, while the enterprise data is captured using SAP at their headquarters.

To capture the store transactions efficiently, you typically have two options:

A) Acquire an expensive SAP store license per store.

B) Develop a custom web application that integrates with SAP via APIs or nightly batch processes.

At CodeWalnut, we were given the second path.

We've created a complete store application with a Node.js backend, which we now offer as open source.

We've meticulously studied SAP's API structures and user interfaces, and crafted secure APIs to capture sales, expenses, and petty cash transactions in the store.

Our solution will help you to store this data in a relational database and perform a nightly sync with SAP or push it via APIs.

Coding standards

The development follows a strict set of coding standards, including:

  • Environments for CommonJS, ECMAScript 2021, and Jest testing.
  • Extending rules from ESLint recommended, Airbnb Base, Prettier, and TypeScript ESLint recommended configurations.
  • Parsing with the TypeScript ESLint parser.
  • Implementing plugins for TypeScript, Promise handling, and complexity control.
  • Defining specific rules, such as disallowing console usage, enforcing proper promise handling, limiting code complexity, and customizing import and TypeScript rules.
  • Additionally, we maintain consistent code styling preferences for bracket spacing, line length, semicolons, single quotes, tab width, and trailing commas, as specified in our Prettier configuration.

These standards ensure that our code is not only functional but also highly readable and maintainable years later.

Resources

To explore our open-source repository and dive into the specifics of our solution.

You'll find the link conveniently located at the conclusion of this blog.

Furthermore, we have created a comprehensive project explanation document for our open-source repository.

Within this document, you will find detailed explanations for each module.

Additionally, we're excited to offer an extensive Postman collection, comprising more than 45 descriptive APIs across all three modules.

To utilize this resource, simply fork the collection by following the link provided in the blog's conclusion.

As previously mentioned, our open-source project undergoes scrutiny through SonarQube, and as a result, we've generated a SonarQube report.

offering valuable insights with code quality and analysis. Please have a look:

SolarQube Report

The SonarQube report reveals a code quality assessment with no bugs or vulnerabilities, a thorough review of hotspots, but it identifies 7 code smells.

Additionally, code coverage stands at 57.2%, with 11.1% duplicate lines within a codebase of 13,000 lines.

Conclusion

With this open-source solution, we're not only saving companies from the burden of expensive SAP licenses but also ensuring that developers can work with clean code and robust unit test coverage.

Feel free to explore our resources. We're excited to share this valuable tool with the community.

Node.js Open Source GitHub Repo: click here

Project Explanations: click here

Postman API’s Collections: click here

Anytime you need any clarification on using this code base or need any guidance on writing clean Node.js code - drop a mail
To nattu@codewalnut.com

Author
Umesh Dewangan Photo
Umesh Dewangan
Author
No items found.

Related Posts