How to configure PyCharm for a monorepo with separate Django and Next.js project roots?
11:47 03 Jan 2026

I have a PyCharm project structured as a monorepo. The root directory contains general project files. Inside this root, there are two subdirectories: one for a frontend built with Next.js, and one for a backend built with Django.

project-root/
├── .git/
├── .gitignore
├── docker-compose.yml
├── README.md
├── frontend/
│   ├── ...
│
└── backend/
    ├── ...

This setup is causing indexing issues in PyCharm. The IDE reports unresolved imports, incorrect module paths, and other inconsistent behaviour. These problems appear to stem from the fact that the frontend and backend each have their own logical project roots. These differ from the repository root that is opened in PyCharm, which leads to confusion in how PyCharm indexes files and resolves imports.

One approach I tried was redefining the project roots in PyCharm to point to the frontend and backend subdirectories. While this improves indexing for each subproject, it causes the files in the repository root to be excluded from the project. I haven’t found a way to keep the root-level files included while also treating the subdirectories as project roots.

python pycharm