Run SQLite As A Server with LibSQL Step By Step

  Рет қаралды 2,913

Stephen Blum

Stephen Blum

4 ай бұрын

Terso has created an open source core engine, LibSQL, which is based on SQLite, the most used database in the world. SQLite is generally built into applications, like web browsers, where you need to access a database, typically locally. Terso has expanded its capabilities.
Now, you're not limited to accessing the database in one location, you can do it from multiple places. This can even involve accessing an embedded database from afar. This was made possible by adding a server layer and a replication layer.
SQLite wins over alternatives like Postgres and MySQL due to its ease of use, powerful speed, and cost-effectiveness. Now, you can do most of what you need with the addition of SQLite, but at a lower cost and higher scale. If you haven't already, I recommend checking out LibSQL by Terso.
SQLite finds its base in many applications, including the web browser I'm using right now. Terso has developed a fork, LibSQL, from the original SQLite code and made it open source. They even added a server mode to it.
These databases can prove very useful in a variety of use cases. Sometimes, you might want to operate your database like a server, and they've made it simple to do that. What's cooler is that you can create local clones with read access to in-memory data which leads to a powerful, efficient serverless operation.
This is possibly the most efficient method and it can't be outperformed. Thousands of extensions are supported. You can also link it with limitless replication, which is very powerful.
You simply point it towards an S3 bucket and get unlimited data copies, back-ups, and syncs. Now, let's test it and see it run locally. Let's operate our own SQLite server using Terso's fork, named LibSQL. The easiest way is to copy the Docker image by clicking once.
After copying and pasting the command and witnessing some output, we have SQLD up and running. All we have to do now is test it with a SQL statement against it. Once we have ensured everything is running correctly, we can access our SQLite database from anywhere remotely, as long as we can connect to our server via an IP address.
This addition by Terso has been transformative. We have a running container and can access it easily. Now, any code can be executed with a request library like HTTP in your desired language.
You'll want to be careful when using this system as it's not intended as a full hosted system right out of the box. It doesn't afford the same permissions that MySQL or Postgres do. the trade-off is its outstanding performance. You can also run it in read replica mode, which lets the database be distributed globally and offers a faster user experience.
Finally, we will examine the addition of replication capabilities. This is a real game changer.

