TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: libmodulor – An opinionated TS library to build multi-platform apps

51 pointsby pmdfgy4 months ago
Initially I started building this for my own projects. The main goal was to define a unified &quot;blueprint&quot; allowing me to develop multi-platform apps using the same code, without code generation. I wanted to be able to develop the same functionality on web, desktop, cli, server, mobile, whatever...<p>I&#x27;ve been able to achieve this by relying on TypeScript, a 4-layer architecture (UseCase =&gt; App =&gt; Product =&gt; Target) and dependency injection.<p>This mechanism allows me to use whatever tech stack I want, provided the good adapters are developed. For instance, I have pre-built ones : node express (server), next.js (server), node hono (server in alpha), node parseArgs (CLI), node stricli (CLI), react-web-pure (web with no CSS), react-native (mobile), node mcp server (anthropic MCP in alpha), etc.<p>The same goes with data storage : Postgres, SQLite, a txt file, whatever.<p>It also comes with auto testing and auto documentation.<p>Did I reinvent the wheel ? Probably on some aspects. Is it too much abstraction ? Probably as well. But I like the idea of modularity and portability.<p>That&#x27;s why it&#x27;s not made for everyone, nor all types of projects.<p>If you like testing new stuff, give it a try and feel free to ping me if needed, I&#x27;d love to help.<p>I&#x27;m aware the documentation is not state of the art yet. I wanted to focus on the &quot;Getting Started&quot; Guide to give a quick overview instead of going to deeply into the details.<p>Best,

6 comments

gr4vityWall4 months ago
Congrats on your project.<p>I feel like you could describe the abstractions you built in more detail. When I read the explanation for what the &#x27;UseCase&#x27;, &#x27;App&#x27;, &#x27;Product&#x27; and &#x27;Target&#x27; were, it wasn&#x27;t clear how each of those translates to TypeScript. My guess is that &#x27;UseCase&#x27; and &#x27;App&#x27; would be like Classes, if you&#x27;re modeling your program in an OOP way? The &#x27;Product&#x27; seems like it would be the TypeScript project itself, with the package.json, source code and all of that.<p>I would rethink how you named the &#x27;App&#x27; layer. The examples given (&#x27;auth&#x27;, &#x27;accounting&#x27;, etc.) are not necessarily what I would call an &#x27;app&#x27;.<p>As you introduce names and concepts for things in your library, I recommend trying to keep the cognitive load as low as possible. It seems like there are a very high amount of high-level concepts and implementation details like types, functions, etc. that 1. are specific&#x2F;unique to libmodulor and 2. you need to learn before you can start actually building your application, from looking at the examples. The barrier to give it a try in a side project seems really high.<p>Building things is cool regardless :) I&#x27;m happy that you built something it&#x27;s useful to you and that you got to share here.
评论 #42811455 未加载
pmdfgy3 months ago
Based on your feedback, I&#x27;ve released v0.4.0.<p>It includes a simple react-native target to show how to do it. To make things easier to understand, I&#x27;ve also revamped the documentation, added a Guide to create your own target and enhanced the Tutorial with a RN target.<p>Finally, I&#x27;ve added the Tutorial code in the repo for whoever wants to browse it without necessarily performing all the steps.<p>Thanks a lot again for your feedback. My email is open :)
tomhallett4 months ago
I enjoy your 4 types on the architecture.<p>But I’m still a bit confused on what the project actually “is”. I see you have an architecture and I’m using ts to define the interface between those 4 types of components. But let’s say I have a react-native target: what am I expressing in that interface? A cli which can build&#x2F;deploy that interface? Each ui screen in that rn app (rn login, rn add contact)? Or all of the api endpoints in the web target which gets called by the rn target?<p>In the readme, I would focus a bit less on the UML part, and a bit more on the “if I have a webapp and a mobile app, with auth and crud for contacts, here’s what you’d need”
评论 #42805614 未加载
bjacobso4 months ago
You should check out <a href="https:&#x2F;&#x2F;effect.website&#x2F;" rel="nofollow">https:&#x2F;&#x2F;effect.website&#x2F;</a><p>It might help you implement some of these ideas
yasserf4 months ago
Looks great!<p>I build something similar (vramework.dev), actually on my way now to give a talk on it<p>Got a presentation for it at presentation.vramework.dev if anyone is interested
评论 #42807843 未加载
评论 #42805644 未加载
评论 #42805605 未加载
0x20cowboy4 months ago
I find most often people who are opinionated have very little knowledge on the subject. They are opinionated in an effort to try to keep discussions in a realm they feel they have some sort of expertise, but by definition their limited view makes them look silly to those with deeper understanding.<p>I apologise for being off topic, but I really want “an opinionated X” to stop having some kind of positive connotation to junior devs.
评论 #42811427 未加载
评论 #42806204 未加载
评论 #42807049 未加载
评论 #42806259 未加载
评论 #42807728 未加载