Event Sourcing with PocketBase & SvelteKit! ⏱️ New App: Chrono 🔴 LIVE Coding & Chill

Published: 01 January 1970
on channel: Johnny Magrippis
227
11

Let’s see if we can tackle a relatively complex architectural pattern, with a relatively straightforward stack: Let’s do do Event Sourcing with PocketBase!

We’ve never shown Event Sourcing before on stream! Usually, we perform CRUD: Create Read Update Delete operations by manipulating the database directly. When a user wants to update their handle… we literally update their handle in the database! Straightforward, BUT: it does mean that we can never find what their old handle was ever again! We cannot retroactively gather stats on how many times they’ve updated their handle either. We need to add separate logic to track that, and it will only be tracking occurrences from the moment that logic made it to production.

Event Sourcing doesn’t do direct mutations! You keeps track of all the events that have happened, and you determine the current state of the data by replaying them. A user was created, with a randomised handle based on their email. Then they updated their handle. Then they undid that update! Then they updated again. All those events themselves are stored in the database, and are used to derive what their current handle is, but also how many times they’ve changed it, and to what values.

Why would we go through all that trouble? What are the drawbacks? Let’s discuss in today’s LIVE Coding & Chill, because we’ll be building a new app, where I think Event Sourcing will greatly benefit one of its key selling points 🙂

🚀 Click around the app yourself: https://chronokit.vercel.app/
💻 See the code (private repo 😱): https://github.com/johnnify & https://github.com/johnnify/chrono

If you’re a beginner, you may want to start with our Portfolio "Paulina Puppers" series, and end up with the same or an equivalent project:    • Brand new Fullstack App with Svelte 5...  

No need to watch the previous episode, but this series playlist is:    • 4+1 ways to fetch data with SvelteKit...  

Check around the channel for more playlists and increasingly complicated tech stack choices 🙌

— JOHNNIFY PREMIUM —
Get this repository AND MORE with Johnnify Premium: https://johnnify.com/premium
— 🙌🙌🙌 —

— COMMUNITY —
Our DISCORD SERVER 👾:   / discord  
— 🥳🥳🥳 —

— Agenda —
[ ] What are we doing today? New App?
[ ] Let’s create a `livestreams` collection in PocketBase!
[ ] PocketBase `json` columns, and Event Sourcing overview
[ ] New SvelteKit route to list all livestreams! `/livestreams`
[ ] New route to create a new livestream! `/livestreams/new`
[ ] New route to see a `livestream`!
[ ] Adding agenda items, with event sourcing!
[ ] Toggling agenda items!
[ ] Removing agenda items!
[ ] TDD-ing converting the agenda events into YouTube Timestamps!
— BONUS —
[ ] Copy button!
[ ] Login with Google!
[ ] Testing authentication!
[ ] Final 🥳 DEMO + LIKE 💜 SUBSCRIBE
— HAVE FUN —

No affiliations whatsoever: if I show something, you know you're hearing my unfiltered thoughts 😄

— Highlighted software —
SvelteKit: https://kit.svelte.dev/
PocketBase: https://pocketbase.io/
Playwright: https://playwright.dev/
Tailwind: https://tailwindcss.com/
shadcn-svelte: https://shadcn-svelte.com/
Vercel: https://vercel.com/johnnify
Fly.io: https://fly.io/
Turbo: https://turbo.build/

My own website: https://magrippis.com/

Search for `@jmagrippis` to find me on socials like Instagram & Twitter! And remember our DISCORD SERVER 😉:   / discord  

Between the comment section and the socials, let me know *somewhere* what you’d like me to cover next 🙌

Stream number 118!


Watch video Event Sourcing with PocketBase & SvelteKit! ⏱️ New App: Chrono 🔴 LIVE Coding & Chill online without registration, duration hours minute second in high quality. This video was added by user Johnny Magrippis 01 January 1970, don't forget to share it with your friends and acquaintances, it has been viewed on our site 227 once and liked it 11 people.