/identity-master

identity service provider

Primary LanguageTypeScript

Clean Architecture base template using Fastify with Typescript

  • Minimal project template following clean architecture principles
  • Built in Typescript
  • Blazing fast Node.js framework, Fastify
  • Fancy auto generated docs using OpenAPI specification v3
  • MongoDB with Mongoose for the persistence layer
  • Configured with Eslint and Jest out the box
  • Easy to reason about folder structure

Overview

Clean Architecture is a software architecture pattern that emphasizes the separation of concerns and the independence of the various components of a software system. It was first introduced by Robert C. Martin (also known as Uncle Bob) and it has become pretty trendy recently despite the fact that he introduced it in his blog with a post titled "The Clean Architecture" in 2012. This architecture pattern is highly influenced by other patterns like Hexagonal Architecture or Onion Architecture as Robert C. Martin points out in his blog post.

clean architecture

Project folder structure

├── src
│   ├── core (Entities and use cases)
│   │   ├── entities     (Entities)
│   │   ├── repositories (Contract Interfaces)
│   │   └── services     (Use cases)
│   ├── infrastructure (Controllers, Gateways, Presenters)
│   │   ├── database (Data access objects)
│   │   │   ├── <entity>
│   │   │   │   ├── <entity>.dao.ts
│   │   │   │   └── <entity>.schema.ts
│   │   ├── http (Fastify framework related code)
│   │   │   ├── controllers
│   │   │   ├── plugins
│   │   │   ├── routes
│   │   │   ├── schemas
│   │   │   └── server
│   │   │       └── index.ts
│   │   └── repositories (Implementation of Contract Interfaces defined in core)
│   └── main.ts (application entry point)
├── tests
│   └── test.spec.ts

Getting started