I’m working on a project (card-game) using Docker Compose with separate containers for frontend (card-game-frontend-1) and backend (card-game-backend-1). My code is on the host, mounted into each container: ./frontend:/app for the frontend and ./backend:/app for the backend.
When I connect to the frontend container, I can’t access the backend code (and vice versa) because of the isolated mounts. I want Cursor to edit both frontend and backend code seamlessly, but switching containers feels cumbersome. One idea is to mount both directories into the frontend container (e.g., ./backend:/app/backend), but I’m unsure if that’s the best approach.
How do you handle separated environments in Dev Containers? Do you mount all code into one container, switch between containers, or use another workflow? I’d love to hear how others manage this, especially with AI-powered IDEs.
The final solution is that I suddenly couldn’t access the files on the host by FireSearch MCP and I had to mount the frontend folder in backend container and vice versa.
Old solution which is not working I found a solution to keep my frontend (frontend/) and backend (backend/) code separated in their respective containers (card-game-frontend-1 and card-game-backend-1) while still allowing Cursor to access code across the boundary. I run two instances of Cursor, one connected to each container, and use two Model Context Protocols (MCPs) to bridge the gap: BrowserTools and FileSearch.
** BrowserTools MCP: From the backend container, I use BrowserTools MCP to inspect browser activity in the frontend (e.g., DOM state, API call effects on the UI). This lets the backend container see what’s happening in the browser without directly accessing frontend code.*
** FileSearch MCP: From the frontend container, I use FileSearch MCP to search and view backend code (e.g., API endpoint logic in backend/). This allows the frontend container to reference backend code without modifying it directly.*
While this creates some overhead, the separation is worth it for my project, as it keeps the environments isolated but still lets Cursor work across both sides effectively. Hope this helps others!