@JustDeezGuy Yes, and it's very sad to see "the right way" losing in cases like this.
There's just this huge network effect to the popular languages that brings in both quality (e.g., TypeScript is unparalleled) and quantity (endless libraries -- every vendor supporting the big guys)
@infinterenders What if we took it a step further and let the client compose the query itself -- full SQL power, executed on the server? (And make it so that nothing bad can happen)
No custom RSC per query shape -- client authored & dynamic. (I'm working on this! typegres.com)
Thought about this problem a lot -- bits I've converged on:
- container/microvm per tool call
- rootfs with bind mounts to your working directory and nix store (or even a nixos configuration)
- loads your devshell deps upfront -- so each workspace has the tools it needs
- network isolation (still have nix cache and can configure)
Any feature you think is missing/must have? (I haven't seen a product that has everything here though)
@Southclaws@ploeh Yeah, interesting approach -- I actually took it in a round-about way: still implement it in the application layer (TypeScript) but support each dialect fully (all types/functions/operators).
I'm genuinely curious, do you have code or a post to learn more?
@senro15@ploeh To give the LLMs immediate feedback if the code is correct -- much faster iterative loop (catch errors in your coding session rather than prod)
This is exactly what I've been working on for a year: first-class API and the a capability surface for LLMs
Every PG function and operator fully typed, encapsulate tables with classes/methods, then expose the classes directly as your API. Compiles to a single query
If interested: typegres.com
This list is pretty cool: a nice ergonomic layer for common patterns, so definitely feasible.
One cool one that Typegres already happens to share is the method chaining -- e.g., from the playground:
`count: orders.id.count()`
(if interested: typegres.com/play/)
@_rrdelaney@ploeh Curious what DuckDB features you're talking about.
Asking because Typegres supports all Postgres builtin functions (and now SQLite too), fully typed. Interesting if we did the same thing for DuckDB too? typegres.com
@BuildingWithTom 8s on 500 rows?! Was it doing some roundtrip or something?
RLS alternative might interest you: auth is structural, you use typed classes to return what the caller can reach, bound at query construction (i.e., injects the right `where`/`on` clause): typegres.com
@StackCurious I built `.live()` into Typegres for exactly this: subscribe to any query. No websocket needed, just a regular HTTP request. Works anywhere you have Postgres
typegres.com/play
@alexdeliadev@prisma@DrizzleORM Yeah and Drizzle (and every other ORM) doesn't enforce types within query expressions: eq(posts.title, posts.viewCount) (text vs integer) typechecks fine
That's what sparked Typegres: every operator and function is typed end-to-end, nullability included. typegres.com/play
@heyrapto Yeah — and with many tables, ORMs lack organization. How do you denormalize a relation without breaking clients?
My take: the TS class IS the layer. Computed columns + mutations live on the class, all compose to SQL. Schema underneath is refactorable. typegres.com/play
Built this because every app I've made ends up rephrasing the same data model four times: schema, ORM, controller, DTO.
Typegres collapses that to one class: clients compose typed queries against the methods you expose.
Typegres:
- Tables as TypeScript classes
- Methods are your API: clients compose real SQL (joins, aggregates, subqueries)
- Sandboxed via object-capability-based RPC
- Live queries built in
Try it in your browser 👉 typegres.com/play
I'm working on a fifth model, specifically for the agent use-case (a hybrid of 3 & 4): give clients a query builder with full SQL fidelity -- but that can't escape tenancy boundaries.
How much would that move the needle on an "untrusted middle layer"?
(Link if curious: typegres.com)
1K Followers 2K FollowingSenior JS/React dev building HashTry — tracks how well you know LeetCode problems, not just how many. Prepping for FAANG, documenting the grind.
128 Followers 3K FollowingI code to bring people together, and tweet about it occasionally. Eng. Mng.
@AppsFlyerDev, formerly @matific, https://t.co/J5LLvTi9Zc
297 Followers 1K FollowingFormer professional rubyist by day, now more of a generalist. Interested in F#, Haskell, Rust,and Elm. Okay at cycling, smoking meats, & pickleball. He / him.
74 Followers 289 Following...then the Lord spoke to Job out of the whirlwind, saying "IF YOU CAN'T HANDLE ME AT MY WORST, YOU DON'T DESERVE ME AT MY BEST."
↓ usually more on mastodon...
3K Followers 310 FollowingThe type-safe SQL query builder for TypeScript.
Not an ORM, product or company.
Inspired by Knex.js. From Objection.js' creator.
"what u see is what u get".
495 Followers 289 Following• Building products, not just prototypes.
• Currently building https://t.co/66LVTKkexs AI for visual storytelling.
• Built Roamer from idea → App Store.
311K Followers 300 FollowingA little bit geek, wonk, and nerd. Repeat entrepreneur, recovering lawyer, and former ski instructor. Co-founder & CEO of Cloudflare (NYSE: NET).
78K Followers 141 FollowingHave questions, or building something cool with Cloudflare's Developer products? We're here to help. For help with your account please try @CloudflareHelp
3K Followers 69 FollowingAn annual conference dedicated to helping people effectively use the functional programming language, Scala, to do more. Online - December 5th and 6th.
3K Followers 310 FollowingThe type-safe SQL query builder for TypeScript.
Not an ORM, product or company.
Inspired by Knex.js. From Objection.js' creator.
"what u see is what u get".
495 Followers 289 Following• Building products, not just prototypes.
• Currently building https://t.co/66LVTKkexs AI for visual storytelling.
• Built Roamer from idea → App Store.
161 Followers 1 FollowingAn AI life coach that keeps you consistent with your personal goals.
iOS: https://t.co/4rgSqk53hN
Android: https://t.co/BXEWKmQgbW
22K Followers 454 FollowingI'm a frontend engineer @OpenAI. Author of @octanejs, @ripple_ts, @lexicaljs and @inferno_js. I was also a core engineer who helped build @reactjs and @sveltejs
9K Followers 459 FollowingNow @tigerdatabase. The modern cloud platform built on PostgreSQL for time series, events, and analytics (and vectors too). ⭐️ - https://t.co/9HK3eQHggD.