Clean Architecture Api Boilerplate

screenshot of Clean Architecture Api Boilerplate
express

A boilerplate for creating TypeScript APIs following the Clean Architecture principles.

Overview

This article discusses the implementation of a Clean Architecture API using TypeScript and Node.js. The author aims to create a flexible boilerplate that can be customized for various frameworks and data storage options. The API includes features such as authentication, CRUD operations for users, tokens, and refresh tokens. The article also introduces the concept of clean architecture and provides a folder structure for organizing different layers of the application.

Features

  • Authentication system
  • CRUD operations for users, tokens, and refresh tokens
  • Flexible framework options (replace express.js with any desired framework)
  • Support for various data storage options (Postgres, MSSQL, MySQL, MariaDB, SQLite3, Oracle, Amazon Redshift)
  • Ability to create custom repositories for different data storage needs
  • Cross-cutting concern layer for adding validations and helpers
  • Implementation of clean architecture principles

Summary

The article presents a Clean Architecture API implementation using TypeScript and Node.js. The author emphasizes flexibility by allowing customization of frameworks and data storage options. The API includes features such as authentication and CRUD operations for users, tokens, and refresh tokens. The implementation follows the principles of clean architecture and provides a folder structure for organizing different layers of the application. The article also highlights the ability to create custom repositories and add cross-cutting concerns. Overall, the provided boilerplate aims to be a solid foundation for building robust and scalable APIs.

express
Express

Express.js is a simple Node.js framework for single, multi-page, and hybrid web applications.

eslint
Eslint

ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.