I'm building a Nuxt 3 application using a feature-based architecture inspired by Domain-Driven Design.
Each feature is meant to be fully isolated, with its own components, state, API layer, and internal logic.

The general problem

Real-world applications often require one feature to react to actions performed in another.
However, if one feature directly imports, calls, or manipulates another feature, this creates tight coupling and breaks the idea of independent bounded contexts, which is a core DDD principle.

I’m trying to find a clean, maintainable way for features to communicate without referencing each other directly.

Project structure

├─ app/
├─ assets/
├─ components/
├─ composables/
├─ pages/
├─ server/
├─ plugins/
├─ features/
│  ├─ search-panel/
│  │  ├─ components/
│  │  ├─ composables/
│  │  ├─ store/
│  │  ├─ api/
│  │  └─ utils/
│  └─ map/
│     ├─ components/
│     ├─ composables/
│     ├─ store/
│     ├─ api/
│     └─ utils/

Example to illustrate the issue

In this setup:

  • search-panel allows users to filter and search for places.

  • map displays markers on a map.

Both are isolated features with their own components, composable, store API etc.

Now the challenge:

👉 When a user selects a place in search-panel, it needs to be highlighted in map.
But if search-panel calls map directly (or imports its store), this creates a cross-feature dependency — something I’m trying to avoid.


Question

What is the recommended way for independent features in a Nuxt (or modern front-end) application to communicate without creating coupling or breaking DDD boundaries?

Examples from real production projects or open-source repositories would be extremely helpful.

Thanks!

1 Reply 1

Did you think to use Nuxt Layers https://nuxt.com/docs/4.x/getting-started/layers%5C, they mentioned in their use cases:

Enhance code organization by implementing a modular architecture and support Domain-Driven Design (DDD) pattern in large scale projects.

to not break the context boundaries try to use an exposed public composables that can be consumed by other contexts or you can use an event bus.

Your Reply

By clicking “Post Your Reply”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.