0

I would like to create a monorepo example as a demo for my boss with several frontend and backend projects. Currently we have mostly Spring APIs and Angular on the front-end. We are using Swagger-Codegen to generate client apis for connecting our Angular apps with our APIs. Everything is deployed to a kubernetes cluster. I plan to use the same technologies in this demo.

Right now we are using Sonatype Nexus as an NPM & Maven repository. It is a great tool and I would consider using it in a monorepo style project but I also like the idea of committing the generated libs direct to the monorepo. In my mind, the advantage to committing these to source control is that we can be sure the front-ends always transpile with the latest client libs and there is no mucking about with permissions and extra jenkins jobs pushing to a repository manager.

The current structure I have in mind

backend/
    shared-lib/
    api-core/
    api-two/
    parent-pom.xml
frontend/
    api-core-codegen/
    api-two-codegen/
    shared-angular-components/
    angular-frontend-1/
    angular-frontend-2/
    lerna.json
    package.json

My questions are:

  • How should I include the generated client libraries in the project? (commit in git or store externally in something like Nexus)
  • How can I build only the parts that have changed in a tool like Jenkins? (tools like Bazel sound very cool but I don't really want to learn a whole new toolset if it's possible to do with just Maven, NPM, Jenkins...)
  • How would you structure things differently (sorry if too general to answer)?
  • In general committing into a repo artifacts generated from code from the same repo is not a good idea: you need very good automation to either ensure the repo remains consistent at all times (reliably generating the artifacts and commiting them together with the respective code changes) or to determine when it's not consistent and fix it in separate commits ( also complicating the logic for your CI/CD pipeline triggers). – Dan Cornilescu Jul 29 '18 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.