Skip to content

Monorepo ‐ Having Java and python code in the same repo

K. C. Ramakrishna edited this page Aug 18, 2025 · 1 revision

Yes, you have hit on a fundamental—and very important—architectural decision.

The short answer is: Yes, the plan and the tasks are explicitly suggesting that you have both the Java/Quarkus code and the Python/FastAPI code in the same, single GitHub repository.

This approach is called a monorepo (mono-repository), and it is a popular and powerful pattern used by companies like Google, Meta, and Microsoft. Let's discuss this in detail, as it's a crucial concept.

The Monorepo Approach Explained

A monorepo is a single version control repository that holds the source code for multiple distinct projects or services. In your case, it would contain:

  • The quarkus-app/ directory for your main backend.
  • The embedding-service/ directory for your Python microservice.
  • Shared files like docker-compose.yml, README.md, and AGENTS.md at the root.

This is in contrast to a polyrepo (or multi-repo) approach, where you would have a separate GitHub repository for the Quarkus app and another one for the FastAPI service.

For your specific project, I am strongly recommending the monorepo approach. Here’s a detailed breakdown of why.

Advantages of a Monorepo (Why it's perfect for your project)

  1. Simplified Setup & Atomic Operations (The Biggest Win):

    • One Command to Start: Your goal of having a single docker-compose up command to start the entire local environment is made trivial by a monorepo. All the code is in one place. In a polyrepo world, a new developer would have to git clone multiple repositories into a specific directory structure just to get started.
    • Atomic Commits: This is a huge benefit. Imagine you need to change the API contract between Quarkus and FastAPI. In a monorepo, you can make the change in the Python service and the corresponding change in the Quarkus REST client in a single commit and a single Pull Request. This guarantees that your main branch is always consistent. In a polyrepo world, this would require two separate PRs in two different repos, which can lead to complex coordination problems and broken states.
  2. Unified Project Management:

    • One Issue Tracker: All your Epics, Stories, and Tasks for all services live in one place.
    • One Project Board: Your GitHub Project board can provide a complete, holistic view of the entire initiative without needing to pull in issues from multiple repositories. This is exactly what you are currently setting up.
  3. Code & Convention Consistency:

    • Shared Documentation: Your README.md, CONVENTIONS.md, and AGENTS.md apply to the entire project, ensuring all contributors (human or AI) follow the same rules.
    • Shared Configuration: Files like .editorconfig (for universal editor settings) or shared CI/CD workflow templates are easy to manage.
    • Easier Refactoring: If you need to make a change that spans both services, modern IDEs can refactor across the entire codebase at once.

Disadvantages of a Monorepo (And Why They Don't Apply Here Yet)

It's important to understand the trade-offs, even if they don't impact your current scale.

  1. CI/CD Complexity: If you're not careful, a small change in the Python code could trigger the entire, lengthy build-and-test process for the Java application.

    • The Solution (which we planned for): Modern CI/CD systems like GitHub Actions have this solved. You can configure your workflows to run jobs only when files in specific paths are changed (e.g., on: push: paths: ['quarkus-app/**']). This gives you the benefits of a monorepo without the CI bottleneck.
  2. Repository Size & Performance: For truly massive codebases (like Google's, which is terabytes in size), standard Git can become slow.

    • Why it's not a concern for you: Your project is nowhere near this scale. Standard Git will be perfectly fast and responsive.
  3. Access Control: It can be more difficult to give a team access to only one service within the repository.

    • Why it's not a concern for you: You are likely working with a single team that needs access to the entire system.

Conclusion

Yes, the task "Configure linters and formatters" correctly assumes you will have both codebases in the same repository. This is intentional and highly recommended.

The monorepo approach provides a simpler developer experience, guarantees consistency with atomic commits, and unifies your project management. For a project of your scale, its benefits far outweigh the potential complexities, which are themselves solvable with modern tooling.

You are on the right track by structuring your project this way.