🧬 Scalable Angular Architecture with Atomic Design and BEM
Diego Liascovich

Diego Liascovich @padie78

About: Full Stack Developer with solid experience designing and building scalable web applications and distributed systems.Passionate about clean code, application security,and building high-quality software

Joined:
Jun 19, 2024

🧬 Scalable Angular Architecture with Atomic Design and BEM

Publish Date: Jul 7
0 0

By Diego Liascovich

Full-Stack Developer | Microservices | Angular | Node.js

When building large-scale Angular applications, having a clean, scalable, and maintainable architecture is key. This post explores how combining Atomic Design and BEM (Block Element Modifier) can help you build robust front-end systems with clear structure and styling consistency.

πŸš€ Why Architecture Matters in Angular

As your Angular project grows, so do:

  • The number of components.
  • The complexity of UI states.
  • The maintenance overhead.

A proper component and style structure can:

  • Avoid duplication.
  • Improve collaboration across teams.
  • Enhance testing and reusability.

πŸ§ͺ What Is Atomic Design?

Atomic Design, coined by Brad Frost, is a methodology for creating design systems. It structures UI components into 5 levels:

  1. Atoms – Basic elements (buttons, inputs, labels).
  2. Molecules – Groups of atoms working together (input + label).
  3. Organisms – Complex components (header, card, sidebar).
  4. Templates – Page structures with dummy content.
  5. Pages – Final views with real content and data.

This hierarchy promotes reusability, consistency, and scalability.


🎨 What Is BEM (Block Element Modifier)?

BEM is a CSS naming convention:

  • Block – The standalone entity (e.g., card)
  • Element – A part of the block (e.g., card__title)
  • Modifier – A variation of a block or element (e.g., card--primary)

Example:

<div class="card card--primary">
  <h3 class="card__title">Title</h3>
  <p class="card__content">Content</p>
</div>
Enter fullscreen mode Exit fullscreen mode

It brings:

  • Predictable, non-conflicting class names
  • Easier style scoping and maintenance
  • Compatibility with component-based systems like Angular

πŸ—οΈ Project Structure in Angular with Atomic Design

Here’s a sample structure:

src/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ core/                 # Services, guards, global logic
β”‚   β”œβ”€β”€ shared/               # Reusable atomic components
β”‚   β”‚   β”œβ”€β”€ atoms/
β”‚   β”‚   β”œβ”€β”€ molecules/
β”‚   β”‚   β”œβ”€β”€ organisms/
β”‚   β”‚   β”œβ”€β”€ templates/
β”‚   β”‚   └── pages/
β”‚   β”œβ”€β”€ features/             # Feature-specific modules
β”‚   └── app.component.ts
β”œβ”€β”€ assets/
β”‚   └── styles/
β”‚       β”œβ”€β”€ _variables.scss
β”‚       β”œβ”€β”€ _mixins.scss
β”‚       β”œβ”€β”€ _typography.scss
β”‚       └── base.scss
└── index.html
Enter fullscreen mode Exit fullscreen mode

Each component has its own folder:

molecules/
└── input-field/
    β”œβ”€β”€ input-field.component.ts
    β”œβ”€β”€ input-field.component.html
    β”œβ”€β”€ input-field.component.scss  <-- Follows BEM
    └── input-field.component.spec.ts
Enter fullscreen mode Exit fullscreen mode

βœ… Benefits of Atomic Design + BEM in Angular

Benefit Description
πŸ” Reusability Atoms and molecules can be reused across many views.
🎯 Consistency Design and naming are standardized.
🧼 Separation of Concerns UI hierarchy is clear; styles are scoped.
πŸ§ͺ Easier Testing Smaller units = better unit tests.
πŸ“¦ Scalability Feature and UI growth is more manageable.
πŸ‘₯ Team Collaboration Devs and designers can speak the same "component language".

⚠️ Potential Drawbacks

Issue Mitigation
🧩 Overhead for small apps Use only parts of Atomic Design as needed.
πŸ“‚ More folders & files Use index.ts files for cleaner imports.
πŸ“š Learning curve for new devs Add documentation and folder readme files.

πŸ› οΈ Tips for Working with Atomic + BEM

  • Stick to clear folder naming (atoms, organisms, etc.).
  • Use SCSS mixins and variables to unify styles.
  • Keep a component catalog to avoid duplicate creation.
  • Use Angular Standalone Components and Signals where it makes sense (Angular 15+).
  • Combine with Storybook for UI documentation.

πŸ“¦ Conclusion

Combining Atomic Design with BEM in Angular gives you a powerful architectural base for large-scale applications. It promotes modularity, consistency, and long-term maintainability.


πŸ’¬ What do you think?

Have you tried combining Atomic Design and BEM in your Angular projects? Share your thoughts, improvements, or questions in the comments!

Comments 0 total

    Add comment