···11-# Why
22-33-> This file aims to explain my choices. Not that I need to explain myself
44-> but hey, we all feel accountable for our stupid actions sometimes.
55-66-## The 25 branch
77-88-Few days after the Rust 2024 edition release, having new experiences with gleam Lustre and a really messy repository...
99-Three great reasons for a clean slate.
1010-Git branch 25 is yet another restart for me writing on Lumina. With experiences and a clear vision, `master` does a
1111-good job, so this one will do even better.
1212-1313-### Choices made
1414-1515-- **Gleam** as the main language on frontend.
1616- Not having multiple language branches about this.
1717- - **TailwindCSS** as the main CSS framework.
1818- - **Lustre** for building the UI.
1919-- **Rust** as the main language on backend.
2020- - More specifically, the `rocket` library instead of `actix-web`.
2121- - Rust 2024 edition from the start.
2222-- **PostgreSQL** as the main database. **SQLite** for testing.
2323-- **WebSockets** for real-time communication between the client and the server.
2424-2525-## The `gleam` language
2626-2727-I am a big fan of the language. I think it's a great language for
2828-writing maintainable and scalable code. I think it's a great language
2929-for writing maintainable and scalable code. It's simplicity and the
3030-young yet strong community set a good foundation for Lumina.
3131-3232-## Timeline-carries-most
3333-3434-One of the bussiest tables you'll see is the timeline, containing just some ID's and timestamps.
3535-3636-| Kind | timeline ID | item ID | Timestamp |
3737-| ---------------------------------------- | ----------- | ------- | ------------------ |
3838-| `'USER'`, `'DIRECT'`, `'TL'`, `'BUBBLE'` | uuidv4 | uuidv4 | Database timestamp |
3939-4040-The `global` timeline, here being `00000000-0000-0000-0000-000000000000` as the only constant-assigned timeline ID. The
4141-user-profiles being the same as their user id counterpart.
4242-4343-This is too vague to actually be able to pull a post, which is why the item forward table exists, combining a UUID and a
4444-string to forward to the right item.
4545-4646-Now I say `item`, not `post` here. This because you might expect only timelines (global, userprofiles) and bubbles (
4747-timelines meant for a specific subject, forming a community within the larger site) in this table, but direct message
4848-threads are actually also saved here.
4949-5050-This means this table might become a little overcrowded, and optimizations such as caching, sharding and mirrorring to
5151-Redis will be needed to keep it somewhat performant, especially since this is essentially a constant hot path. I am
5252-aware.
5353-5454-Which is why we also would need to log every timeline request to be able to identify for example overrequested
5555-timelines.
···11+Lumina is not minimalistic. It follows web design trends from decades ago with that approach, but also prefers a clean and modern design. This is why coloured elements are very important, but it also allows us to implement features considered old-school nowadays. Like the ability
···11+# Timeline-carries-most
22+[['Timeline carries most' and the database]]
33+44+One of the busiest tables you'll see is the timeline, containing just some ID's and timestamps.
55+66+| Kind | timeline ID | item ID | Timestamp |
77+| ---------------------------------------- | ----------- | ------- | ------------------ |
88+| `'USER'`, `'DIRECT'`, `'TL'`, `'BUBBLE'` | uuidv4 | uuidv4 | Database timestamp |
99+1010+The `global` timeline, here being `00000000-0000-0000-0000-000000000000` as the only constant-assigned timeline ID. The
1111+user-profiles being the same as their user id counterpart.
1212+1313+This is too vague to actually be able to pull a post, which is why the item forward table exists, combining a UUID and a
1414+string to forward to the right item.
1515+1616+Now I say `item`, not `post` here. This because you might expect only timelines (global, userprofiles) and bubbles (
1717+timelines meant for a specific subject, forming a community within the larger site) in this table, but direct message
1818+threads are actually also saved here.
1919+2020+This means this table might become a little overcrowded, and optimizations such as caching, sharding and mirrorring to
2121+Redis will be needed to keep it somewhat performant, especially since this is essentially a constant hot path. I am
2222+aware.
2323+2424+Which is why we also would need to log every timeline request to be able to identify for example over-requested
2525+timelines.
···11+# The `gleam` language
22+33+I am a big fan of the language. I think it's a great language for
44+writing maintainable and scalable code. I think it's a great language
55+for writing maintainable and scalable code. It's simplicity and the
66+young yet strong community set a good foundation for Lumina.
+4
notes/Philosophies/'Timeline carries most' and the database.md
notes/Design choices/Philosophies/'Timeline carries most' and the database.md
···11+Rationale: [[Backend > Timeline carries most]]
12# Lumina Data Storage Architecture
2334This document outlines the data storage architecture of the Lumina social platform, based on the existing implementation
45and design principles.
66+77+5869## Core Philosophy: "Timeline-carries-most"
710···11141215- It acts as an index, containing only a timeline ID (`tlid`), an item ID (`item_id`), and a `timestamp`.
1316- It does not store any content itself, only the relationship between a timeline and an item.
1717+14181519## Database System
1620