Socotra
Examples

Clean architecture

Strict layer dependency inversion: WebApi → Application → Domain, Infrastructure implements Application interfaces.


Generate with init

socotra init --template clean-architecture

socotra.yaml

socotra.yaml
socotra:
  version: "1.1"
  solution:
    name: "TasksApp"
    rootNamespace: "TasksApp"
    dotnetVersion: "net9.0"
  architecture:
    pattern: "clean-architecture"
    enforceLayerConstraints: true
    allowedDependencies:
      - from: "*.Application"
        to: "*.Domain"
      - from: "*.Infrastructure"
        to: "*.Application"
      - from: "*.Api"
        to: "*.Application"
      - from: "*.Api"
        to: "*.Infrastructure"
  modules:
    - name: "TasksApp"
      layers:
        - name: "Domain"
          type: ClassLib
          templates: ["base-entity", "value-object", "aggregate-root", "domain-event"]
        - name: "Application"
          type: ClassLib
          references: ["TasksApp.Domain"]
          templates: ["repository-interface", "command", "query", "result-pattern"]
        - name: "Infrastructure"
          type: ClassLib
          references: ["TasksApp.Application"]
          packages:
            - "Microsoft.EntityFrameworkCore.Sqlite:8.0.0"
          templates: ["ef-context", "di-registration"]
        - name: "Api"
          type: WebApi
          references: ["TasksApp.Application", "TasksApp.Infrastructure"]
Schema 1.1 · CLI 1.0