I want Best Practices When Structuring Aurelia Projects

Hey everyone,

I have been working with Aurelia & I really like the framework’s simplicity & flexibility. I sometimes find myself second guessing how I should structure my projects, as they grow larger. For smaller apps It feels pretty straightforward but once the app starts scaling, things such as organizing components, handling services & managing state become a bit tricky.

I wanted to ask the community here what are some best practices you personally follow when setting up Aurelia projects? Do you prefer a feature-based folder structure or something more layer-based? How do you keep things maintainable without overcomplicating the project?

Also, if anyone has tips on balancing Aurelia’s conventions with their own patterns, I want to hear about it. Coming from a background where I had some ReactJS Training; I see there are different ways of thinking about project design & I want to get better at aligning with Aurelia’s strengths.

Thank you.:slight_smile:

3 Likes

I usually go with a feature-first structure rather than a pure layer-based one. For me, it scales better because everything related to a feature (views, components, services, styles, tests) lives together. That way, when I need to change or extend something, I’m only touching one part of the tree, not bouncing around between /components, /services, /models, etc.

Rough structure of how I approach it usually:

src/
  features/
    dashboard/
      dashboard-page.ts
      dashboard-page.html
      dashboard-service.ts
      widgets/
        sales-chart.ts
        sales-chart.html
    profile/
      profile-page.ts
      profile-page.html
      profile-service.ts
  shared/
    components/
    services/
    utils/

State management also follows this pattern. Most of the time Aurelia’s DI and reactivity are enough, so I keep feature state local. When something has to be global (auth, settings, etc.) I keep a small store service in shared/services.

This way Aurelia’s conventions (like co-located .ts and .html) still shine, but the mental model stays simple as the app grows: “feature first, shared only when necessary.”

2 Likes

@dwaynecharrington Where do you put services, for example, that are feature-scoped (not shared)?