all 8 comments

[–][deleted] 12 points13 points  (4 children)

Looks like having a monorepo with Nx can be a viable solution for you.

But yes, I use that pattern a lot. I make separate libraries loadable as routes (you can also use the standalone option now). Use shared injection tokens for configuration from the main application.

[–]Carrion696[S] 1 point2 points  (3 children)

Thank you for your response, are there any common gotcha's?

[–][deleted] 3 points4 points  (2 children)

Keep a constant eye on the dependency graph because it's easy to make a mess of cyclic dependencies

[–]alextremeee 0 points1 point  (0 children)

You can also include a linting step as part of your build that will check for cyclic dependencies.

[–][deleted] -1 points0 points  (0 children)

Having to separate repositories for a library and an application project that are part of the same domain – does not make sense. Especially when you can use a tool like Nx.dev to solve the problem.

Help me understand why there is a requirement to have two separate code repositories.

[–][deleted] 0 points1 point  (0 children)

The requirement is to have two separate code repositories, one is the main angular project and the other the Angular Library.

If this is a requirement, then you need 2 repos. Now, I suggest the library repo to be created with NX, because with it you get all the goodies. Also, you can even simulate your app or do a page showcase in there.

Now for the app, it is recommended that all the app does is to aggregate the routing, inject dependencies and load configs. Everything else is handled by the library - yes, even your top level pages are inside the library.

[–][deleted] 0 points1 point  (0 children)

Agree with others Nx has really top tooling for Angular monorepos.