Skip to content

Commit d264da8

Browse files
committed
Updated sample implementation to use MongoDB event store
1 parent 2250cc8 commit d264da8

File tree

22 files changed

+143
-838
lines changed

22 files changed

+143
-838
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![](https://dcbadge.vercel.app/api/server/fTpqUTMmVa?style=flat)](https://discord.gg/fTpqUTMmVa) [<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" height="20px" />](https://www.linkedin.com/in/oskardudycz/) [![Github Sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/oskardudycz/)](https://github.com/sponsors/oskardudycz/) [![blog](https://img.shields.io/badge/blog-event--driven.io-brightgreen)](https://event-driven.io/?utm_source=event_sourcing_nodejs) [![blog](https://img.shields.io/badge/%F0%9F%9A%80-Architecture%20Weekly-important)](https://www.architecture-weekly.com/?utm_source=event_sourcing_nodejs)
1+
[![](https://dcbadge.vercel.app/api/server/fTpqUTMmVa?style=flat)](https://discord.gg/fTpqUTMmVa) [<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" height="20px" />](https://www.linkedin.com/in/oskardudycz/) [![Github Sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/event-driven-io)](https://github.com/sponsors/event-driven-io) [![blog](https://img.shields.io/badge/blog-event--driven.io-brightgreen)](https://event-driven.io/?utm_source=event_sourcing_nodejs) [![blog](https://img.shields.io/badge/%F0%9F%9A%80-Architecture%20Weekly-important)](https://www.architecture-weekly.com/?utm_source=event_sourcing_nodejs)
22

33
![](./src/docs/public/logo.png)
44

@@ -17,6 +17,7 @@ This project aims to experiment with an opinionated Event Sourcing framework bas
1717
Read more in [documentation](https://event-driven-io.github.io/emmett/getting-started.html), join our [Discord Channel](https://discord.gg/fTpqUTMmVa) and ask any question.
1818

1919
Check also my blog articles on Emmett:
20+
2021
- [Announcing Emmett! Take your event-driven applications back to the future!](https://event-driven.io/en/introducing_emmett/)
2122
- [Testing Event Sourcing, Emmett edition](https://event-driven.io/en/testing_event_sourcing_emmett_edition/)
2223
- [Event Sourcing on PostgreSQL in Node.js just became possible with Emmett](https://event-driven.io/en/emmett_postgresql_event_store/)

samples/webApi/expressjs-with-esdb/.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"editor.tabSize": 2,
1313

1414
"files.exclude": {
15-
"**/*.tsbuildinfo": true
15+
"**/*.tsbuildinfo": true,
16+
"**/node_modules": true,
17+
"**/dist": true
1618
},
1719
"files.eol": "\n",
1820

samples/webApi/expressjs-with-esdb/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![](https://dcbadge.vercel.app/api/server/fTpqUTMmVa?style=flat)](https://discord.gg/fTpqUTMmVa) [<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" height="20px" />](https://www.linkedin.com/in/oskardudycz/) [![Github Sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/oskardudycz/)](https://github.com/sponsors/oskardudycz/) [![blog](https://img.shields.io/badge/blog-event--driven.io-brightgreen)](https://event-driven.io/?utm_source=event_sourcing_nodejs) [![blog](https://img.shields.io/badge/%F0%9F%9A%80-Architecture%20Weekly-important)](https://www.architecture-weekly.com/?utm_source=event_sourcing_nodejs)
1+
[![](https://dcbadge.vercel.app/api/server/fTpqUTMmVa?style=flat)](https://discord.gg/fTpqUTMmVa) [<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" height="20px" />](https://www.linkedin.com/in/oskardudycz/) [![Github Sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/event-driven-io)](https://github.com/sponsors/event-driven-io) [![blog](https://img.shields.io/badge/blog-event--driven.io-brightgreen)](https://event-driven.io/?utm_source=event_sourcing_nodejs) [![blog](https://img.shields.io/badge/%F0%9F%9A%80-Architecture%20Weekly-important)](https://www.architecture-weekly.com/?utm_source=event_sourcing_nodejs)
22

33
![](./docs/public/logo.png)
44

samples/webApi/expressjs-with-mongodb/.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"editor.tabSize": 2,
1313

1414
"files.exclude": {
15-
"**/*.tsbuildinfo": true
15+
"**/*.tsbuildinfo": true,
16+
"**/node_modules": true,
17+
"**/dist": true
1618
},
1719
"files.eol": "\n",
1820

samples/webApi/expressjs-with-mongodb/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
[![](https://dcbadge.vercel.app/api/server/fTpqUTMmVa?style=flat)](https://discord.gg/fTpqUTMmVa) [<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" height="20px" />](https://www.linkedin.com/in/oskardudycz/) [![Github Sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/oskardudycz/)](https://github.com/sponsors/oskardudycz/) [![blog](https://img.shields.io/badge/blog-event--driven.io-brightgreen)](https://event-driven.io/?utm_source=event_sourcing_nodejs) [![blog](https://img.shields.io/badge/%F0%9F%9A%80-Architecture%20Weekly-important)](https://www.architecture-weekly.com/?utm_source=event_sourcing_nodejs)
1+
[![](https://dcbadge.vercel.app/api/server/fTpqUTMmVa?style=flat)](https://discord.gg/fTpqUTMmVa) [<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" height="20px" />](https://www.linkedin.com/in/oskardudycz/) [![Github Sponsors](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&link=https://github.com/sponsors/event-driven-io)](https://github.com/sponsors/event-driven-io) [![blog](https://img.shields.io/badge/blog-event--driven.io-brightgreen)](https://event-driven.io/?utm_source=event_sourcing_nodejs) [![blog](https://img.shields.io/badge/%F0%9F%9A%80-Architecture%20Weekly-important)](https://www.architecture-weekly.com/?utm_source=event_sourcing_nodejs)
22

33
![](./docs/public/logo.png)
44

5-
# Emmett - Sample showing event-sourced WebApi with Express.js and PostgreSQL
5+
# Emmett - Sample showing event-sourced WebApi with Express.js and MongoDB
66

77
Read more in [Emmett getting started guide](https://event-driven-io.github.io/emmett/getting-started.html).
88

99
## Prerequisities
1010

11-
Sample require PostgreSQL, you can start it by running
11+
Sample require MongoDB, you can start it by running
1212

1313
```bash
1414
docker-compose up

samples/webApi/expressjs-with-mongodb/docker-compose.yml

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,43 @@ services:
99
container_name: emmett_api
1010
profiles: [app]
1111
environment:
12-
- POSTGRESQL_CONNECTION_STRING=postgresql://postgres@postgres:5432/postgres
12+
- MONGODB_CONNECTION_STRING=mongodb://mongodb:27017/
1313
networks:
1414
- postgresql_network
1515
ports:
1616
- '3000:3000'
1717

1818
#######################################################
19-
# PostgreSQL
19+
# MongoDB
2020
#######################################################
21-
postgres:
22-
image: postgres:15.1-alpine
21+
mongodb:
22+
image: mongo:6.0.12
23+
# environment:
24+
# MONGO_INITDB_ROOT_USERNAME: root
25+
# MONGO_INITDB_ROOT_PASSWORD: rootpassword
2326
ports:
24-
- '5432:5432'
25-
environment:
26-
- POSTGRES_DB=postgres
27-
- POSTGRES_PASSWORD=postgres
28-
- POSTGRES_USER=postgres
27+
- 27017:27017
28+
volumes:
29+
- mongodb-data:/data/db
2930
networks:
30-
- postgresql_network
31+
- mongodb_network
3132

32-
pgadmin:
33-
container_name: pgadmin_container
34-
image: dpage/pgadmin4
35-
environment:
36-
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL:[email protected]}
37-
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD:-postgres}
38-
- PGADMIN_CONFIG_SERVER_MODE=False
39-
- PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
33+
mongo-express:
34+
image: mongo-express
35+
restart: always
4036
ports:
41-
- '${PGADMIN_PORT:-5050}:80'
42-
entrypoint: /bin/sh -c "chmod 600 /pgpass; /entrypoint.sh;"
43-
user: root
44-
volumes:
45-
- ./docker/pgAdmin/pgpass:/pgpass
46-
- ./docker/pgAdmin/servers.json:/pgadmin4/servers.json
47-
depends_on:
48-
- postgres
49-
restart: unless-stopped
37+
- 8081:8081
38+
environment:
39+
# ME_CONFIG_MONGODB_ADMINUSERNAME: root
40+
# ME_CONFIG_MONGODB_ADMINPASSWORD: example
41+
# ME_CONFIG_MONGODB_URL: mongodb://root:example@mongodb:27017/
42+
ME_CONFIG_MONGODB_URL: mongodb://mongodb:27017/
5043
networks:
51-
- postgresql_network
44+
- mongodb_network
5245

5346
networks:
54-
postgresql_network:
47+
mongodb_network:
5548
driver: bridge
5649

5750
volumes:
58-
eventstore-volume-data:
59-
eventstore-volume-logs:
51+
mongodb-data:

0 commit comments

Comments
 (0)