Skip to content

Commit ca2dc78

Browse files
authored
Merge pull request #225 from os2display/feature/adr
ADR - Architecture Decision Records
2 parents bd47f53 + 43e4185 commit ca2dc78

File tree

8 files changed

+223
-0
lines changed

8 files changed

+223
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
- [#225](https://github.com/os2display/display-api-service/pull/225)
8+
- Added ADRs.
79
- [#215](https://github.com/os2display/display-api-service/pull/215)
810
- Added calendar api feed type.
911
- [#223](https://github.com/os2display/display-api-service/pull/223)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ADR 001 - Record architectural decisions
2+
3+
Date: 26-11-2024
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
We need to record the architectural decisions made on this project. Architectural Decision Records as
12+
[described by Michael Nygard](https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions) provides a
13+
framework for writing down these decisions.
14+
15+
The project has been running for several years and there is a need for summarizing some of the baselines of the project,
16+
to document the original ideas and decisions.
17+
18+
## Decision
19+
20+
We will use Architectural Decision Records.
21+
22+
We will write down the original architectural decisions as ADRs even though years have passed, to help document the
23+
thoughts behind the project.
24+
25+
## Consequences
26+
27+
This introduces an additional burden on core project maintainers to diligently follow architecture discussions and
28+
record the decisions in this repo as an ADR.

docs/adr/002-api-first.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# ADR 002 - API first
2+
3+
Date: 26-11-2024
4+
5+
## Status
6+
7+
Accepted
8+
9+
Written years after the decision was made.
10+
11+
## Context
12+
13+
The "API first" approach is to enforce that all interactions with the system must go through the API.
14+
See more about the "API first" approach [here](https://swagger.io/resources/articles/adopting-an-api-first-approach/).
15+
16+
The previous version of OS2Display was used without the admin module in some contexts.
17+
We want to support other uses than the standard OS2Display setup.
18+
19+
By adopting the API first approach it will be possible to replace or write other clients without rewriting the entire
20+
application. E.g. an external system could create content through calls to the API.
21+
This will make the system more future-proof.
22+
23+
[OpenAPI](https://www.openapis.org/) is a standard for describing an API interface.
24+
25+
## Decision
26+
27+
We will use an API first approach where the only way to get and manage content is through calls to the API.
28+
The API specification will be included [with the project](../../public/api-spec-v2.json) and kept up to date.
29+
We will to develop the clients (admin and screen) separately from the API project to enforce the "API first" approach.
30+
31+
## Consequences
32+
33+
The main consequence is that all interactions with data in the system should be implemented in the API.
34+
This can in some cases be more work, but will give the benefit that the interaction can be used in new contexts later
35+
on.
36+
37+
By supplying an OpenAPI specification clients will be able to auto-generate code for interacting with the API.
38+
This will make it easier to write clients for the system.
39+
40+
By adopting the "API first" approach the API specification will be the contract between the API and clients.
41+
This will limit the extensibility of the project, since the client and API need to be aligned on the interface
42+
between them (the API specification).

docs/adr/003-api-versioning.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# ADR 003 - API versioning
2+
3+
Date: 26-11-2024
4+
5+
## Status
6+
7+
Accepted
8+
9+
Written years after the decision was made.
10+
11+
## Context
12+
13+
By versioning the API we can communicate changes in the API. If an endpoint changes in a way that breaks backwards
14+
compatibility we will change the route version. An example of a backwards compatibility break is changing field names.
15+
16+
E.g. changing the field "name" to "title" will be breaking backwards compatibility.
17+
On the other hand, adding the "title" field without removing the "name" field and updating "name" when "title" is
18+
changed will not be a breaking change.
19+
20+
## Decision
21+
22+
We will version our API routes when we break backwards compatibility.
23+
Routes will be prefixed by version: `/v1`, `/v2`...
24+
25+
We will aim at avoiding breaking backwards compatibility as much as possible.
26+
27+
## Consequences
28+
29+
By versioning the API we will communicate changes in the API in a clear way.
30+
This will make it easier to maintain clients communicating with the API.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# ADR 004 - Browser based clients
2+
3+
Date: 26-11-2024
4+
5+
## Status
6+
7+
Accepted
8+
9+
Written years after the decision was made.
10+
11+
## Context
12+
13+
Creating a system for managing and displaying content on different machines requires some consideration about how the
14+
content will be displayed on different machines. Creating an application directed at a specific operating system will
15+
limit the application options.
16+
17+
An alternative is to implement the system with a common technology. Web pages can be displayed in multiple contexts.
18+
By creating browser based clients we can make the system easier to adopt.
19+
20+
## Decision
21+
22+
We will write clients as web pages.
23+
24+
## Consequences
25+
26+
By being contained in a browser of the client machine we are limited in what we can do and know in the client machine.
27+
28+
The browser sets sandboxing constraints on the application when running in a browser.
29+
30+
The benefit is that that client should be able to run on most environments and most people know how to set up a screen
31+
in a browser.

docs/adr/005-technology-stack.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# ADR 005 - Technology stack
2+
3+
Date: 26-11-2024
4+
5+
## Status
6+
7+
Accepted
8+
9+
Written years after the decision was made.
10+
11+
## Context
12+
13+
We want to create a stack that is simple and could potentially be set up on a simple hosting setup.
14+
15+
We need a technology stack for the project.
16+
17+
* [PHP](https://www.php.net/) provides a modern programming language with easy hosting options.
18+
* [Symfony](https://symfony.com/) is one of the biggest PHP frameworks for creating web projects.
19+
* [API Platform](https://api-platform.com/) is PHP framework for creating APIs.
20+
* [OpenAPI](https://www.openapis.org/) is a standard for describing an API interface.
21+
* [React](https://react.dev/) is one of the biggest UI frameworks.
22+
23+
## Decision
24+
25+
We will use PHP, Symfony and API Platform as the main technologies for the API.
26+
27+
We will use OpenAPI for API specification.
28+
29+
We will use React for writing the clients and templates.
30+
31+
## Consequences

docs/adr/006-templates.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# ADR 006 - Templates
2+
3+
Date: 27-11-2024
4+
5+
## Status
6+
7+
Accepted
8+
9+
Written years after the decision was made.
10+
11+
## Context
12+
13+
The display client should run in a browser. Slide templates should therefore be written in javascript/React.
14+
15+
We would like to open up the options for extending the system with custom templates.
16+
17+
We can use [remote-component](https://github.com/Paciolan/remote-component) to dynamically load react components into
18+
a running React application.
19+
20+
## Decision
21+
22+
We will use `remote-component` to load the templates when rendering slides.
23+
24+
## Consequences
25+
26+
Templates should be built for use with `remote-component`.
27+
28+
We introduce a dependency on the `remote-component` library to the project.
29+
30+
Custom templates can be loaded into the system without being in the core code.

docs/adr/007-configurability.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# ADR 007 - Configurability
2+
3+
Date: 27-11-2024
4+
5+
## Status
6+
7+
Accepted
8+
9+
Written years after the decision was made.
10+
11+
## Context
12+
13+
We know the system will be used in different contexts, from a simple setup with showing content on a couple of screens
14+
to large setups with hundreds of screens connected.
15+
16+
Therefore, we want implementers to be able to configure the project to turn off features that will not be used.
17+
18+
Environment variables can be used to configure a Symfony application.
19+
20+
In the browser configuration can come from a file that is available to the client.
21+
22+
## Decision
23+
24+
We will make features configurable through environment and config files.
25+
26+
## Consequences
27+
28+
Features that are not "core" will have to be implemented as configurable wherever possible.
29+
This will introduce extra work when implementing features and increase the complexity of the application code.

0 commit comments

Comments
 (0)