TramwayJS

Components

Tramway breaks responsibilities and layers into their pieces.

Persistence

  • Provider: A class responsible for managing the communications with a data source.

Data

  • Entity: An entity is a basic object that represents a given schema.
  • Factory: A class that knows how to build an entity given some raw data.
  • Repository: A class that knows how to model information returned or sent to a data provider.
  • Collection: A group of entities as a standardized iterable.

Logic

  • Service: A class responsible for handing business logic.
  • Subscriber: A class that orchestrates side-effect logic from a dispatched event.

Orchestration

  • Controller: A class that orchestrates communications between services and the client.
  • Command: A class that orchestrates communications between services and a CLI client.

Presentation

The View is represented as formatters passed to the Controller.

  • Formatter: A class that can standardize the output for Entities and Collections and manage the needs of multiple MIME types.
    • HATEOASFormatter: A Formatter that implements the HAL specification.

Tramway also adds additional components to facilitate other use cases:

Security

  • Policy: A class that ensures preconditions for a given route are respected.