@rotorsoft/eventually-service-expg
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

Generic Services

In eventually, we try to separate core domain concerns from system abstractions. This approach allows us the flexibility to compose artifacts in different service-level configurations as the business requirements evolve.

We can have a group of developers focusing on the domain (business rules), and a second group of system engineers and architects (configurators) focusing on the higher level system abstraction: how to compose the system today given these artifacts and the facts we are collecting from them. These include:

  • Projections
  • Subscriptions
  • Deployment
  • Scalability requirements
  • Competing consumers
  • Stream splitting
  • Concurrent or serialized flows
  • Integration tests

Layers

eventually-service-expg implements a specific generic service using Express and Postgres adapters, and can be easily configured by declaring the required artifacts in package.json.

Steps to build a generic service

  • Create project (optional) - a service can be started just by pointing at a folder with an installed package.json and .env file)
mkdir generic-service
cd generic-service
npm init -y
npm i @rotorsoft/eventually-service-expg @rotorsoft/calculator-artifacts
  • Declare the artifacts you want to deploy in package.json under the eventually section
  • Add a start script pointing to the generic service index
{
    "name": "generic-service",
    "description": "Generic Service",
    "version": "1.0.0",
    "main": "index.js",
    "scripts": {
        "start": "node ./node_modules/@rotorsoft/eventually-service-expg/dist"
    },
    "author": {
        "name": "name",
        "email": "email@email.com"
    },
    "license": "ISC",
    "keywords": [],
    "dependencies": {
        "@rotorsoft/calculator-artifacts": "^1.0.0",
        "@rotorsoft/eventually-service-expg": "^1.0.0"
    },
    "eventually": {
        "store": "calculator",
        "artifacts": {
            "@rotorsoft/calculator-artifacts": [
                { "name": "Calculator" }, 
                { "name": "Counter", "scope": "private" }, 
                { "name": "PressKeyAdapter" }
            ]
        }
    }
}
  • Configure PG in .env file
LOG_LEVEL="info"
PG_HOST="localhost"
PG_USER="postgres"
PG_DATABASE="postgres"
PG_PASSWORD="postgres"
  • Run Service
npm run start

Readme

Keywords

none

Package Sidebar

Install

npm i @rotorsoft/eventually-service-expg

Weekly Downloads

0

Version

1.1.6

License

MIT

Unpacked Size

73.2 kB

Total Files

11

Last publish

Collaborators

  • rotorsoft