I built a $5 chat app with Pocketbase & Svelte. Will it scale?
Ғылым және технология
Learn how build a fullstack realtime chat app with Svelte and Pocketbase, then deploy it to a Linux server for just $5. Let's find out if the Spock stack can scale...
💵 Get started with Linode at www.linode.com/fireship ($100 Credit good for 60 days as a new user)
#webdevelopment #project #linux
💬 Chat with Me on Discord
/ discord
🔗 Resources
- Chat App Live Demo pocketchat.fireship.app
- Fireship Pocketbase Tutorial fireship.io/lessons/pocketbas...
- Full Source Code github.com/fireship-io/pocket...
- Pocketbase Docs pocketbase.io/
- Pocketbase First look • PocketBase... The Ulti...
🔥 Get More Content - Upgrade to PRO
Upgrade at fireship.io/pro
Use code YT25 for 25% off PRO access
🎨 My Editor Settings
- Atom One Dark
- vscode-icons
- Fira Code Font
🔖 Topics Covered
- Build an app with Svelte
- What is Pocketbase?
- Can Pocketbase scale?
- Deploying Pocketbase to Linode
Пікірлер: 573
Here’s your $100 stimulus check, go break something (must be used in 60 days) www.linode.com/fireship
@c00lkitty
Жыл бұрын
will do.
@zedespook
Жыл бұрын
I remember when I wanted to make a Linode server. I failed even registering to the website, and 5 support agents told me that I am indeed not a real human. I'll just stick with Supabase.
@zeroxd.cypher3899
Жыл бұрын
good looks
@c00lkitty
Жыл бұрын
@@zedespook DAMN BRO THATS HARSH
@sawbezskywalker2630
Жыл бұрын
I don't think that the site scaled ...
Hi, PocketBase author here. @fireship did a great job with the video and managed to present a lot of things (Linode, Svelte, PB) in a very compact and easy to understand format. After reading some of the comments, I'll leave just couple notes: 1. At the moment of writing, the chat app seems to be using an older PocketBase v0.8.0 version. The latest v0.10+ releases come with split db pool and significant performance and memory improvements. 2. The realtime connections can quickly exhaust the max open files limit and you may want to increase it accordingly to the expected concurrent load (from the systemd in the video is around ~4096). 3. For those commenting that SQLite doesn't scale well - *it is PocketBase fault* that the chat app doesn't perform well on high concurrent load and further improvements will be done in the near future. For a single server setup, plain SQLite in WAL mode almost always will outperform other traditional databases. (ps. this is a second attempt to post the comment since the first one probably got flagged because of the github link).
@YuriG03042
Жыл бұрын
Thanks for giving us PocketBase, it's very appreciated!
@Fireship
Жыл бұрын
Thanks for the input! This has been an interesting experiment, PB was dealing with nearly 1M requests per hour earlier. I'll probably make a quick follow up on my second channel.
@NoobaLV
Жыл бұрын
@@Fireship Please do! Would be interesting to see the stats
@Carlos-xz9zq
Жыл бұрын
@@Fireship on the 5$ server?
@nickdaves3467
Жыл бұрын
@@Carlos-xz9zqI want to know this too! 🤔
scp is one of my favorite examples of early unix simplicity. It is basically just a script that opens an ssh connection and then pipes the data through and calls "cp" on the other side 😂
@yt-1337
Жыл бұрын
lol didn't know how it works but it is awesome, i always use scp when copying one or two files to my raspberry pi, never really used rsync except two or three times in a script
@bernardonegri5416
Жыл бұрын
The openssh scp implementation actually uses sftp to copy the file.
@mudhutonthemoon
8 ай бұрын
Calls “cp” wtf?
@garethgan9519
8 ай бұрын
@@mudhutonthemoon Yes, its called a program call. how do you not know?
@mudhutonthemoon
8 ай бұрын
@@garethgan9519 I thought it was calling something more nefarious.
As a dev who avoids nearly every third party library if I can just write it myself, it's pretty wild seeing how easy these are to use lol Maybe I should start using them.....
@chind0na
Жыл бұрын
Appwrite ftw.
@bringbackwindowsphone
Жыл бұрын
There's nothing wrong using maintained libraries/platforms which helps you develop faster and make more maintainable applications
@okie9025
Жыл бұрын
I pray for the person who has to touch your code if everything you write is from scratch lol
@OwO-.
Жыл бұрын
i thought the same and still think a zero-dependency app is great but some tools like svelte are really fucking useful
@Jorge78712
Жыл бұрын
Is common to meet developers who dislike using third-party libraries. I call them stubborn developers, for them it takes an eternity to finish a product.
crazy !!! a complete production web app, fully stacked ... amazing FS ... I really like the real production approach...because we often dont have this in tutorials... thanks
@itsUnsmart
Жыл бұрын
Tbh this is more for simple MVPs to test out if something would work and wont scale for production loads, but MVPs are still very very useful so!
@M3t4lstorm
Жыл бұрын
This is not a production app ;)
Was amazing how much traffic the demo app got. And it was fun to watch all the exploit attempts in real-time. Would love to see this turned into a series where we continue to strengthen, and stress test the app.
@YuGoCheff
Жыл бұрын
Awesome idea! Because right now all beginners know how to start, but as we have seen it’s not production ready
I watched this video so many times. It's a complete tutorial. From the front to the back. We've reached tutorial perfection. Thank you sir
You make some complex things quite simple by making content concise to the point otherwise I need to go through whole documentation or big video. Great Work❤
Small svelte note that may save some trouble. At 12:35 Jeff is using the assignment “=“ operator. Svelte’s reactivity doesn’t work with state changes using methods. Hence array.push() and other methods won’t react. Use the es6 spread syntax as shown in 12:35. Another helpful Svelte tip, if you need an element to re-render based off a change in value check out the {#key} block.
@nickdaves3467
Жыл бұрын
Thanks Michael, as a newbie coming from Python this is a bless! 🙌
@cubiq1
Жыл бұрын
Is Svelte still being actively developed by 1 person? This is the biggest reason I've never tried it. A bus factor of 1 is no joke.
@michaelaboah1322
Жыл бұрын
@@cubiq1 nope there is a sizable team and they are even under the wing of the same company that maintains React. Namely Vercel. Svelte is currently in good hands.
@SuperOmercohen
Жыл бұрын
@@michaelaboah1322 Vercel also maintains Next.js, not React. A team in Meta (facebook) maintains React
No way, NO WAYYY, I was building my web side project and going through different frameworks, i was considering svelte for frontend and i was not sure of a backend service so i searched and came across your pocketbase video, so my next step was obviously to search "svelte and pocketbase" AND GUESS WHAT, YOU UPLOAD A VIDEO ABOUT IT!????
Pocketbase looks really cool. I always liked paradigms where the API is closer to the database where you can self host (don't tell Theo). If I wasn't firmly planted with FastAPI + Redis/PostgreSQL; I'd start all over with Pocketbase.
@hamm8934
Жыл бұрын
Ew Theo. Wish he wasn’t as toxic as he is because he’s got some interesting takes
@nomadtrails
Жыл бұрын
@@hamm8934 Theo is toxic? link please. Only saw him once and thought his takes were on point.
@gerooq
4 күн бұрын
@@hamm8934Be very suspicious of these "interesting" takes
This video has such a high value! I feel like learning the steps to write this individually would take days possibly if you'd do it yourself
As a web developer who pretty much exclusively uses vanilla HTML/CSS/JS for frontend and PHP/PostgreSQL for backend hosted on a local apache web server, this stuff is completely new to me, but it definitely seems like a much simpler way of creating web apps.
@iamvalenci4
Жыл бұрын
the things you are learnig are the fundaments of this technology, so when you want to learn one of these technology, it will be easy for you.
@manojramesh4598
Жыл бұрын
@@iamvalenci4 true
@dejangegic
9 ай бұрын
why are you using Apache?
One of my favorites videos of yours
This is what i started with last night and here comes the God’s video to save me a week. I have not tried it but looking the video i have a question can we use the same pocketbase installation for several projects. Is there a concept of schemas to separate the data?
As someone that started to code recently and varely understands vanilla Javascript, one quarter of my mind can follow what this guy is doing and the rest 3/4 is blown by the knowledge and makes me feel like a monkey eating dirt. Wonder if i'll ever be this good. Amazing channel and content!
@cody_code
Жыл бұрын
You will be, just keep at it!
@yashpandey350
Жыл бұрын
Feeling is mutual 😅😅, I know django's sqlite and mongodb (Mern stack) related stuffs but still this content is like a bouncer for me 😛😛
@weblure
Жыл бұрын
Don't set your bar this low, lmao I recommend sticking to pure programming languages and staying far away from all these bulky, buggy, and security-compromising libraries/plugins/etc. The chat he made is complete dogshit, I swear it's worse than the AJAX chatroom I made when I was 14
@Nobodylihshdheuhdhd
10 ай бұрын
@@weblurehow 🤡
Nice tutorial pls create more on pocket base and svelte..
Super amazing work dude 🙂 !!!
Loving the Svelte and Pocketbase videos. Thanks a million!!
On a side note you are low key one of the funniest creators in this space 😂
Great video! I have a question. Can you use the linode's volume you created to be the source of data of multiple pocketbase instance? Thanks
I like how the hosted app is on fire right now! Literally...
@hakuna_matata_hakuna
Жыл бұрын
I don't think he expected thousands of requests per minute
Thanks for the video. Why do you await the call (9:50) in the mounted hook? That just blocks the page and the data has no dependencies, instead, a loading spinner with a certain treshold could be shown while the rest of the UI renders.
as of 15 minutes after the video was posted, the chat doesn't register emojis anymore, so i guess it didn't scale 🤣🤣
Does the pocketbase JS lib do optimistic updates or does the app roundtrip before showing your submitted chat message?
Love this channel. This project showcase actually made me try out linode.
Two space indentation? Literally unwatchable. :D Great video, I might use Pocketbase for some side projects after seeing how easy it is to get things up and running.
Just finished building my portfolio website in Svelte.... This should come in handy this weekend 😊
Yow this is 🔥🔥🔥, It literally enlighten me how backend works... Dang as an aspiring developer this is a big help. Thank you 😎😎😎
you the best, we want more videos about the Spock patern
Another great video! so one thing I'm confused about, use svelte or sveltekit on the front end? 😕Also, the "spock stack" needs to stick!
Love the videos! More SSR stuff please 😍
10:30 pretty sure it doesn't render them more efficiently :) just updates them more efficiently in case if one of the messages gets deleted
Bro this is super awesome and fun . Thank you for the tutorial
Hahaha the whole video is about svelte is awesome 😎😎😎 totally agree with Jeff😎😎😎
Saw this coming from your love of pocketbase and svelte... so gud! Kudos!
Great little tutorial. You should do more PocketBase stuff. But your Linode link is dead. Seems they've been acquired by Akamai. Do you still use this now that it's with Akamai or can you recommend another Linode type host provider?
Thanks for the tutorial. Svelte is amazing
This was great.
As a C# / Microsoft Stack developer, I do often default to "What can i put together quickly in Azure" and it is increasingly painless these days to set up "something quick" (Blazor + VSCode deploy is ace). However I'm increasingly tempted by baas. Just having authentication and a database out of the box is very tempting. And Blazor is nice but it has a lot of "magic" that svelte seems to not carry as extra weight....
@ioneocla6577
Жыл бұрын
For all my c# projects I just use azure app service which is kinda like firebase for azure
@ChrisPepper1989
Жыл бұрын
@@ioneocla6577 I also just use an app service but it's not quite firebase from what I can see? There is still a slightly more manual sql set up and authentication isn't quite out of the box either... Unless I'm overestimating what firebase does? I quite like the look of amplify, there are some nice tutorials for blazor on amplify and it comes with a lot of things in a nice package.
excellent tutorial 😍👌🏻
There doesnt seem to be a way to filter the realtime subscriptions, its either everything or by record ID so this kinda breaks down if you needed to implement something like chatrooms. Or at the very least your data model would have to change...
Crazy how I just started to built a Pocketbase and Svelte app and this releases
@mohsinyamani5497
Жыл бұрын
Me too, was just starting a project with this stack as well
@unorthodox1430
Жыл бұрын
he knows, he always does
What a lovely tutorial !! Fireship is a 10
Currently using sveltkit to build a website and I am loving it
Fascinating.
i would love to click thousand "i like", dude you're awesome, a lighthouse for newbies
Damn the chat gets bombed immediately once the video released
please make more videos about svelte
I enjoyed interacting with the app, but i don't think it is very responsive. I would love to see it remade using the T3 stack. This app is the perfect benchmark for it
I've seen you used some kind of visualization tool to present backend. What's that?
Question about security: At 11:11 you have the sendMessage function that submits the chat message and the user ID. Could someone not hijack this function (using Devtools) and change the user ID to that of another user (to impersonate a message from someone else)? Or does Pocketbase automatically have protection against this?
Excelente, me encanto la forma y toda la informacion, increible, muy bueno 🔥🔥🔥🔥🔥🔥 Excelente, me encanto la forma y toda la informacion, increible, muy bueno 🔥🔥🔥🔥🔥🔥 Excelente, me encanto la forma y toda la informacion, increible, muy bueno 🔥🔥🔥🔥🔥🔥
wait your local pc runs debian? are you usin' chromeos?
10:31 the bass drop. Damn.
Hold on, THAT LAST CLIP!
This is awesome. Pocketbase is the gigachad of bases. I'm glad I learned about Linode too! I was using Fly
@TheGargalon
Жыл бұрын
Make the effort to learn AWS and you will never need any other service ever again for anything
Just checked out the live app..All the messages are pooped on and the send button doesn't work 🙃
would i be able to say "I use arch btw" if i use something based on arch, like manjaro?
Great tutorial but damn what happened to the the rock climber
What did use to style the current website?
9:59 cannot remember how its called, but you receive many data in JS, which can lead to leaks. Later you extend the user to contain more sensitive data and you loaded all this data to the collection, which every logged in user can collect =) _EDIT: except this is server side rendered ... but i dont know that yet._
@vzxai4275
Жыл бұрын
dose this being SSR protect the data tho
Recently I started to play with pocketbase too, only problem I had faced so far is, importing a dataset to the database. I guess there is no bulk insert.
@derzart
Жыл бұрын
The SQLite database file is under pb_data folder, you can open them up using tools like DataGrid or Navicat and do any importing and exporting you’d like.
@marusdod3685
Жыл бұрын
@@derzart but then pocketbase'll likely not recognize it since more likely than not it stores a bunch of metadata to recognize the schemas
@pixobit5882
Жыл бұрын
@@marusdod3685 i don't think so. Sqlite should store the schema itself
@tinmank
Жыл бұрын
@@derzart I've tried that, I don't know the ID format, no description in the documentation about it, also some other, default columns needs to be populated along with it.
cant you use kubernetes inside of linode to scale horizontally?
Cool 😎
Now I think Jeff can atctually sell anything. Definitely, not just a JS framework
This is amazing. Pocketbase give me so many reason to try it out.
Linode That sounds too fancy
Please fireahip your tutorial is awesome, thanks for the new update,
was wondering if it could also be utilized to share files in the chat?
- fireship built a new app - me : Speed of the vid == 0.5
Does Svelte has good auto complete in VS code? Because that syntax looks weird
@isdeonf
Жыл бұрын
Yes it does. Especially if you use SvelteKit
@TheGargalon
Жыл бұрын
@@isdeonf Especially^2 if you use Copilot
thanks
this is gold, much appreciated
That Lil Wayne throwing money is my wallpaper🥰
I like subsucribe funtion which give you Server-Sent Event that easily. It feels like websocket connection.
I want to like this video twice =D
When you expand the user, you return all the data of this user, is there a way to filter the data of this user? Currently I find that it overfetches user data for nothing.
so, I tested the app, and the answer is, no, it doesn't scale that well :D I had to use devtools to make sure if my message was sent. Still, great video, cool tech
I'm actually really curious to know how you made the reactions system. Last time I tried Pocketbase you could't make sure a user had a "reaction" record for a "message" already to prevent people from reacting to the same message multiple times.
@hakuna_matata_hakuna
Жыл бұрын
you could create a unique index on user and reaction , this needs access to the pb_data/data.db
@valtism
Жыл бұрын
The way I would do it is to have a new table for reactions that has the userId and postId. If the user tries to react to something it would check to make sure that combination did not already exist.
@ShafterPlay
Жыл бұрын
@@hakuna_matata_hakuna Yep, but that's not really ideal, right?
@ShafterPlay
Жыл бұрын
@@valtism That's what I'm describing, I don't think you can currently do this with Pocketbase :/
@josewilhelm2717
Жыл бұрын
It would be something like a many-to-many relationship in a RDBMS. One entry relates a post, another one your user, and a third for a reaction type, so there can't be more than 1 entry in that table with the same 3 values at once
Do you prefer Supabase or Pocketbase? Or maybe is creating a traditional back-end with Node better?
@realmimak
Жыл бұрын
Pocketbase is sqlite-based while supabase is enhanced postgres with a layer of backend utilities like real time/graphql APIs and row-level security. While pocketbase comes in handy for small-to-mid projects, you wouldn't reasonably choose it over supabase if you see a db scaling scenario possibility
you're a badass Lego programmer
How do you create an elegant m2m relationship?
someone rebuild it with a scalable backend 🙂. Maybe a follow up video on where it fell down, how many simultaneous users...100? How many reqs per second? 500?
Great video...and a good Linode embeded commercial. Need to see if Pocket Base works with Tauri...
@moracabanas
Жыл бұрын
I was thinking the exact same I am kind of obsessed with Tauri 🤣
I really loved your work this year even if you continue to type "catch(err)" instead of "catch(exception)" 😅
The sideproject directory looks like list of topics you covered in your videos, hmm...
how the fuck does this guy make things look so easy
Yeah why would I want linode when I have to pay up the wazoo to scale. Is TidalScale becoming cheaper or something?
Fireship single-handedly pushing more dev into svelte. NGL, svelte is the best thing in the world of web framework
Awesome but as a backend dev I always like to have more control over performance and relational data is always something to keep an eye on. In frameworks like Laravel you can use Eloquent or Query Builder but all that does is to organize a nice little query for you to use. In some cases I need use raw queries to improve performance (for millions of records that relate to everything) and I don't see that kind of backend scaling to those levels. I might be wrong and Svelte is awesome, thanks Fireship for clearing the path.
What is the source of the climb video ? 😁
As a climber, that climber fall at the end was too much GOOD VIDEO OTHERWISE THANKS
What VSCode icon and theme is that?
"...With flat predictable pricing that won't cause collateral damage" now that's one hell of a pun
@anarcus
Жыл бұрын
Is that even a pun?
How does pockebase compare with supabase?
More video about svelte?
I followed this guide and it fails to create the record at the signup part.. not sure whats wrong here
Would be cool to see it redone in sveltekit.
We need a "Scala in 100 seconds" video