I built a $5 chat app with Pocketbase & Svelte. Will it scale?
VloĆŸit
- Äas pĆidĂĄn 18. 12. 2022
- 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 - VÄda a technologie
Hereâs your $100 stimulus check, go break something (must be used in 60 days) www.linode.com/fireship
will do.
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.
good looks
@@zedespook DAMN BRO THATS HARSH
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).
Thanks for giving us PocketBase, it's very appreciated!
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.
@@Fireship Please do! Would be interesting to see the stats
@@Fireship on the 5$ server?
@@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 đ
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
The openssh scp implementation actually uses sftp to copy the file.
Calls âcpâ wtf?
@@mudhutonthemoon Yes, its called a program call. how do you not know?
@@garethgan9519 I thought it was calling something more nefarious.
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.
Awesome idea! Because right now all beginners know how to start, but as we have seen itâs not production ready
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
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!
This is not a production app ;)
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.....
Appwrite ftw.
There's nothing wrong using maintained libraries/platforms which helps you develop faster and make more maintainable applications
I pray for the person who has to touch your code if everything you write is from scratch lol
i thought the same and still think a zero-dependency app is great but some tools like svelte are really fucking useful
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.
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.
Thanks Michael, as a newbie coming from Python this is a bless! đ
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.
@@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.
@@michaelaboah1322 Vercel also maintains Next.js, not React. A team in Meta (facebook) maintains React
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â€
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.
Ew Theo. Wish he wasnât as toxic as he is because heâs got some interesting takes
@@hamm8934 Theo is toxic? link please. Only saw him once and thought his takes were on point.
One of my favorites videos of yours
On a side note you are low key one of the funniest creators in this space đ
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
Super amazing work dude đ !!!
Nice tutorial pls create more on pocket base and svelte..
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.
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.
â@@iamvalenci4 true
why are you using Apache?
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 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!
You will be, just keep at it!
Feeling is mutual đ đ , I know django's sqlite and mongodb (Mern stack) related stuffs but still this content is like a bouncer for me đđ
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
â@@weblurehow đ€Ą
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?
I like how the hosted app is on fire right now! Literally...
I don't think he expected thousands of requests per minute
as of 15 minutes after the video was posted, the chat doesn't register emojis anymore, so i guess it didn't scale đ€Łđ€Ł
Loving the Svelte and Pocketbase videos. Thanks a million!!
Love this channel. This project showcase actually made me try out linode.
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
Love the videos! More SSR stuff please đ
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.
you the best, we want more videos about the Spock patern
Yow this is đ„đ„đ„, It literally enlighten me how backend works... Dang as an aspiring developer this is a big help. Thank you đđđ
Just finished building my portfolio website in Svelte.... This should come in handy this weekend đ
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!
Bro this is super awesome and fun . Thank you for the tutorial
Does the pocketbase JS lib do optimistic updates or does the app roundtrip before showing your submitted chat message?
Hahaha the whole video is about svelte is awesome đđđ totally agree with Jeffđđđ
Thanks for the tutorial. Svelte is amazing
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
10:31 the bass drop. Damn.
Crazy how I just started to built a Pocketbase and Svelte app and this releases
Me too, was just starting a project with this stack as well
he knows, he always does
What a lovely tutorial !! Fireship is a 10
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...
excellent tutorial đđđ»
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?
please make more videos about svelte
Saw this coming from your love of pocketbase and svelte... so gud! Kudos!
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....
For all my c# projects I just use azure app service which is kinda like firebase for azure
@@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.
Currently using sveltkit to build a website and I am loving it
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?
Hold on, THAT LAST CLIP!
I've seen you used some kind of visualization tool to present backend. What's that?
Great tutorial but damn what happened to the the rock climber
i would love to click thousand "i like", dude you're awesome, a lighthouse for newbies
Linode
That sounds too fancy
This is awesome. Pocketbase is the gigachad of bases. I'm glad I learned about Linode too! I was using Fly
Make the effort to learn AWS and you will never need any other service ever again for anything
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
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.
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.
@@derzart but then pocketbase'll likely not recognize it since more likely than not it stores a bunch of metadata to recognize the schemas
@@marusdod3685 i don't think so. Sqlite should store the schema itself
@@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.
would i be able to say "I use arch btw" if i use something based on arch, like manjaro?
was wondering if it could also be utilized to share files in the chat?
Fascinating.
That Lil Wayne throwing money is my wallpaperđ„°
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 đ„đ„đ„đ„đ„đ„
Damn the chat gets bombed immediately once the video released
Just checked out the live app..All the messages are pooped on and the send button doesn't work đ
This was great.
What did use to style the current website?
wait your local pc runs debian? are you usin' chromeos?
Now I think Jeff can atctually sell anything. Definitely, not just a JS framework
I really loved your work this year even if you continue to type "catch(err)" instead of "catch(exception)" đ
Please fireahip your tutorial is awesome, thanks for the new update,
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._
dose this being SSR protect the data tho
you're a badass Lego programmer
The sideproject directory looks like list of topics you covered in your videos, hmm...
How do you create an elegant m2m relationship?
cant you use kubernetes inside of linode to scale horizontally?
I wonder if we can do .sv instead .svelte for svelte file format
Damn the ending broke my heart :'(
Same, hope they're ok đ©
@@otek_ they are, thankfully. czcams.com/video/66KF_5JWpdA/video.html
Great video...and a good Linode embeded commercial. Need to see if Pocket Base works with Tauri...
I was thinking the exact same I am kind of obsessed with Tauri đ€Ł
What is the source of the climb video ? đ
Does Svelte has good auto complete in VS code? Because that syntax looks weird
Yes it does. Especially if you use SvelteKit
@@isdeonf Especially^2 if you use Copilot
Nothing has ever had me relate so hard to you as your side projects folderđ
this is gold, much appreciated
"...With flat predictable pricing that won't cause collateral damage" now that's one hell of a pun
Is that even a pun?
This is amazing. Pocketbase give me so many reason to try it out.
holy shit the dude who fell at the end
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?
As a climber, that climber fall at the end was too much
GOOD VIDEO OTHERWISE THANKS
- fireship built a new app
- me : Speed of the vid == 0.5
More video about svelte?
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
after what happened on the first day of discord, leaving a chat app open like that, we know how it will end hahahaha
ClientResponseError 403: Only admins can perform this action.
didn't last 10 minutes
You can login, but can't send messages.
Would be cool to see it redone in sveltekit.
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.
We need a "Scala in 100 seconds" video
Did you load test it?
I like subsucribe funtion which give you Server-Sent Event that easily. It feels like websocket connection.
Why is Spock in Thimbnail? I've been thinking about it for while but have no clue đ€
What happened to the guy at the end who fell off a cliff?
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
if i instead use my pi zero where do i find the ip adress from wich i can access pocketbase???
How does pockebase compare with supabase?