0001-use-gleam-otp-actors.md
1 # ADR-0001 — Use Gleam OTP Actors for Server Sessions 2 3 Date: 2026-05-07 4 5 Status: Proposed 6 7 ## Context 8 9 Lightspeed needs per-session state ownership, ordered message processing, crash isolation, and supervision. 10 11 ## Decision 12 13 Model a live session as a typed actor on the BEAM. The first implementation should use Gleam OTP actors rather than raw processes unless benchmarks or API constraints show that raw processes are required. 14 15 ## Consequences 16 17 Easier: 18 19 - session isolation 20 - typed messages 21 - supervision 22 - testing actor boundaries 23 24 Harder: 25 26 - direct portability to JavaScript target 27 - distributed session migration 28 - keeping the core package free of BEAM-only assumptions 29 30 ## Alternatives considered 31 32 - one process per transport connection with ad hoc state 33 - stateless request/reply model 34 - external process manager