Back to results for “Performance”
Angular › Angular Style Guide & Best Practices

What are some best practices for structuring a large Angular application with many features?

Advanced

Answer

Common recommendations include organizing code by feature rather than by file type, keeping shared, reusable code in a dedicated shared module or folder, lazy loading feature areas so users only download the code they actually need, and keeping components focused on presentation while services handle business logic and data access.
src/app/
  features/
    orders/
      orders.component.ts
      orders.service.ts
    users/
      users.component.ts
      users.service.ts
  shared/
    button/
    pipes/
Real-world example A large enterprise application organizes its code by feature, keeping everything related to orders together and everything related to users together, making it much easier for different teams to work on separate features without constantly stepping on each other's code.

Common follow-ups: How does organizing code by feature compare to organizing it strictly by file type, like all components in one folder and all services in another?;At what point should a shared piece of code be moved into a dedicated shared folder?