r/sqlite • • Oct 17 '26

Row Level Security in SQLite on Cloudflare

https://mainbrella.com/blog/row-level-security-in-sqlite-on-cloudflare/
11 Upvotes

9 comments sorted by

2

u/716green Oct 19 '26

I migrated from D1 to Layerbase LibSQL because it's a fraction of the price. All the RLS in the world couldn't bring me back after those prices

1

u/groupicorn Oct 19 '26

interesting! https://layerbase.com/db/libsql checking this out now thanks!

1

u/groupicorn Oct 19 '26

I see what you mean! 20 GB, 100M writes would be $66.25 on D1 and just $20.00 on Layerbase.

1

u/716green Oct 19 '26

There's a two-click migration that I used Layerbase D1 Migration

The cool thing is that SQLite isn't directly compatible with libSQL but their migration tool converts the edge cases

1

u/groupicorn Oct 19 '26

Reading more about this: D1 charges based on rows read and written, making it extremely affordable for small applications but potentially expensive for write-heavy workloads. Layerbase charges a flat monthly fee with no per-query billing, but limits shared CPU, memory, storage, and bandwidth. Cloudflare's model supports massive scalability, thousands of isolated databases, and global read replicas without reserving resources. Layerbase prioritizes predictable costs within fixed resource limits.

2

u/716green Oct 19 '26

I pay 15/mo for a medium sized SaaS app with a few thousand DAUs, but I also have Valkey and Postgres hosted on the same account

I just prefer the fixed monthly fee. I would upgrade to one of the dedicated tiers if I needed to. I was also paying Neon almost $200/MO and now it's included in my $15/mo Layerbase plan

If you have enough traffic that you're exceeding those limits, you're probably not in a position where a $500 monthly bill is going to bother you but I think for most SaaS apps, more companies should provide fixed monthly fees. There's nothing more frustrating than getting an outrageous bill because you have 15 different agents working at the same time creating new branches

1

u/groupicorn Oct 20 '26

i got the free plan on both layerbase and turso and took them each for a spin: https://yapern.com/blog/turso-vs-layerbase-free-plan-sqlite-systems/

2

u/layerbase Oct 20 '26

Hey, sending you a DM

1

u/groupicorn Oct 19 '26

so you might end up hitting some limits with libSQL on layerbase under heavy load?