How would you structure a large Angular application?
Model answer
Group code by feature, not by type: each feature folder has its own components, services, routes and models, and is lazy loaded. Keep a small core area for app-wide services (auth, interceptors, config) and a shared area for reusable, dumb UI components, pipes and directives that have no feature knowledge.
Rules that scale: smart (container) components fetch data and dumb (presentational) components take inputs and emit outputs; features do not import from each other directly; and public APIs of a feature are exposed through an index file. For very large systems, tools such as Nx help enforce boundaries and speed builds.
Learn this topic
Angular Tutorial: Beginner to Advanced .
Sign in to add your own answer.
More questions
- How do you write a unit test for a component or a service in Angular?
- What is the difference between unit, integration and end-to-end tests?
- How do you test a component that calls an API?
- How do you test route guards, pipes and directives?
- What does ng lint and a formatter give you, and what other tooling do Angular teams use?
- How do you handle environment-specific settings in Angular?