▲ | Show HN: Mosaic – A Kotlin framework for cleaner back end code(github.com) | |||||||||||||||||||||||||
24 points by Nick-Abbott 2 days ago | 9 comments | ||||||||||||||||||||||||||
Backend APIs often grow into large orchestration classes full of duplicated calls and manual concurrency. I’ve been working on Mosaic, a Kotlin framework that composes responses out of small, request-scoped “tiles.” Each tile runs once per request, dependencies resolve automatically, and independent tiles execute in parallel without boilerplate. It’s still early (v0.2.0), but working today for caching, concurrency, and testability. Curious to hear feedback on the approach. GitHub: https://github.com/Nick-Abbott/Mosaic Maven Central: org.buildmosaic:mosaic-core:0.2.0 | ||||||||||||||||||||||||||
▲ | banashark a day ago | parent | next [-] | |||||||||||||||||||||||||
How does this work internally? From the docs, it looks like it's building a graph to retrieve data, though the comparison it gives contrasts it to doing many small individual queries and passing them to other methods to get evaluated. I find in the apps I'm working on, either services will build complex queries themselves, or they need to make multiple queries due to data needing transformations between queries that aren't simple to facilitate in the database itself (these services also tend to avoid code in the database, which I'm mixed on). In the "Deep Composition" section it has a comment in the code `// These three tiles run in parallel`. Does that mean that the way of composition is through pulling in multiple different pieces of data then joining at the application layer? I'm coming from a very much sql mindset and trying to understand the intended mechanism for data retrieval here. It kind of reminds me of how ad-hoc LINQ queries use Expression trees to resolve sql queries, but not exactly the same. Or is the thought more that this would be used when you have many disparate data stores (micro services, databases, caches, etc) and doesn't make sense for a monolithic single-database application)? | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | FranzJosef 2 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
Interesting! This framework tackles complex APIs with contract-first design and real integration testing - no mocking! Sounds like a strong solution for API sprawl, and the Apache 2.0 license is great. Performance and ease of learning are the key questions I'd have. Worth a look. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | aerzen 2 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
That's a nice abstraction, kudos. I wish I'd read this README before I started my backend project. Does anyone know of a similar package in rust? My kotlin is a bit lacking to understand everything here. | ||||||||||||||||||||||||||
▲ | ImPleadThe5th 2 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
Looks interesting! Can anyone remind me. There's some .Net library that works similarly right? | ||||||||||||||||||||||||||
▲ | Rigoberto 2 days ago | parent | prev [-] | |||||||||||||||||||||||||
I want to know about this app |