A modern, production-ready e-commerce frontend application built with Angular 20, featuring standalone components, signals-based state management, and enterprise-grade architecture.
Features • Quick Start • Architecture • Documentation • Backend API
- Overview
- Features
- Architecture
- Tech Stack
- Quick Start
- Project Structure
- Configuration
- Development Guidelines
- Testing
- Backend Integration
- Performance & Optimization
- Accessibility
- Contributing
- Troubleshooting
- License
The E-Commerce Frontend is a Single Page Application (SPA) that provides a modern, responsive user interface for the E-Commerce platform. Built with Angular 20's latest features including standalone components, signals, and control flow syntax, it delivers a seamless shopping experience across all devices.
✅ Modern Angular 20 - Latest features with standalone components and signals
✅ Clean Architecture - Domain-driven design with clear separation of concerns
✅ Type-Safe - Full TypeScript coverage with strict type checking
✅ Reactive Patterns - RxJS for complex data flows and async operations
✅ Performance Optimized - Lazy loading, bundle budgets, and OnPush change detection
✅ Responsive Design - Mobile-first approach with Bootstrap 5
✅ Code Quality - ESLint, Prettier, and automated formatting
✅ Production Ready - Optimized builds with subresource integrity
-
Product Management
- Browse products with advanced filtering and search
- View detailed product information with image galleries
- SKU-based product variations
- Featured products and sales sections
- Category-based navigation
-
Shopping Cart
- Add/remove items with quantity management
- Local storage persistence
- Real-time price calculations
- Cart synchronization with backend (planned)
-
User Authentication
- Sign up with email validation
- Login with JWT token management
- Password recovery (planned)
- User profile management
-
Checkout Process
- Multi-step checkout flow
- Address management
- Payment integration (planned)
- Order confirmation and tracking
-
User Account
- Order history
- Profile settings
- Wishlist (planned)
- Address book
- Standalone Components - No NgModules, better tree-shaking
- Signals API - Modern reactive state management
- Control Flow Syntax - Native
@if,@for,@switchinstead of structural directives - Reactive Forms - Type-safe form validation
- Lazy Loading - Route-based code splitting
- OnPush Change Detection - Optimal performance
- SCSS Architecture - Component-scoped styles with global utilities
- Bootstrap Integration - Responsive grid and components via ng-bootstrap
The application follows Clean Architecture principles with clear separation between presentation, application, domain, and infrastructure layers:
src/
├── app/
│ ├── application/ # Application Layer
│ │ └── app.routes.ts # Route configuration
│ │
│ ├── domain/ # Domain Layer
│ │ ├── models/ # Domain entities & value objects
│ │ ├── services/ # Domain services & business logic
│ │ └── interfaces/ # Domain contracts
│ │
│ ├── infrastructure/ # Infrastructure Layer
│ │ ├── app.config.ts # App configuration & DI providers
│ │ ├── services/ # HTTP services & external integrations
│ │ ├── interceptors/ # HTTP interceptors (auth, errors)
│ │ └── guards/ # Route guards
│ │
│ └── presentation/ # Presentation Layer
│ ├── app.ts # Root component
│ ├── components/ # Shared components
│ │ ├── layout/ # Layout wrapper
│ │ ├── header/ # Header navigation
│ │ ├── footer/ # Footer
│ │ └── sidebar/ # Sidebar navigation
│ │
│ └── pages/ # Feature pages (routed components)
│ ├── home/ # Homepage
│ ├── product-list/ # Product catalog
│ ├── product-detail/ # Product details
│ ├── cart/ # Shopping cart
│ ├── checkout/ # Checkout flow
│ ├── login/ # Login page
│ ├── register/ # Registration
│ ├── account/ # User account
│ ├── orders/ # Order history
│ └── not-found/ # 404 page
│
├── index.html # HTML entry point
├── main.ts # Bootstrap application
└── styles.scss # Global styles
- Presentation → Application → Domain ← Infrastructure
- Dependencies flow inward toward the domain
- Infrastructure implements interfaces defined in domain/application
- Smart/Dumb Components - Container and presentation components
- Signals - Reactive state management
- RxJS - Async data streams and operators
- Service Layer - Business logic separation
- Dependency Injection - Using Angular's
inject()function - Route Guards - Authentication and authorization
- Angular 20.3.9 - Modern web framework with signals and standalone components
- TypeScript 5.9.2 - Type-safe JavaScript with latest features
- Bootstrap 5.3.8 - Responsive CSS framework
- ng-bootstrap 19.0.1 - Angular-powered Bootstrap widgets
- SASS 1.65.1 - CSS preprocessor with SCSS syntax
- @popperjs/core 2.11.8 - Tooltip and popover positioning
- RxJS 7.8 - Reactive programming library
- Angular Signals - Built-in reactive primitives
- Angular Forms - Reactive forms with validation
- Angular CLI 20.3.9 - Project scaffolding and build tools
- ESLint 9.39.1 - Code linting with Angular ESLint rules
- Prettier 3.6.2 - Code formatting
- Jasmine 5.9.0 - Testing framework
- Karma 6.4.0 - Test runner
- pnpm - Fast, disk space efficient package manager
Ensure you have the following installed:
- Node.js 18.x or 20.x (LTS) - Download
- pnpm - Fast package manager (recommended)
npm install -g pnpm - Angular CLI (optional, for scaffolding)
npm install -g @angular/cli
git clone https://github.com/mgnischor/ecommerce-frontend.git
cd ecommerce-frontendpnpm installNote: You can also use
npm installoryarn installif you prefer.
pnpm startAccess the application:
- URL:
http://localhost:4200 - Hot Reload: Enabled by default
Features:
- Live reload on file changes
- Source maps for debugging
- Detailed error messages
- Angular DevTools support
pnpm run build:productionOutput:
- Location:
dist/ecommerce-frontend/browser/ - Optimizations: Minification, tree-shaking, dead code elimination
- Subresource Integrity: Enabled for security
- Output Hashing: Cache-busting enabled
pnpm run build:developmentFeatures:
- Source maps enabled
- No optimization for faster builds
- Useful for debugging production builds locally
# Using any static server
npx serve dist/ecommerce-frontend/browserecommerce-frontend/
├── src/
│ ├── app/
│ │ ├── application/
│ │ │ └── app.routes.ts # Route definitions
│ │ │
│ │ ├── domain/ # Domain layer (planned)
│ │ │ ├── models/ # Entity models
│ │ │ ├── services/ # Domain services
│ │ │ └── interfaces/ # Contracts
│ │ │
│ │ ├── infrastructure/
│ │ │ └── app.config.ts # App configuration
│ │ │
│ │ └── presentation/
│ │ ├── app.ts # Root component
│ │ ├── app.html # Root template
│ │ ├── app.scss # Root styles
│ │ ├── components/ # Shared components
│ │ └── pages/ # Feature pages
│ │
│ ├── index.html # HTML entry point
│ ├── main.ts # Bootstrap
│ └── styles.scss # Global styles
│
├── public/ # Static assets
├── angular.json # Angular CLI configuration
├── tsconfig.json # TypeScript configuration
├── tsconfig.app.json # App TypeScript config
├── package.json # Dependencies and scripts
└── README.md # This file
src/app/presentation/components/- Reusable UI components (header, footer, layout, sidebar)src/app/presentation/pages/- Routed feature pages (home, products, cart, checkout, etc.)src/app/infrastructure/- Configuration, services, interceptors, guardssrc/app/domain/- Business logic and domain models (planned)public/- Static assets (images, fonts, favicons)
Configuration is stored in src/app/infrastructure/app.config.ts:
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
import { routes } from './application/app.routes';
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(routes),
// Add more providers here
],
};Create an environment configuration file (planned):
// src/app/infrastructure/config/environment.ts
export const environment = {
production: false,
apiBaseUrl: 'https://localhost:5049/api/v1',
};Key settings in angular.json:
- Build Budgets - Warns when bundles exceed 500KB, errors at 1MB
- Style Budgets - Component styles limited to 4KB warning, 8KB error
- Source Maps - Enabled in development, disabled in production
- Optimization - Minification, tree-shaking, dead code elimination (production only)
Strict mode enabled in tsconfig.json:
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true
}
}- Use Standalone Components - No NgModules
- Prefer Signals - Use
signal(),computed(),effect()for reactive state - Control Flow Syntax - Use
@if,@for,@switchinstead of*ngIf,*ngFor,*ngSwitch - OnPush Change Detection - Set
changeDetection: ChangeDetectionStrategy.OnPush - Function-based APIs - Use
input(),output(),inject()instead of decorators - Lazy Loading - Load feature routes on demand
- NgOptimizedImage - Use for static images (not inline base64)
- Strict Type Checking - Enabled by default
- Type Inference - Let TypeScript infer when obvious
- Avoid
any- Useunknownwhen type is uncertain - Interfaces - Define contracts for data structures
- Avoid Nested Subscriptions - Use operators like
switchMap,mergeMap,concatMap - Async Pipe - Prefer
| asyncin templates to auto-unsubscribe - Pipeable Operators - Chain operators for readability
- Error Handling - Use
catchErrorfor graceful degradation
- Component Styles - Keep styles scoped to components
- Global Utilities - Use
src/styles.scssfor global styles - Bootstrap Classes - Use utility classes for spacing and layout
- BEM Naming - Use consistent class naming conventions
- SCSS Variables - Define colors, spacing, breakpoints in variables
pnpm run formatpnpm run format:checkpnpm run lintpnpm run lint:fixRun all unit tests with Karma:
pnpm run test:developmentFeatures:
- Jasmine - Testing framework
- Karma - Test runner
- Code Coverage - Reports generated in
coverage/
pnpm run test:productionpnpm run watchRebuilds on file changes for rapid development.
⚠️ Note: E2E tests are not yet configured. Recommended tools: Playwright or Cypress.
This frontend consumes the E-Commerce Backend API:
- Repository: ecommerce-backend
- Tech Stack: ASP.NET Core 9, PostgreSQL, JWT Authentication
- API Docs:
https://localhost:5049/docs(when running locally)
-
Start the backend server:
cd ecommerce-backend dotnet run -
Update frontend configuration:
// src/app/infrastructure/config/environment.ts export const environment = { apiBaseUrl: 'https://localhost:5049/api/v1', };
-
Ensure CORS is enabled in backend
Program.cs:builder.Services.AddCors(options => { options.AddDefaultPolicy(policy => { policy.WithOrigins("http://localhost:4200") .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); }); });
# In backend repository
docker-compose up -dUpdate frontend:
export const environment = {
apiBaseUrl: 'http://localhost:5049/api/v1',
};- Login -
POST /api/v1/loginreturns JWT token - Store Token - Save in localStorage or sessionStorage
- HTTP Interceptor - Attach token to all requests in
Authorization: Bearer <token>header - Token Refresh - Implement refresh logic (planned)
- Logout - Clear token and redirect
POST /api/v1/login- User loginPOST /api/v1/users- User registration
GET /api/v1/products- List products (paginated)GET /api/v1/products/{id}- Get product by IDGET /api/v1/products/sku/{sku}- Get product by SKUGET /api/v1/products/featured- Get featured productsGET /api/v1/products/on-sale- Get products on saleGET /api/v1/products/search?searchTerm={term}- Search products
GET /api/v1/orders- Get user ordersPOST /api/v1/orders- Create orderGET /api/v1/orders/{id}- Get order details
- Tree Shaking - Remove unused code
- Minification - Reduce bundle size
- Code Splitting - Lazy load routes
- Subresource Integrity - Verify resource integrity
- Output Hashing - Cache-busting file names
- OnPush Change Detection - Reduce change detection cycles
- TrackBy Functions - Optimize
@forloops - Lazy Loading - Load features on demand
- Virtual Scrolling - Handle large lists efficiently (planned)
- Image Optimization - Use NgOptimizedImage for lazy loading
Current budgets (configured in angular.json):
- Initial Bundle: Warning at 500KB, error at 1MB
- Component Styles: Warning at 4KB, error at 8KB
Check bundle size after build:
pnpm run build:productionAnalyze bundle composition:
npx webpack-bundle-analyzer dist/ecommerce-frontend/browser/stats.json- Semantic HTML - Use proper HTML5 elements (
<nav>,<main>,<article>, etc.) - ARIA Attributes - Add
aria-label,aria-describedbywhere needed - Keyboard Navigation - Ensure all interactive elements are keyboard accessible
- Focus Management - Visible focus indicators, logical tab order
- Color Contrast - WCAG AA compliance (4.5:1 for normal text)
- Screen Reader Support - Test with NVDA, JAWS, or VoiceOver
- Form Labels - Every input has an associated label
- Alt Text - All images have descriptive alt attributes
- axe DevTools - Browser extension for accessibility auditing
- Lighthouse - Chrome DevTools accessibility audit
- WAVE - Web accessibility evaluation tool
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Follow Angular and TypeScript best practices
- Write or update tests
- Run linting and formatting
- Commit with clear messages
git commit -m "feat: add amazing feature"
- Push to your fork
git push origin feature/amazing-feature
- Open a Pull Request
- ✅ Follow Angular style guide
- ✅ Use standalone components
- ✅ Write meaningful commit messages (Conventional Commits)
- ✅ Add unit tests for new features
- ✅ Run
pnpm run lintandpnpm run formatbefore committing - ✅ Keep PRs small and focused
- ✅ Update documentation for API changes
Use Conventional Commits:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting, whitespace)refactor:- Code refactoringtest:- Add or update testschore:- Maintenance tasks
Error: ERR_CONNECTION_REFUSED or CORS error
Solution:
- Verify backend is running:
https://localhost:5049/api/v1 - Check CORS configuration in backend
Program.cs - Update
apiBaseUrlin frontend configuration - Disable browser extensions (ad blockers, privacy tools)
Error: Port 4200 is already in use
Solution:
# Kill process on port 4200
netstat -ano | findstr :4200
taskkill /PID <PID> /F
# Or use a different port
ng serve --port 4300Error: TypeScript compilation errors
Solution:
# Clear cache and reinstall
Remove-Item -Recurse -Force node_modules, .angular
pnpm installError: ESLint or Prettier errors
Solution:
# Auto-fix linting issues
pnpm run lint:fix
# Format all files
pnpm run formatError: Karma tests failing
Solution:
# Clear Karma cache
Remove-Item -Recurse -Force .angular/cache
# Run tests with coverage
pnpm run test:developmentThis project is licensed under the GNU General Public License v3.0 (GPL-3.0-only).
See the LICENSE.md file for full license text.
- ✅ You can use, modify, and distribute this software
- ✅ You must disclose source code when distributing
- ✅ You must use the same GPL-3.0 license for derivative works
- ✅ You must state changes made to the code
- ❌ No warranty or liability is provided
Miguel Nischor
- GitHub: @mgnischor
- Frontend Repository: ecommerce-frontend
- Backend Repository: ecommerce-backend
- Angular Team - For the incredible framework
- RxJS Team - For reactive programming patterns
- TypeScript Team - For type safety and developer experience
- Bootstrap Team - For responsive UI primitives
- ng-bootstrap Team - For Angular-native Bootstrap components
⭐ If you find this project useful, please consider giving it a star! ⭐
Made with ❤️ using Angular 20