All Projects → hardyscc → Nestjs Cqrs Starter

hardyscc / Nestjs Cqrs Starter

NestJS CQRS Microservices Starter Project

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Nestjs Cqrs Starter

Ultimate Backend
Multi tenant SaaS starter kit with cqrs graphql microservice architecture, apollo federation, event source and authentication
Stars: ✭ 978 (+1122.5%)
Mutual labels:  graphql, microservices, event-sourcing, eventstore, nestjs, ddd, cqrs
Kreta
Modern project management solution
Stars: ✭ 177 (+121.25%)
Mutual labels:  graphql, microservices, event-sourcing, ddd, cqrs
Pitstop
This repo contains a sample application based on a Garage Management System for Pitstop - a fictitious garage. The primary goal of this sample is to demonstrate several software-architecture concepts like: Microservices, CQRS, Event Sourcing, Domain Driven Design (DDD), Eventual Consistency.
Stars: ✭ 708 (+785%)
Mutual labels:  microservices, event-sourcing, ddd, cqrs
eventuous
Minimalistic Event Sourcing library for .NET
Stars: ✭ 236 (+195%)
Mutual labels:  cqrs, ddd, eventstore, event-sourcing
Equinoxproject
Full ASP.NET Core 5 application with DDD, CQRS and Event Sourcing concepts
Stars: ✭ 5,120 (+6300%)
Mutual labels:  event-sourcing, eventstore, ddd, cqrs
Dotnet New Caju
Learn Clean Architecture with .NET Core 3.0 🔥
Stars: ✭ 228 (+185%)
Mutual labels:  microservices, event-sourcing, ddd, cqrs
nestjs-boilerplate-microservice
Nestjs Microservice boilerplate: apply DDD, CQRS, and Event Sourcing within an event driven architecture
Stars: ✭ 270 (+237.5%)
Mutual labels:  cqrs, ddd, eventstore, nestjs
Event Sourcing Castanha
An Event Sourcing service template with DDD, TDD and SOLID. It has High Cohesion and Loose Coupling, it's a good start for your next Microservice application.
Stars: ✭ 68 (-15%)
Mutual labels:  event-sourcing, eventstore, ddd, cqrs
Cronus
Cronus is a lightweight framework for building event driven systems with DDD/CQRS in mind
Stars: ✭ 139 (+73.75%)
Mutual labels:  microservices, event-sourcing, ddd, cqrs
Akka Ddd
Akka CQRS/ES framework
Stars: ✭ 330 (+312.5%)
Mutual labels:  microservices, event-sourcing, ddd, cqrs
Eventually Rs
Event Sourcing for Rust
Stars: ✭ 277 (+246.25%)
Mutual labels:  event-sourcing, eventstore, ddd, cqrs
Ddd Leaven Akka V2
Sample e-commerce system #Microservices #Akka #Reactive-DDD #CQRS
Stars: ✭ 362 (+352.5%)
Mutual labels:  microservices, event-sourcing, ddd, cqrs
Digital Restaurant
DDD. Event sourcing. CQRS. REST. Modular. Microservices. Kotlin. Spring. Axon platform. Apache Kafka. RabbitMQ
Stars: ✭ 222 (+177.5%)
Mutual labels:  microservices, event-sourcing, ddd, cqrs
Cqrs
cqrs framework in go
Stars: ✭ 179 (+123.75%)
Mutual labels:  microservices, event-sourcing, eventstore, cqrs
Event Sourcing Jambo
An Hexagonal Architecture with DDD + Aggregates + Event Sourcing using .NET Core, Kafka e MongoDB (Blog Engine)
Stars: ✭ 159 (+98.75%)
Mutual labels:  microservices, event-sourcing, ddd, cqrs
iam-ddd-cqrs-es-nestjs
Identity and Access Management
Stars: ✭ 34 (-57.5%)
Mutual labels:  cqrs, ddd, eventstore, event-sourcing
Eshoponcontainersddd
Fork of dotnet-architecture/eShopOnContainers in full DDD/CQRS design using my own patterns
Stars: ✭ 126 (+57.5%)
Mutual labels:  microservices, eventstore, ddd, cqrs
Todomvc Ddd Cqrs Eventsourcing
Implementation of basic Todo app via tastejs/todomvc in C#/Typescript with eventsourcing, cqrs, and domain driven design
Stars: ✭ 134 (+67.5%)
Mutual labels:  microservices, eventstore, ddd, cqrs
Aggregates.net
.NET event sourced domain driven design model via NServiceBus and GetEventStore
Stars: ✭ 261 (+226.25%)
Mutual labels:  microservices, eventstore, ddd, cqrs
Go Api Boilerplate
Go Server/API boilerplate using best practices DDD CQRS ES gRPC
Stars: ✭ 373 (+366.25%)
Mutual labels:  microservices, event-sourcing, ddd, cqrs