Пікірлер: 26
@weiSane
@weiSane 4 ай бұрын
Thanks Stephen. Now I can use this for my side project. Learned a lot and my previous confusion of libsql and sqld is gone .
@StephenBlum
@StephenBlum 4 ай бұрын
Nice! It's a great DB and will be fantastic for your side project 😄
@JeremyAndersonBoise
@JeremyAndersonBoise 5 күн бұрын
Bro, not exactly new news, but good lord, I love libsql! Wait, now I realize this is 3 months old, hell yeah Turso
@StephenBlum
@StephenBlum 4 күн бұрын
libSQL is amazing! Turso did a great job brining libSQL to the world 🙌🎉😄
@BentleyThomas
@BentleyThomas 19 күн бұрын
love your delivery😊
@StephenBlum
@StephenBlum 19 күн бұрын
Thank you!! 😊 looking forward to continue planning more videos. Lots of great software engineering topics 😄🙌
@iatheman
@iatheman Ай бұрын
Dude this is so high quality. I hope the channel keeps growing.
@StephenBlum
@StephenBlum Ай бұрын
Your comment is great to hear! Thank you 😊🎉🙌 more videos planned
@HomeEngineer-wm5fg
@HomeEngineer-wm5fg 4 ай бұрын
@8:11 This Sir is my DREAM skill to learn! It is a core feature in a hypothetical app I want to produce.
@StephenBlum
@StephenBlum 4 ай бұрын
That sounds exciting! A powerful skill 😄🚀
@HideBuz
@HideBuz 13 күн бұрын
Thank you a lot for covering libsql. Can you do a whole project with libsql, setting up sqld daemon server, setting up multiple minio storage buckets, then connect to it and enabling embedded replication in libsql, for a simple edge hosted project? I think that the libsql docs are not really good in explaining how it really works, so it needs guys like you that put it all together for beginners like us. Thank you a lot for your content! Subbed!
@StephenBlum
@StephenBlum 12 күн бұрын
that sounds amazing! 🤩 minio + libsql + WAL mode + VFS as a distributed database. WAL mode should allow for this. You point the database-file.db to a mounted directory VFS connected to minio bucket. That should do it I think. Definitely needs testing. Great idea! Add your idea to the planned videos list 😄
@HomeEngineer-wm5fg
@HomeEngineer-wm5fg 4 ай бұрын
Thanks so much for this! I would love to see more libSQL content. All kinds of CRUD applications I could produce from a decent framework using it.
@StephenBlum
@StephenBlum 4 ай бұрын
Nice! Do you prefer the HTTP API or the embedded API? The HTTP API allows you to host the DB on a remote server that multiple application workloads can access. The embedded API only works locally.
@HomeEngineer-wm5fg
@HomeEngineer-wm5fg 4 ай бұрын
@@StephenBlum I don't know the tradeoff, admittedly I am going to be running this locally, a "star network" mirroring a database on a shared drive with the option to have concurrent updates from multiple users inputs.
@StephenBlum
@StephenBlum 3 ай бұрын
That is awesome! Using the docker container for LibSQL and the sqld server allows you to share database easily with concurrent user access 🎉🚀
@ricko13
@ricko13 15 күн бұрын
lol 😁 i've never seen a guy that excited about a database...
@StephenBlum
@StephenBlum 14 күн бұрын
😄 🙌 it's exciting because it's powerful. And you can start businesses. The potential is exciting 🎉
@tutkodev
@tutkodev 3 ай бұрын
Any opinions about how Astro implemented the LibSQL in their "Astro DB" offering?
@StephenBlum
@StephenBlum 3 ай бұрын
I took a look at astro.build/db/ and it looks like a solid implementation. They use the standard features by reading the docs it looks like they could have used standard SQLite as well. Based on their prices, writes are 1000x more expensive. It looks like they really are using the replication capabilities of libSQL 🚀
@jsward17
@jsward17 Ай бұрын
Is redis no longer necessary? Turso has no redis option
@StephenBlum
@StephenBlum Ай бұрын
Good question! Even though SQLite/Turso doesn't have Redis, that is okay. And for the most part Redis isn't needed. You can simplify your stack by using 100% SQLite/Turso. There are some future considerations: Redis vs SQLite these have different architectures. SQLite will have more SQL capabilities than Redis, which sets you up for future query needs. And Redis is built specifically for speed and simple queries. You'd ideally use both for their strengths. Redis will be faster for simple get/list/fetch items, and faster changing items. SQLite will be best for more complex joins and aggregations.
@makasiparsad
@makasiparsad 3 ай бұрын
Surely bottomless implies a paid service, yes?
@StephenBlum
@StephenBlum 3 ай бұрын
It's actually 100% open source!
@minor12828
@minor12828 2 ай бұрын
This is nothing new and in fact it is a bad idea the fact that you can acces it remote. Just set a cron job with ssh access and a rsync config and you'll be good.
@StephenBlum
@StephenBlum 2 ай бұрын
That's a great idea! Yes that will also work very well. Your approach is excellent because of the simplicity and idempotent nature. Great comment I love to hear this feedback. Thank you!
Life After SQL (EdgeDB Is Fascinating)
15:40
Theo - t3․gg
Рет қаралды 55 М.
AstroDB might be the easiest SQL setup you can get
9:15
Web Dev Cody
Рет қаралды 12 М.
He sees meat everywhere 😄🥩
00:11
AngLova
Рет қаралды 11 МЛН
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 18 МЛН
Sigma Girl Past #funny #sigma #viral
00:20
CRAZY GREAPA
Рет қаралды 32 МЛН
libSQL
18:33
ScyllaDB
Рет қаралды 1,6 М.
Astro Launches Actions Similar like Next.js ("Quick" Reaction)
14:01
James Q Quick
Рет қаралды 2,9 М.
Multi database schema changes
1:22
Turso
Рет қаралды 3 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 177 М.
Adding Agentic Layers to RAG
19:40
AI User Group
Рет қаралды 16 М.
Drizzle ORM in 100 Seconds
2:54
Fireship
Рет қаралды 444 М.
Add extra server to Coolify
10:34
360Creators
Рет қаралды 4,5 М.
DjangoCon Europe 2023 | Use SQLite in production
29:45
DjangoCon Europe
Рет қаралды 8 М.
98% Cloud Cost Saved By Writing Our Own Database
21:45
ThePrimeTime
Рет қаралды 314 М.
Tag her 🤭💞 #miniphone #smartphone #iphone #samsung #fyp
0:11
Pockify™
Рет қаралды 17 МЛН
Best mobile of all time💥🗿 [Troll Face]
0:24
Special SHNTY 2.0
Рет қаралды 3 МЛН
Что не так с яблоком Apple? #apple #macbook
0:38
Не шарю!
Рет қаралды 485 М.