Live data from Hacker News

Everything as code: How we manage our company in one monorepo

kasava.dev

201–210 of 232 posts

Re: Everything as code: How we manage our company in one monorepo

#201
post #103
post #99

Earlier quoted context omitted.

Pff the mental list of what I can’t use when I write is getting pretty big. Em dashes are done for, as are deep dives, delving, anything too enthusiastic, and Oxford commas… A text either has value to you or it doesn’t. I don’t really understand what the level of AI involvement has to do with it. A human can produce slop, an AI can produce an insightful piece. I rely mostly on HN to tell them apart value-wise.

Did this not read as AI generated to you?

No, can’t say I noticed it. But I’m not a native English speaker. For me the AI transforms my poor Dunglish (Dutch-English) into perfect English. I do tell it to not sound like an American waiter though.

Re: Everything as code: How we manage our company in one monorepo

#202

Earlier quoted context omitted.

What do you use for feature flags?

Not OP, but I think building feature flags yourself really isn’t hard and worth doing. It’s such an important component that I wouldn’t want to depend on a third party

I generally agree, but see some more nuance. I think feature-flagging is an overloaded term that can mean two things.

First, my philosophy is that long-lived feature branches are bad, and lead to pain and risk once complete and need to be merged.

Instead, prefer to work in small, incremental PRs that are quickly merged to main but dormant in production. This ensures the team is aware of the developing feature and cannot break your in-progress code (e.g. with a large refactor).

This usage of "feature flags" is simple enough that it's fine and maybe even preferable to build yourself. It could be as simple as env vars or a config file.

--

However, feature flagging may also refer to deploying two variants of completed code for A/B testing or just an incremental rollout. This requires the ability to expose different code paths to selected users and measure the impact.

This sort of tooling is more difficult to build. It's not impossible, but comparatively complex because it probably needs to be adjustable easily without releases (i.e. requires a persistence layer) and by non-engineers (i.e. requires an admin UI). This becomes a product, and unless it's core to your business, it's probably better to pick something off the shelf.

Something I learned later in my career is that measuring the impact is actually a separate responsibility. Product metrics should be reported on anyway, and this is merely adding the ability to tag requests or other units of work with the variants applied, and slice your reporting on it. It's probably better not to build this either, unless you have a niche requirement not served by the market.

--

These are clearly two use cases, but share the overloaded term "feature flag":

1. Maintaining unfinished code in `main` without exposing it to users, which is far superior than long-lived feature branches but requires the ability to toggle.

2. Choosing which completed features to show to users to guide your product development.

(2) is likely better served by something off the shelf. And although they're orthogonal use cases, sometimes the same tool can support both. But if you only need (1), I wouldn't invest in a complex tool that's designed to support (2)—which I think is where I agree with you :)

Re: Everything as code: How we manage our company in one monorepo

#203
post #139

Earlier quoted context omitted.

That makes sense when you depend on a shared library. However, if service A depends on endpoint x in service B, then you still have to work out synchronized deployments (or have developers handle this by making multiple separate deployments). To be fair, this problem is not solved at all by monorepos. Basically, only careful use of gRPC (and similar technology) can help solve this… and it doesn’t really solve for app…

> However, if service A depends on endpoint x in service B, then you still have to work out synchronized deployments (or have developers handle this by making multiple separate deployments). In a polyrepo environment, either: - B updates their endpoint in a backward compatible fashion, making sure older stuff still works OR - B releases a new version of their API at /api/2.0 but keeps /api/1.0 active and working unti…

Right, so all of that is independent of mono vs poly repo.

Re: Everything as code: How we manage our company in one monorepo

#204
post #82

How do you guys share types between your frontend and backend? I've looked into tRPC, but don't like having to use their RPC system.

I have a library translate the backend types into Typescript. What language do you use on the back?

Typescript, using Zod with Express for parameter validation.

Re: Everything as code: How we manage our company in one monorepo

#205
post #59
post #30

Earlier quoted context omitted.

Very interesting points. Would you mind sharing a few examples of when cherry-picking is necessary and why atomic changes are a lie? I'm using a monorepo for my company across 3+ products and so far we're deploying from stable release to stable release without any issues.

Atomic changes are a lie in the sense that there is no atomic deployment of a repo. The moment you have two production services that talk to each other, you end up with one of them being deployed before the other.

If you have a monolith you get atomic deployment, too.

Re: Everything as code: How we manage our company in one monorepo

#206
post #130

Earlier quoted context omitted.

But isn't that a self-inflicted wound then? I mean is there some reason your devs decided not to fix the DB cluster? Or did management tell you "Eh, we have other things we want to prioritize this month/quarter/year?" This seems like simply not following the rules with having a monorepo, because the DB Cluster is not running the version in the repo.

Maybe the database upgrade from v(N-17) to v(N-16) simply takes a while, and hasn't completed yet? Or the responsible team is looking at it, but it doesn't warrant the whole company to stop shipping? Being 17 versions behind is an extreme example, but always having everything run the latest version in the repo is impossible, if only because deployments across nodes aren't perfectly synchronised.

This is why you have active/passive setup and you don't run half-deployed code in production. Using API contracts is a weak solution, because eventually you will write a bug. It's simpler to just say "everything is running the same version" and make that happen.

Re: Everything as code: How we manage our company in one monorepo

#207
post #93

Earlier quoted context omitted.

The point is atomic code changes, not atomic deployments. If I want to rename some common library function, it's just a single search and replace operation in a monorepo. How do you do this with multiple repos?

> If I want to rename some common library function, it's just a single search and replace operation in a monorepo. How do you do this with multiple repos? Multiple repos shouldn't depend on a single shared library that needs to be updated in lockstep. If they do, something has gone horribly wrong.

They do, it's just instead of it being a library call it's a network call usually, which is even worse. Makes it nigh impossible to refactor your codebase in any meaningful way.

Re: Everything as code: How we manage our company in one monorepo

#208
What’s the value proposition? I mean the fact that you have

- frontend - backend - website

is already confusing to me.

I understand that one commit seems nice, but you could have achieve this with e.g. 3 repos and very easily maintain all of them. There’s a bit of overhead of course, but having some experience working with a team that has a few „monorepos” I know that the cost to actually make it work is significant.

Re: Everything as code: How we manage our company in one monorepo

#209
post #93

Earlier quoted context omitted.

> If I want to rename some common library function, it's just a single search and replace operation in a monorepo. How do you do this with multiple repos? Multiple repos shouldn't depend on a single shared library that needs to be updated in lockstep. If they do, something has gone horribly wrong.

They do, it's just instead of it being a library call it's a network call usually, which is even worse. Makes it nigh impossible to refactor your codebase in any meaningful way.

But if you need to rename endpoint for example you need to route service A version Y to compatible version in service B. After changing the endpoint, now you need to route service A version Z to a new version of service B. Am I missing something? Meaning that it doesn’t truly mater whether you have 1 repo, 2 repos or 10 repos. Deployments MUST be done in sequence and there MUST be a backwards compatible commit in between OR you must have some mesh that’s going to take care of rerouting requests for you.

Re: Everything as code: How we manage our company in one monorepo

#210
post #82

Earlier quoted context omitted.

I have a library translate the backend types into Typescript. What language do you use on the back?

Typescript, using Zod with Express for parameter validation.

Why do you even have to ask, then? TS on both sides is the easiest case.
Post reply on HN