This is an example of CQRS/Event Sourcing and GraphQL implemented in TypeScript.
This project uses j5ik2o/event-store-adapter-js for Event Sourcing.
- Write API Server(GraphQL)
- Read API Server(GraphQL)
- Read Model Updater on Local
- Docker Compose Support
- Read Model Updater on AWS Lambda
- Deployment to AWS
- Write API Server
- API is implemented by GraphQL (Mutation)
- Event Sourced Aggregate is implemented by j5ik2o/event-store-adapter-js
- GraphQL Server is apollographql/apollo-server, GraphQL Schema tool is MichalLytek/type-graphql
- Read Model Updater
- Lambda to build read models based on journals
- Locally, run code that emulates Lambda behavior (local-rmu)
- Read API Server
- API is implemented by GraphQL (Query)
- GraphQL Server is apollographql/apollo-server, GraphQL Schema tool is MichalLytek/type-graphql, ORM is prisma
$ pnpm docker-build
$ pnpm docker-compose-up
./tools/scripts/docker-compose-up.sh
ARCH=arm64
Container read-api-server-1 Stopping
...
Container docker-compose-migration-1 Started
Container read-api-server-1 Starting
Container read-api-server-1 Started
$ pnpm verify-group-chat
...
GroupChat:
{
"data": {
"getGroupChat": {
"id": "GroupChat-01HPG4EV94HMPT08GZS0ZWW0VJ",
"name": "group-chat-example-1",
"ownerId": "UserAccount-01H42K4ABWQ5V2XQEP3A48VE0Z",
"createdAt": "2024-02-13 02:24:12 +0000 UTC",
"updatedAt": "2024-02-13 02:24:12 +0000 UTC"
}
}
}
...