r/typescript

I'm going insane on how to rigorously structure my monorepo (backend + frontend)

TL;DR: Is there already a good framework/starter-kit for designing good maintainable frontend/backend monorepos? I'm not talking about bundlers like turborepo or NX, neither I'm talking about t3-stack or better-t-stack, I'm talking more of a very strict paradigm to design typescript frontend/backend monorepos.

I am currently slowly migrating a vibe-coded prototype of a huge software (20+ domains) to an actual production-ready product and I'm noticing how I'm slowly starting to hate the freedom TS/JS gives you, the fact that you can shape your codebase how you wish, the first refactoring I did was migrating all those scattered small sloppy ts files to domain services/sub-services, providing strong hiearchy (Java/C# like), but then noticed that I wasn't leveraging monorepo's features the fullest, so I had to modularize everything, but here I don't know what to do anymore, I don't think I was the only one facing this issue, and I can't migrate to another language 'cause we just can't afford it. The architecture I've thought of was to divide domains in packages and make packages have a strict structure both folder-wise and code-wise:

@acme/foo/
├── app/
│   ├── services/
│   │   └── foo/
│   │       ├── index.ts
│   │       └── types.ts
│   └── routers/
│       └── index.ts
├── data/
│   ├── models/
│   │   └── index.ts
│   └── index.ts
└── web/
    ├── components/
    │   ├── Foo.svelte
    │   └── Bar.svelte
    └── index.ts

But I feel I'm reinventing something someone must have already figured out, but I don't know where to search anymore...

reddit.com
u/Midk_1 — 1 day ago

Distributive Conditional Types

I started digging into TypeScript's type system for fun and stumbled onto distributive conditional types. One of those quiet features that is confusing until it clicks.

tejasbubane.github.io
u/tejasbubane — 1 day ago
▲ 6 r/typescript+4 crossposts

Architecture review: outbound-only connector for a browser-based PostgreSQL IDE

I'm looking for architecture feedback on a system I'm building.

The problem is simple: browser-based PostgreSQL IDEs shouldn't have database credentials, but many databases live on localhost, private VPCs, or internal networks. Requiring every user to deploy their own backend also felt unnecessary.

The architecture I ended up with is:

Browser

│ WSS

Cloud Relay

│ Outbound WSS

SW Agent

PostgreSQL

The agent runs wherever PostgreSQL is reachable, owns the credentials, executes queries locally, and streams results back. It never opens an inbound port—only outbound connections to the relay. The browser never sees PostgreSQL credentials.

Other design decisions:

- Browser is treated as untrusted.

- Agent re-validates SQL instead of trusting client intent.

- SSE wake channel + on-demand WebSocket data channel.

- Local hash-chained audit log for every action.

Architecture write-up:

https://vivekmind.com/blog/sw-agent-bridge-agent-that-connects-schema-weaver-browser-ide-to-user-s-postgresql-databases

I'd appreciate architecture and security feedback.

- Any obvious flaws in the trust model?

- Would you design the transport differently?

- Any attack surfaces or security concerns I'm overlooking?

u/Vivek-Kumar-yadav — 2 days ago

Zenolith a renderer engine

Hi everyone, a while ago I posted about zenolith, Now I've been changing the direction of it. It's no longer a diagram library, it's now intended to be a renderer engine.

It currently has basic support of 7 diagrams, diagram support may vary depending on syntax: mermaid, plantuml and zenolith own syntax.

I would like if you give it a look. It has a playground so no downloads required. I would appreciate any feedback.

It will be open-source once it's out of beta, since I'm still fleshing things out and want it to be in a "good" state for contributors, or interested people.

https://miguelarmendariz.github.io/zenolith/

reddit.com
u/BlueKnight3108 — 2 days ago

A question about typescript games

I am a fairly new typescript developer, I've got a lot of experience in other environments and languages, so as a side project I had decided to try my hand using typescript since I have gotten used to strong typed languages. Anyway my question is this how many of you make games and is there a real path to do so? I'm pretty burnt out on unity and godot is just hard to use (for me) and unreal is just not useful for the games I like making. I like old school flash games or retro styled games and typically stick to platformers, arcade/puzzle games or rogue like/ lite rpgs.

reddit.com
u/Complex-Success-62 — 5 days ago
▲ 132 r/typescript+17 crossposts

Walks the full cmd/compile pipeline in order: package names, data structures, and the SSA construction that drives inlining, escape analysis, bounds-check elimination, and register allocation, with flags to observe each phase directly.

This one took a while, it's probably the longest thing I've written on this blog. I wanted to do a proper end-to-end walkthrough of cmd/compile: real package names, real data structures, diagrams for the AST and SSA CFG, and the flags you actually need (-m, -m=2, GOSSAFUNC, -S) to observe each phase yourself rather than just take my word for it.

Covers the full pipeline: lexer → parser → type checker → IR lowering → SSA construction → optimization passes (inlining, escape analysis, BCE, nil check elimination, register allocation) → architecture-specific code emission.

Hope it's useful — happy to answer questions or push back on anything that looks wrong.

blog.gaborkoos.com
u/OtherwisePush6424 — 5 days ago

Pairing for typescript backend interview

Hey folks,

I have an interview coming up for a backend developer role, with the tech stack used: Node, Express/Nest.js, TypeScript & SQL.

Is anyone ready for pairing on coder pad or HackerRank? Let me know.

Right now I am mostly writing the solo programs for service, etc., but wanted to get into real-world queries.

We can start after the July 4th weekend.

Appreciate if anyone can spare sometime 😊

Thanks a lot

reddit.com
u/AIBotIsHere — 4 days ago

Heads up, watch out what you click when you search tsx package related stuff

Try doing a google search for tsx package. Their legit website is https://tsx.hirok.io/, but you will most likely see https://tsx.is in search results which seems like a weird (potentially malicious?) website impersonating tsx.

I clicked it once out of empty-mindedness (I was going fast and it was one of the very first few results) and it displayed a plain white page and indicated it is "loading" something - I closed it as soon as the realization hit me.

Anyone saw this website before and knows whether it's malicious or not? Def looks like one

u/wisnia74 — 5 days ago
▲ 75 r/typescript+13 crossposts

Here is Jrapzz, a carefully curated playlist regularly updated with Nu-Jazz, UK Jazz, Acid Jazz, Jazzhop, Jazztronica, Future Jazz, Jazz House, Nu-Soul, and more. A modern jazz exploration. Off the beaten track and inspiring. H-Music

open.spotify.com
u/h-musicfr — 7 days ago

Anyone migrated to TypeScript 7.0 RC yet?

Hey, I have a fairly large Next.js project, and TypeScript is one of the slower parts of the development experience (type checking, IDE responsiveness, builds, etc.).

With TypeScript 7.0 RC claiming up to 10× faster performance after the Go rewrite, I'm curious if anyone has tried it on a real app.

Did you notice a meaningful difference? Was the migration smooth, or did you run into any compatibility issues?

reddit.com
u/bhavikagarwal — 10 days ago

Issue with esnext and decorators

I have a project upgrdaded to TypeScript v6.0.3, and ES2025 set as the target, and everything works as expected. Now I am trying to add Temporal usage to the project, and got stuck with that...

In order to access Temporal, the target needs to be esnext. However, target esnext produces native-syntax code for all my use of decorators, which NodeJS doesn't support. I tried to figure out how to make the latest (v26.4.0) NodeJS recognize decorators, but no luck.

How to solve this? Any help is much appreciated!

i.e. how to start using extra features of TypeScript 6.x, such as Temporal, without breaking all code that uses decorators?

reddit.com
u/vitalytom — 8 days ago

Ampulla: Modern TypeScript DI with NestJS ergonomics

Yes, yet another DI library for TypeScript.

A few things kept bothering me about the existing ones, in order of how much they hurt.

- *Type safety requires a special dance.* InversifyJS has ServiceIdentifier<T>, but it is really easy to break the typing. TypeDI tokens are untyped strings. NestJS suffers mostly same, unless you use full classes as dependency tokens. TSyringe infers from constructor metadata, but all of it relies on legacy "reflect-metadata" and decorators mechanism that (a) is soon to be gone, (b) requires additional wiring.

- *Async leaks into callers.* InversifyJS has container.getAsync() for providers that might have been initialized asynchronously. That means every call site needs to know whether what it's asking for was async. The complexity never stays contained. NestJS gets this right: await everything at bootstrap, then get() is always synchronous. Initialized means ready.

- *Wiring is imperative.* InversifyJS has you call manually .bind(Token).to(Implementation) for every provider. It works, but it's ugly. NestJS figured out the right answer: declare what a module owns, what it needs, what it exposes, and let the container figure the rest out. That declarative model is the thing I wanted most, but it comes with an entire framework. NestJS gets hairy when your single app starts accepting just Nats JetStream in addition to HTTP.

- *reflect-metadata.* Every major TS DI library runs on TS "experimentalDecorators" plus a global runtime polyfill for TypeScript metadata. TC39 Stage 3 decorators shipped in TypeScript 5.0, and are soon to be natively supported in JS engines. No flags, no polyfills.

Ampulla is my attempt at fixing all four: injection<T>() tokens that carry their type intrinsically, a declarative @Module/@Injectable model lifted straight from NestJS, async-safe bootstrapping where container.get() is always synchronous, and TC39 decorators throughout.

It's intentionally just a DI container, not a framework. There is no HTTP server, no router, no CLI included. Optional adapters for Hono and H3 are included but tree-shakeable. The whole npm package has zero runtime dependencies.

Very early, 1.0.0 published just today. DI is not the most popular topic, but existing DI in TypeScript is annoying enough that I had to publish something new.

GitHub: https://github.com/ukstv/ampulla | npm: npm install ampulla

u/ukstv — 9 days ago
▲ 9 r/typescript+4 crossposts

Update Loomabase: I added policy-based sync rejections and transactional audit logs to my Rust SQLite ↔ Postgres sync engine

Hi everyone,
A quick update on Loomabase, the Rust offline-first sync engine I posted about earlier.
After feedback about the security model, I added a server- side authorization and validation layer before CRDT merge.
New pieces:
- SyncAuthorizer hook before merge
- SyncValidator hook before merge
- structured SyncPayload.rejections
- rejected cells are not silently dropped
- rejected cells stay dirty on SQLite so the app can surface or resolve them
- PostgreSQL loomabase_audit_log
- audit rows are written in the same transaction as the sync merge
- tests for authorization denial, validation denial, filtered acknowledgement, and audit logging
- README and SECURITY docs updated with CORS/CSP/sync endpoint hardening notes
The important design choice:
Malformed payloads still fail the whole request before mutation. Valid but unauthorized/business-invalid cells become structured rejections.
That means CRDT conflict resolution stays deterministic, but authorization and business rules can still reject a newer offline write before it wins LWW.
I’d like feedback on this boundary:
Should an offline-first sync engine return structured rejected mutations like this, or should rejected writes be handled outside the sync protocol entirely?

github.com
u/Just_Vugg_PolyMCP — 9 days ago

results-ts: Rust's Result and Option types, for TypeScript

I recently started learning Rust and fell in love with their "errors as values" system, so I spent some time developing a TypeScript library that mimics Rust's Result and Option enums. Yes, I'm aware that there are many, many other libraries out there that do this (some of which I took inspiration from), but many are either type-only, abandoned, or just not feature complete. I'm not saying mine is better or anything, that's up to the user. I hope someone will find it useful :)

github.com
u/madkarma_ — 12 days ago

looking for open source project to contribute

I have been coding for few years now. I've picked up few languages, framworks and tools along the way. I have been working with a company for almost 2 years now. I think I am ready to contribute to an opensource project now.

I would love it if you anyone can reach out to me for thier project. I mostly code in typescript, javascript. sometimes in python and go.

reddit.com
u/Kazuma-samaa — 12 days ago