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:
- Atoms β Basic elements (buttons, inputs, labels).
- Molecules β Groups of atoms working together (input + label).
- Organisms β Complex components (header, card, sidebar).
- Templates β Page structures with dummy content.
- 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>
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
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
β 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!