How abhijeetr7/angular-ngrx-nx-realworld-example-app works
1. This is an Nx monorepo for an Angular “Conduit” client, organized as one shell app plus many feature libraries. The architecture is intentionally split by domain and by responsibility, so most logic lives in reusable libs instead of the app.
2. The runtime entrypoint is apps/conduit. It contains the root Angular application shell (app.component, app.config, main.ts) plus global layout pieces like the navbar and footer. That shell mainly composes routed features and shared layout.
3. Feature work is grouped by domain:
- libs/auth/* for login/register/auth state
- libs/articles/* for article list, article detail, editor, comments, and markdown rendering
- libs/profile/* for profile pages and profile-related article lists
- libs/home/* for the home feed and tags
- libs/settings/* for user settings
These libraries are what you would draw as the main user-facing subsystems.
4. The architecture follows a “smart feature / dumb UI” split. feature-* libraries contain routed screens and orchestration logic, while libs/ui/components contains reusable presentational pieces such as the pager. The app-level navbar/footer also act as shared presentation components.
5. Server interaction is isolated in data-access libraries. Each domain has its own stores and services, for example auth.store.ts, article.store.ts, articles-list.store.ts, and profile.store.ts. These are the boundary between UI and API calls, and they encapsulate loading state, optimistic updates, and error handling.
6. State management is built around NgRx Signal Store rather than classic reducers/effects. Stores own the reactive state for a domain and use methods built with RxJS operators to fetch/update data. This means most screen components are thin consumers of store signals and actions.
7. Shared infrastructure lives under libs/core. Important sub-bounds are:
- core/api-types for shared API contracts (article, auth, comment, profile, user)
- core/http-client for API URL/token wiring and base API service
- core/error-handler for global HTTP/error interception and error state
- core/forms for validation/error-display helpers
- core/data-access for shared state helpers like call-state tracking
These libraries are the common foundation used by multiple domains.
8. Routing is feature-local and lazy-loaded. Feature libraries expose route definitions such as article.routes.ts, profile.routes.ts, and article-edit.routes.ts, and the app shell loads them on demand. Resolvers and guards live next to the features they protect, which keeps data preloading and auth checks near the route boundary.
9. The external dependency boundary is the RealWorld backend API. Authentication uses JWT-backed requests, and the app supports the expected CRUD flows for articles, comments, favorites, profiles, and settings. The frontend does not own persistence; all authoritative data comes from that API.
10. The home/article/profile flows are built from the data-access layer upward: stores fetch lists or detail records, feature components render them, and smaller child components handle list items, article metadata, comments, and tags. Pagination is a shared concern surfaced through the pager UI component and list-related stores.
11. Testing is split between unit tests in each app/lib and Playwright end-to-end tests in apps/conduit-e2e. The E2E suite covers auth, article lists, and article creation flows, with helper utilities for user registration/login. This gives a clear separation between isolated component/store behavior and full user journeys.
Main entry points: conduit Conduit app · articles/data-access Articles store · auth/data-access Auth store · conduit-e2e E2E tests
Components 19
Apps
Runtime shells and end-to-end test app
- Conduit app · Root app composition, routing host, and global layout.
apps/conduit - E2E tests · End-to-end coverage for auth and article journeys.
apps/conduit-e2e
Auth
Authentication feature and data access
- Auth screens · Login and registration routed screens.
libs/auth/feature-auth - Auth store · Auth state, service, and route guard.
libs/auth/data-access
Articles
Article, list, and editor flows
- Article list · Article feeds and list item presentation.
libs/articles/feature-articles-list - Article page · Article detail, comments, metadata, and markdown rendering.
libs/articles/feature-article - Editor · Create and edit article route flow.
libs/articles/feature-article-edit - Articles store · Article and list state, services, and actions.
libs/articles/data-access
Profile
Profile pages and profile-scoped article views
- Profile page · Profile screen and profile-bound article views.
libs/profile/feature-profile - Profile store · Profile state, services, and route resolvers.
libs/profile/data-access
Home
Home feed and tags
- Home feed · Home feed screen, tabs, and tag sidebar.
libs/home/feature-home - Home store · Home feed orchestration and list fetching.
libs/home/feature-home
Settings
User settings screen
- Settings page · User settings form and save flow.
libs/settings/feature-settings
Core
Shared infrastructure and API contracts
- API types · Shared article, auth, comment, profile, and user contracts.
libs/core/api-types - HTTP client · API URL and token wiring plus base API service.
libs/core/http-client - Error handler · Global HTTP interception and error state.
libs/core/error-handler - Forms helpers · Validation, display, and error mapping helpers.
libs/core/forms - Call state · Shared loading and call-state utilities.
libs/core/data-access
Connections 38
- Conduit app → Auth screens: routes to · Shell lazy-loads auth screens.
- Conduit app → Home feed: routes to · Shell lazy-loads the home feed.
- Conduit app → Article list: routes to · Shell lazy-loads article list views.
- Conduit app → Article page: routes to · Shell lazy-loads article detail pages.
- Conduit app → Editor: routes to · Shell lazy-loads editor flow.
- Conduit app → Profile page: routes to · Shell lazy-loads profile pages.
- Conduit app → Settings page: routes to · Shell lazy-loads settings page.
- Conduit app → Auth store: uses · Shell wiring depends on auth guard/state.
- Conduit app → Error handler: uses · App config installs global error handling.
- Conduit app → Pager: shares · Shell composes shared presentation pieces.
- Auth screens → Auth store: reads/writes · Login and register interact with auth state.
- Auth screens → Forms helpers: uses · Forms and validation helpers support auth screens.
- Auth store → HTTP client: calls · Auth service uses shared HTTP client.
- Auth store → API types: models · Auth state is typed with shared contracts.
- Article list → Articles store: reads · List views consume article list store.
- Article list → Pager: uses · Pagination is rendered through shared pager.
- Article page → Articles store: reads/writes · Detail page loads article and comments, then updates favorites/comments.
- Article page → Forms helpers: uses · Comment input and validation rely on shared form helpers.
- Article page → API types: models · Article, comment, and profile contracts shape the page.
- Editor → Articles store: writes · Editor uses article store and resolver-backed loading.
- Editor → Forms helpers: uses · Editor form validation uses shared helpers.
- Articles store → HTTP client: calls · Article services talk to the API through shared transport.
- Articles store → Call state: tracks · Stores use shared call-state utilities.
- Articles store → API types: models · Article state is built from shared contracts.
- Profile page → Profile store: reads · Profile page consumes profile store and resolvers.
- Profile page → Articles store: lists · Profile pages reuse article list data.
- Profile store → HTTP client: calls · Profile service uses shared HTTP client.
- Profile store → API types: models · Profile state uses shared contracts.
- Home feed → Home store: reads · Home UI is driven by home store state.
- Home feed → Articles store: lists · Feed data is fetched through article list state.
- Home feed → Pager: uses · Home feed pagination uses the shared pager.
- Home store → Articles store: coordinates · Home store builds on article list fetching behavior.
- Settings page → Auth store: uses · Settings screen relies on authenticated user state.
- Error handler → HTTP client: integrates · Error handling sits at the HTTP boundary.
- E2E tests → Conduit app: exercises · End-to-end flows run against the app shell.
- E2E tests → Auth screens: covers · Auth journeys are validated end to end.
- E2E tests → Article list: covers · Article list browsing is validated end to end.
- E2E tests → Editor: covers · Article creation flow is validated end to end.