Overview
The Product Distribution Dashboard frontend is built with Angular 18, using standalone components and modern Angular patterns. This guide covers the setup process for local development.Prerequisites
Node.js and npm
- Node.js: Version 18.x or higher
- npm: Version 9.x or higher (comes with Node.js)
Angular CLI
Install the Angular CLI globally:Installation
Navigate to the frontend directory and install dependencies:Project Structure
The frontend follows Angular’s standard structure with path aliases for clean imports:Path Aliases
The project uses TypeScript path aliases for cleaner imports:Dependencies
Core Dependencies
- @angular/core: ^18.0.0 - Angular framework
- @angular/common: ^18.0.0 - Common Angular utilities
- @angular/forms: ^18.0.0 - Form handling
- @angular/router: ^18.0.0 - Routing (not currently used)
- rxjs: ~7.8.0 - Reactive programming library
UI Component Libraries
- @angular/cdk: ^18.2.14 - Component Dev Kit (virtual scrolling)
- @ng-select/ng-select: ^13.9.1 - Dropdown select components
Visualization Libraries
- leaflet: ^1.9.4 - Interactive maps
- leaflet.markercluster: ^1.5.3 - Map marker clustering
- leaflet-polylinedecorator: ^1.6.0 - Route decorations
- chart.js: ^4.5.1 - Charting library
- ng2-charts: ^7.0.0 - Angular wrapper for Chart.js
Development Dependencies
- @angular/cli: ^18.0.4 - Angular command-line tools
- typescript: ~5.4.2 - TypeScript compiler
- eslint: ^9.39.1 - Code linting
- prettier: ^3.7.3 - Code formatting
- jasmine-core: ~5.1.0 - Testing framework
- karma: ~6.4.0 - Test runner
npm Scripts
Development
Building
Code Quality
Testing
Development Server
Starting the Server
Start the development server:http://localhost:4200. The development server includes:
- Hot Module Replacement: Changes reload automatically
- Source Maps: Debug TypeScript code in the browser
- Error Overlay: Clear error messages in the browser
Configuration
The development server is configured inangular.json:
API Connection
The frontend connects to the backend API using environment configuration:TypeScript Configuration
The project uses strict TypeScript settings for type safety:- strict: true - Enable all strict type checking options
- noImplicitReturns: true - Require explicit return types
- noFallthroughCasesInSwitch: true - Prevent switch fallthrough
- strictTemplates: true - Strict template type checking
Browser Support
The application targets modern browsers with ES2022 support:- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
Next Steps
- Learn about Component Architecture
- Explore Service Layer
- Review API Integration