1 pointby uday_singlr3 hours ago1 comment
  • uday_singlran hour ago
    As everyone knows, in a typical Java app, data moves through multiple stations just to get out the door: JDBC, ResultSet, POJO mapping, Hibernate sessions, Jackson serialization, etc. Every station allocates memory. Every station loses type info the next one has to rediscover.

    I wanted to see what happens if we strip the pipeline down to its absolute minimum. The result is an experimental library I’m calling Monolith. It uses Java FFM (Foreign Function & Memory API) to talk directly to Postgres.

    The core premise: a single Java record is the source of truth. You write a record, and an annotation processor generates the Postgres schema, a binary reader, a builder, and a matching TypeScript reader at compile time. No reflection. While building it, I also added support for live queries. One can subscribe to a query, and Monolith watches the Postgres write-ahead log (WAL) to know when underlying rows change, automatically re-running the query and pushing the new result.

    To be clear: this is v0.1. It is highly experimental. Postgres is still a server over a socket. This might be a terrible idea but it was a great excuse to push Java FFM.