Pinned Tweet
Layerbase is where high velocity developers and their agents get cheap, reliable databases
layerbase.com
sqlite ignores your REFERENCES by default. foreign keys are off on every new connection
PRAGMA foreign_keys = ON;
run it on each connect, outside a transaction. already have orphans? this lists them
PRAGMA foreign_key_check;
layerbase.com/db/sqlite
⛴️ SHIPPED
zero-downtime proxy upgrade
live database connections now move between proxy processes via Unix socket fd passing (SCM_RIGHTS)
your open transactions including LISTENs and Redis SUBSCRIBEs carry on through a deploy with a ~15 ms pause with no reconnects
this means...
we can ship new features, bugfixes, and enhancements several times a day without maintaining legacy containers
new users won't penalized for being early to the party
we handle all of this for you as well as PITR and branching for the same cost as a Hetzner server, there's no excuse left
Every day I read posts like ‘I saved $200/month by self-hosting!’.
Here is my honest take:
🚨 STOP SELF-HOSTING YOUR WEB APP & DATABASE
Unless you really really know what you are doing. Most likely you don't.
Let me explain:
🔐 Security: Especially now in times of AI finding a new vulnerability every day, you don’t want to be the one responsible for taking care of every little issue 24/7. A small issue that occurs while you are asleep can cost you your whole business.
💸 Cost: A $5 server seems cheaper than a $25 managed database until you count the hours you spend fixing it. Your time is the most expensive part of the setup. Also providers like Vercel & Neon have generous free tiers to get started with.
📈 Scaling: Going viral sounds great until your server crashes right when everyone shows up. Managed platforms scale up automatically, so your best day doesn’t turn into your worst.
📟 Downtime: When your server goes down at 3am or while you’re on vacation, there’s no support team to call. It’s just you, a laptop and angry users.
🌍 Performance: Managed platforms put your app on servers close to your users around the world. Your single VPS in one data center means slow load times for everyone far away from it and when the load increases.
💾 Backups: Everyone has a backup script, but almost nobody has ever tested restoring from it. You usually find out it’s broken the moment you actually need it.
🎯 Focus: Every hour spent on server configs is an hour not spent on your product. Your users don’t care where it’s hosted, they care that it works.
📜 Compliance: Things like GDPR, data encryption and audit logs are mostly handled for you on managed platforms. On your own server, you’re personally responsible if something goes wrong, and fines can be huge.
🛡️ DDoS: One angry person with a botnet can take your server offline in minutes. Big providers absorb these attacks every day without you even noticing. (been through it with outbid .lol)
Ship first, worry about infra later 🚀
That's right, a lot of people don't realize you can push code with codex voice mode on our PWA over Bluetooth while driving as low as $10/mo
It's just a cheap VM that is optimized for your existing agent subscriptions and GitHub but it ensures you never need to run home for an emergency bugfix again
Replying to @LoicReco
3/8 — CLOUD + MULTIPLAYER TEAM WORKSPACES (2/2)
𝗘𝗪𝗢: @Renzexi01 (maker) ewo.so - cross-team agent collab
𝗥𝗲𝗳: @reactiverobot (maker) ref.tools - doc-centric multiplayer agents
𝗣𝗮𝗱𝗮𝗿: padar.ai - anyone starts, agents build
𝗟𝗼𝗿: lor.chat - shared team AI workspace (beta)
𝗟𝗮𝘆𝗲𝗿𝗯𝗮𝘀𝗲: @layerbasedb layerbase.com/workspaces - sessions on your cloud+phone
𝗔𝗲𝘁𝗵𝗲𝗿: @aetherruntime runaether.dev - cloud agents on your sub
𝗖𝗹𝗼𝘂𝗱𝗿𝗼𝗼𝗺: cloudroom.dev - free OSS cloud agents
𝗠𝘂𝗿𝗺𝗲𝗹𝗹: @murmell_ murmell.com - shared cloud sandbox, path locks
𝗟𝗲𝘃𝗲𝗿𝗮𝗴𝗲 𝗖𝗼𝗺𝗽𝘂𝘁𝗲𝗿: leverage.computer - team agent computer
𝗥𝗮𝘃𝗶𝘅: ravix.sh - share running app + env
𝗬𝗼𝗯𝗶: agents.yib.io - workspace for agents+people
𝗘𝘅𝗽𝗼𝗻𝗲𝗻𝘁𝗶𝗮𝗹: exponential.at - dev platform, teams+agents
𝗚𝗿𝗮𝗶𝗻: grain.sh - AI teammates mission control
𝗢𝗿𝗰𝗵𝘆𝘀𝘁: @orchyst orchyst.net - Claude/Codex/Cursor in one chat
𝗥𝗲𝗽𝗹𝗶𝗰𝗮𝘀: @tryreplicas replicas.dev - cloud VMs, start from Slack
mariadb can hide a column from SELECT *
ALTER TABLE orders
ADD pkid SERIAL PRIMARY KEY INVISIBLE FIRST;
existing SELECT * keeps working. name pkid when you need it
layerbase.com/db/mariadb
until now every DB ran in the US
if your app was in europe, every query had to cross the atlantic 2x
some very persistent customers asked nicely...
we now support european (FR) servers
open to all plans at no extra cost
prioritized for paid plans based on availability
overwriting a redis key with plain SET quietly wipes its TTL. your 1 hour cache key now lives forever
SET user:42 v1 EX 3600
SET user:42 v2
TTL user:42 (-1, no expiry)
add KEEPTTL to keep the timer
SET user:42 v2 KEEPTTL
6.0+
layerbase.com/db/redis
🚨 DocumentDB is now a free engine on Layerbase
Migrate over from Atlas today:
layerbase.com/migrate/atlas
layerbase.com/blog/documentd…
duckdb lets you subtract columns from * instead of typing out the 20 you want
SELECT * EXCLUDE (password_hash, ssn)
FROM users;
REPLACE swaps one in place too
SELECT * REPLACE (cents / 100 AS cents)
FROM orders;
layerbase.com/db/duckdb
postgres 18 lets RETURNING hand back the old value and the new one from the same UPDATE
UPDATE products
SET price = price * 1.1
WHERE category = 'mugs'
RETURNING id, old.price, new.price;
no more SELECT first just to log what changed
layerbase.com/db/postgresql
clickhouse lets you stick If on the end of any aggregate. one scan, several filtered numbers
SELECT count() AS total,
countIf(status = 'error') AS errors,
avgIf(ms, status = 'ok') AS ok_ms
FROM requests
works with sum, uniq, quantile, all of them
layerbase.com/db/clickhouse
want one field in a valkey hash to expire without killing the whole key? 9.0+ can do that
HSET session:42 user bob csrf abc123
HEXPIRE session:42 600 FIELDS 1 csrf
csrf disappears in 10 min, user stays. HTTL shows what's left
layerbase.com/db/valkey
using a mysql table as a job queue? add SKIP LOCKED so workers stop waiting on each other
START TRANSACTION;
SELECT id FROM jobs
WHERE status = 'queued'
ORDER BY id LIMIT 1
FOR UPDATE SKIP LOCKED;
each worker grabs a different row. 8.0+
layerbase.com/db/mysql
sqlite will happily store 'abc' in an INTEGER column. add STRICT and it errors instead
CREATE TABLE users (
id INTEGER PRIMARY KEY,
age INTEGER
) STRICT;
'42' still converts to 42. works in 3.37+
layerbase.com/db/sqlite
paying too much for mongodb atlas? FerretDB and DocumentDB both speak the mongo wire protocol on top of postgres, so your driver and most queries stay the same
swap the connection string, test your indexes, done
we import straight from atlas, $5/mo flat
layerbase.com/migrate/mongod…
adding a CHECK to a big postgres table scans every row and blocks writes. split it
ALTER TABLE orders ADD CONSTRAINT pos
CHECK (total >= 0) NOT VALID;
ALTER TABLE orders VALIDATE CONSTRAINT pos;
validate doesn't block writes
layerbase.com/db/postgresql
duckdb 2.0 added triggers. this one keeps every row you delete
CREATE TRIGGER keep_deleted
AFTER DELETE ON orders
REFERENCING OLD TABLE AS o
FOR EACH STATEMENT
INSERT INTO orders_deleted FROM o;
orders_deleted just needs the same columns
layerbase.com/db/duckdb


