Aller au contenu

ADR 0003: Share layouts in the URL and keep the BFF stateless

Ce contenu n’est pas encore disponible dans votre langue.

  • Status: accepted
  • Date: 2026-11-21
  • Answers: questions Q1 and Q3 of the project charter

Users customize their dashboard (widgets, positions, sizes, settings). Their own layout must be kept after a reload (objective O2), and a link must open the same layout on another device (objective O3). Pulse has no user accounts.

Where do we store a layout, how do we share it, and what does the back end (bff) do as a consequence?

  • Meet objectives O2 and O3 without user accounts
  • Keep the solution as simple as possible (Pulse is the level 1 project)
  • No personal data stored on the server
  • Easy to host, even on a small server (risk R1)
  • Resistant to abuse
  • Layout saved in the browser, shared as a compressed string in the URL
  • Layout saved in the browser, shared as a snapshot stored on the server (PostgreSQL, short link)
  • Read and edit links stored on the server, like Excalidraw

Chosen option: “layout shared as a compressed string in the URL”, because it meets O2 and O3 with no database, no stored data and no abuse risk, and keeps the back end stateless.

How it works:

  • The user’s own layout is saved in the browser (localStorage).
  • To share, the layout is serialized to JSON, compressed and encoded in the URL fragment: https://pulse.antoine-duquenne.fr/#v1.<data>.
  • The fragment (after #) is never sent to the server: the shared layout does not appear in any server log.
  • The prefix v1. is the version of the format, so old links stay readable if the format changes.
  • The front end validates every decoded layout (known widget types, valid sizes and settings) before it uses it. A link is untrusted input.

As a consequence, the bff is stateless: it only proxies and caches the external APIs used by the widgets.

Endpoint Purpose
GET /api/gitlab/pipelines Pipeline status, only for projects of the heimdall-groupe group
GET /api/gitlab/milestones Milestone progress, same restriction
GET /api/velo/stations “Le Vélo” bike-sharing stations (Bordeaux Métropole open data)
GET /api/iss/position Position of the International Space Station
GET /actuator/health Health check

Each endpoint has a cache, a timeout, clear error responses and an OpenAPI description. The GitLab endpoints accept only projects of heimdall-groupe, so the bff cannot be used as an open proxy to the GitLab API.

  • Good: no database to host, back up or migrate.
  • Good: no personal data and nothing to clean on the server.
  • Good: shared links never expire.
  • Good: a stateless bff is simple to deploy and test, and can run in several instances.
  • Bad: shared links are long (a few hundred to about 1,500 characters).
  • Bad: a shared link is a snapshot: later changes by its author are not visible in it.
  • Bad: a shared link cannot be revoked.
  • Good: no storage, no abuse risk, works even when the back end is down.
  • Bad: long links, snapshot only.
  • Good: short links.
  • Good: shows back-end persistence skills (JPA, Flyway, PostgreSQL).
  • Bad: a database to host, back up and migrate.
  • Bad: anyone can write to the database: needs rate limiting and cleaning.
  • Bad: about one more day of work. Persistence skills are shown in JobRadar and Sinistra.
  • Good: shared dashboards can be updated.
  • Bad: needs server storage and secret edit links; close to user accounts, which are out of scope.