NestJS CQRS Microservices Starter

Description

A starter project which featuring advanced microservice pattern with GraphQL, based on Domain-Driven Design (DDD) using the command query responsibility segregation (CQRS) design pattern.

Technologies

Installation

git clone https://github.com/hardyscc/nestjs-cqrs-starter.git <Your_Project_Name>
cd <Your_Project_Name>

npm install

Usage

Start MySQL

Start MySQL docker instance.

docker run --name some-mysql -d -p 3306:3306 -e "MYSQL_ROOT_PASSWORD=Admin12345" -e "MYSQL_USER=usr" -e "MYSQL_PASSWORD=User12345" -e "MYSQL_DATABASE=development" bitnami/mysql:5.7.27

Connect using MySQL docker instance command line.

docker exec -it some-mysql mysql -uroot -p"Admin12345"

Create the Databases for testing

CREATE DATABASE service_user;
GRANT ALL PRIVILEGES ON service_user.* TO 'usr'@'%';

CREATE DATABASE service_account;
GRANT ALL PRIVILEGES ON service_account.* TO 'usr'@'%';
FLUSH PRIVILEGES;

Clean-up all data if need to re-testing again

DELETE FROM service_account.ACCOUNT;
DELETE FROM service_user.USER;

Start EventStore

docker run --name some-eventstore -d -p 2113:2113 -p 1113:1113 eventstore/eventstore

Create the Persistent Subscriptions

curl -L -X PUT "http://localhost:2113/subscriptions/%24svc-user/account" \
  -H "Content-Type: application/json" \
  -H "Authorization: Basic YWRtaW46Y2hhbmdlaXQ=" \
  -d "{}"

curl -L -X PUT "http://localhost:2113/subscriptions/%24svc-account/user" \
  -H "Content-Type: application/json" \
  -H "Authorization: Basic YWRtaW46Y2hhbmdlaXQ=" \
  -d "{}"

Start the microservices

# Start the user service
nest start service-user

# Start the account service
nest start service-account

# start the gateway
nest start gateway

Testing

Goto GraphQL Playground - http://localhost:3000/graphql

Create user with a default saving account

mutation {
  createUser(input: { name: "John" }) {
    id
    name
  }
}

OR

curl -X POST -H 'Content-Type: application/json' \
-d '{"query": "mutation { createUser(input: { name: \"John\" }) { id name } }"}' \
http://localhost:3000/graphql

You should see something like this

  1. Under service-user console

    Async CreateUserHandler... CreateUserCommand
    query: START TRANSACTION
    query: INSERT INTO `USER`(`id`, `name`, `nickName`, `status`) VALUES (?, ?, DEFAULT, DEFAULT) -- PARAMETERS: ["4d04689b-ef40-4a08-8a27-6fa420790ddb","John"]
    query: SELECT `User`.`id` AS `User_id`, `User`.`status` AS `User_status` FROM `USER` `User` WHERE `User`.`id` = ? -- PARAMETERS: ["4d04689b-ef40-4a08-8a27-6fa420790ddb"]
    query: COMMIT
    Async ActivateUserHandler... ActivateUserCommand
    query: UPDATE `USER` SET `status` = ? WHERE `id` IN (?) -- PARAMETERS: ["A","4d04689b-ef40-4a08-8a27-6fa420790ddb"]
    
  2. under service-account console

    Async CreateAccountHandler... CreateAccountCommand
    query: START TRANSACTION
    query: INSERT INTO `ACCOUNT`(`id`, `name`, `balance`, `userId`) VALUES (?, ?, DEFAULT, ?) -- PARAMETERS: ["57c3cc9e-4aa9-4ea8-8c7f-5d4653ee709f","Saving","4d04689b-ef40-4a08-8a27-6fa420790ddb"]
    query: SELECT `Account`.`id` AS `Account_id`, `Account`.`balance` AS `Account_balance` FROM `ACCOUNT` `Account` WHERE `Account`.`id` = ? -- PARAMETERS: ["57c3cc9e-4aa9-4ea8-8c7f-5d4653ee709f"]
    query: COMMIT
    

Query the users

query {
  users {
    id
    name
    accounts {
      id
      name
      balance
    }
  }
}

OR

curl -X POST -H 'Content-Type: application/json' \
-d '{"query": "query { users { id name accounts { id name balance } } }"}' \
http://localhost:3000/graphql

Output :

{
  "data": {
    "users": [
      {
        "id": "4d04689b-ef40-4a08-8a27-6fa420790ddb",
        "name": "John",
        "accounts": [
          {
            "id": "57c3cc9e-4aa9-4ea8-8c7f-5d4653ee709f",
            "name": "Saving",
            "balance": 0
          }
        ]
      }
    ]
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].