Skip to content

MatteoDiPaolo/systemic-examples

Repository files navigation

Description

A list of basic examples using systemic

Example-A

  • system: calculatorSystem
    • component: add
    • component: mulitply

Running the system: npm run a

Note: in the related index.js we create then system and the use it after starting it.

Example-B

  • system: calculatorSystem
    • subsystem: positiveOperations
      • component: add
      • component: mulitply
    • subsystem: negativeOperations
      • component: subtract
      • component: divide

Running the system: npm run b

Note: in the related index.js we start the subsystems then create the system and then use it after starting it. Each one of the subsystem comes with an index.js files that acts as a manifest for that given subsystem, it tells us which component is the subsystem relying on.

Example-C

  • system: calculatorSystem
    • subsystem: positiveOperations
      • component: add
      • component: mulitply
    • subsystem: negativeOperations
      • component: subtract
      • component: divide

Running the system: npm run c

Note: in the related index.js we don't need to start the subsystems since we bootstrap them along with the system itself, all we have to do is starting the system after having it bootstrapped.

Example-D

  • system: calculatorSystem
    • subsystem: positiveOperations
      • component: add
      • component: mulitply
    • subsystem: negativeOperations
      • component: subtract
      • component: divide

Running the system: npm run d

Note: it is extacly the same as the previuos example, we have only got ridden of the subsystems folders for a better folder structure, this is the recommended approach.

Example-E

  • system: exampleSystem
    • subsystem: config
      • component: config
    • subsystem: logger
      • component: logger
    • subsystem: mongo
      • component: mongo.primary
      • component: mongo.secondary
      • the above components are actually the same one instantiated two times with two different configurations.

Running the system: npm run e

Note: here is where things start to look more like a real case scenario. We have dependency injection between components. The config is scoped. The mongo subsystem comes with two different components in order to manage the connection to two different mongos. The primary and secondary mongo component come with the stop function.

Example-F

  • system: exampleSystem
    • subsystem: config
      • component: config
    • subsystem: logger
      • component: logger
    • subsystem: mongo
      • component: mongo.primary
      • component: mongo.secondary
      • the above components are actually the same one instantiated two times with two different configurations.

Running the system: npm run f

Note: it is extacly the same as the previuos example, we have just used the systemic-domain-runner to start the system.

About

A list of easy systemic examples

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published