Solution Strategy
Fundamental technical strategy and key decisions
This section summarizes the main technical strategies that shape the Fr[ae]ym architecture.
Architectural Approach
- Microservices: Fr[ae]ym is split into focused services (Sync, Streams, Projections, CRUD, Auth, Deployments), each deployable and scalable independently.
- Event sourcing: Streams provide an append-only event store and subscription; because the store is append-only, events are not overwritten or deleted by normal operation, so data can not be lost by broken DB migrations. Projections and CRUD are built on top of events, with schema-driven projection definitions and CRUD types.
- Schema-driven configuration: GraphQL schema is the source to define projection and CRUD types; the Deployments service applies schemas to Projections and CRUD and updates Auth permissions. Using GraphQL schemas this way is convenient and keeps projects migration-free — all APIs are auto-generated from the schema, so you can run larger event-sourced projects without writing database migrations.
- API style: GraphQL for query/mutation/subscription APIs; gRPC for performant communication between services;
Key Design Decisions
- Sync: Distributed locking (Sync) is used by other services (e.g. Streams) to coordinate work and avoid duplicate processing; pessimistic locking with read/write and hierarchy. Sync is not horizontally scalable yet: the design prioritizes extreme performance with an in-memory approach. Alternatives such as etcd or Consul could be used for locking, but they were seen as harder to set up and slower than the current in-process implementation.
- Streams: Events stored in Postgres (append-only event store); consumer groups for at-least-once processing; optional “delete after consumption” per topic to limit storage growth. Event streams are designed to be GDPR compliant.
- Projections: GraphQL schema defines structure; optional Elasticsearch for full-text/geo.
- CRUD: Event-sourced CRUD with GraphQL API; files in S3.
- Auth: Multi-tenant; OAuth2-like protocol; roles and permissions.
- Deployments: Manages schema lifecycle (create, activate, confirm, rollback); supports blue/green and zero-downtime schema changes.