Skip to content

A backend template for creating projects with Modular Monolith, Typescript, Nest.JS, Domain Driven Design and Event-Driven Architecture

License

Notifications You must be signed in to change notification settings

woliveiradev/cosmic-blueprint

Repository files navigation

Cosmic Blueprint

Template for Back-End projects with Nodejs, Nestjs, Modular Monoliths and Domain Driven Design.

Table of Contents

Introduction

This repository provides a basic framework for Back-End projects using technologies such as Nodejs, Nestjs and approaches such as Domain Driven Design, Event-Driven Architecture, monolithic modular architecture or microservices. Feel free to modify or contribute to this template.

Current Versions

This template is based on:

  • Nodejs v20.9.0
  • pnpm v9.1.2
  • Typescript v5.4.5
  • Nestjs v10.3.8
  • Express v4.18.2

Features

  • Code style with Eslint, Prettier and Editorconfig
  • Lefthook for git hook commands
  • Semantic commit with Commitlint
  • Automated tests with Jest
  • CORS
  • Security http headers with Helmet

Structure of Template

|- src
|  |- config
|  |  |- cors.config.ts
|  |  |- env.config.ts
|  |  |- index.ts
|  |  └─ versioning.config.ts
|  |- core
|  |  |- __tests__
|  |  |- aggregate.core.ts
|  |  |- command.core.ts
|  |  |- entity.core.ts
|  |  |- event.core.ts
|  |  |- id.core.ts
|  |  |- index.ts
|  |  |- query.core.ts
|  |  |- repository.core.ts
|  |  |- service.core.ts
|  |  |- types.core.ts
|  |  |- use-case.core.ts
|  |  └─ value-object.core.ts
|  |- libs
|  |  |- __tests__
|  |  |- deep-freeze.lib.ts
|  |  |- exception.lib.ts
|  |  |- index.ts
|  |  |- random.lib.ts
|  |  └─ result.lib.ts
|  |- root
|  |  |- index.ts
|  |  |- init.root.ts
|  |  └─ module.root.ts
|- .editorconfig
|- .env.example
|- .eslintrc.js
|- .nvmrc
|- commitlint.config.js
|- lefthook.yml
|- nest-cli.json
|- package.json
|- README.md
|- tsconfig.build.json
└─ tsconfig.json

Usage

To utilize this template in your projects, follow these steps:

Click on the "Use this template" button located at the top of the repository. This will redirect you to the page for creating a new repository.

Once you've created your new repository, clone it to your local machine. You can do this by running the command git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY in your terminal, replacing YOUR-USERNAME/YOUR-REPOSITORY with the appropriate details of your new repository.

Please note that this method does not preserve the entire commit history of the template. This means that all the changes you make will be based on a clean commit history, allowing you to make modifications without any historical context from the template.

Tests

  • To run the tests, execute pnpm test;
  • To run only unit tests, execute pnpm test:unit;
  • To run only e2e tests, execute pnpm test:e2e;

Contribution

Contributions are very important to me and to everyone who wants to benefit from this template.

How to contribute? If you have a new feature that you want to implement or have come across an error that you know the reason for and would like to fix, you can follow this process:

  • Fork this repository;
  • Create a branch with your feature: git checkout -b my-modification;
  • Commit your changes: git commit -m 'mod: My modification';
  • Push to your branch: git push origin my-modification;

After the merge of your pull request is done, you can delete your branch.

Additional Resources

About

A backend template for creating projects with Modular Monolith, Typescript, Nest.JS, Domain Driven Design and Event-Driven Architecture

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published