/nodejs-microservice-ddd-cqrs-eventsourcing-swagger

A Node.js CQRS and Event Sourcing Microservice Example Using Nest.js, Event Store, and Swagger

Primary LanguageTypeScript

Logo

A Node.js CQRS/ES Swagger API Microservice Boilerplate

Description

This is an application boilerplate that demonstrates how to use Nest.js and Event Store to create a RESTful Users API microservice.

Please note that commands have been implemented and they do write into the Event Store, however, queries for denormalized views have some boilerplate but it is up to you to implement them using your favorite database technology of choice.

In case you don't feel like downloading dependencies locally, I've added support for Docker so follow those instructions in "Running the app" and you'll have everything up and running in less than 2 minutes.

Dependency Table

Name Version
EventStore latest
Node.js Dubnium
TypeScript 3
Docker Compose 3

Installation

$ yarn

Running the app

# development
$ yarn start

# watch mode
$ yarn start:dev

# production mode
$ yarn start:prod

# analyze production mode
$ yarn start:analyze

# using with Docker
$ ./scripts/up.sh # to start
$ ./scripts/down.sh # to stop

Relateds Links

Medium Article (Part 1): https://medium.com/@qasimsoomro/building-microservices-using-node-js-with-ddd-cqrs-and-event-sourcing-part-1-of-2-52e0dc3d81df

Medium Article (Part 2): https://medium.com/@qasimsoomro/building-microservices-using-node-js-with-ddd-cqrs-and-event-sourcing-part-2-of-2-9a5f6708e0f

Swagger Explorer URL: http://localhost:7070/api

Event Store URL: http://localhost:2113

Test

# unit tests
$ yarn test

# e2e tests
$ yarn test:e2e

# test coverage
$ yarn test:cov

Release History

  • 0.1.0
    • The first proper release
    • CHANGE: Minimalist users app using Event Store
  • 0.0.1
    • Work in progress