Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Monorepo because of typescript #2046

Open
Noriller opened this issue Jan 2, 2025 · 0 comments
Open

feat: Monorepo because of typescript #2046

Noriller opened this issue Jan 2, 2025 · 0 comments
Labels
🌟 enhancement New feature or request

Comments

@Noriller
Copy link

Noriller commented Jan 2, 2025

Is your feature request related to a problem? Please describe.

In a project with drizzle, trpc and zod, as the number of routes grows it makes each type inference take seconds (even with only some dozens of routes).

Maybe not the reality of most to have that many routes, but also considering the TS tooling growing and generating more complex and nested types, this makes for a DX that continually drops to a crawl as the project grows.

Describe the solution you'd like to see

One of the solutions for that: trpc/trpc#2448 (comment)

is to split things into a monorepo, so each can be built at save and speedup TS inference, since it would depend on prebuilt types.

So, the "server" folder could be a "package" in a monorepo and be built at a different time so the frontend can use the routes at maximum speed.

As far as I have problems, the TRPC router aggregates everything and causes the problems.
If there are problems with the DB part I haven't felt, but it could also be an option to split it further to separate db, trpc routes, utils... each in its own "package" that can be handled and cached independently.

Describe alternate solutions

The most reliable solution other than just suffering from slow inference is to split into a monorepo.

Additional information

I have searched for alternatives, but found the most reliable to be the monorepo one.

I did check #327

A monorepo approach might introduce some extra complexity beforehand, but it makes DX more constant over project time, including that it makes it easier to add more independent packages or even split the project as needed.

With that said, more tooling relying on complex typescript shenanigans might make this a bigger necessity to keep up the speed with a clean project.

@Noriller Noriller added the 🌟 enhancement New feature or request label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌟 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant