A modern, full-featured e-commerce web application built with Angular 20 and TypeScript. This project demonstrates best practices in Angular development including authentication, state management, and server-side rendering.
- User Authentication: Login, Register, and Forget Password functionality with JWT-based authentication
- Product Management: Browse products with filtering, search, and pagination
- Shopping Cart: Add/remove items, manage quantities, and view cart summary
- Wishlist: Save products for later purchase
- Orders: Checkout process and view order history
- Categories & Brands: Organize products by categories and brands
- Multi-language Support: Full internationalization (i18n) support for English and Arabic
- Responsive Design: Mobile-friendly UI with Tailwind CSS and Flowbite components
- Server-Side Rendering: SSR for improved performance and SEO
- Error Handling: Global error interceptor with user-friendly error messages
- Toast Notifications: Real-time notifications for user actions
- Angular 20 - Latest Angular framework with standalone components
- TypeScript - Type-safe programming
- TailwindCSS - Utility-first CSS framework
- Flowbite - Component library built on Tailwind CSS
- Owl Carousel - carousel functionality
- Font Awesome - Icon library
- ngx-pagination - Pagination component
- ngx-toastr - Toast notifications
- ngx-translate - Internationalization
- RxJS - Reactive programming with observables
- Express.js - Server for SSR support
- JWT - JSON Web Tokens for authentication
- ngx-cookie-service - Cookie management
- Angular CLI 20.1.0 - Development and build tool
- Angular SSR - Server-side rendering
- Vercel - Cloud deployment platform
Before you begin, ensure you have the following installed:
- Node.js (v20 or higher)
- npm (v10 or higher)
- A modern web browser
-
Clone the repository
git clone <repository-url> cd E-commerce-project
-
Install dependencies
npm install --legacy-peer-deps
Note: We use
--legacy-peer-depsflag due to some peer dependency conflicts
Start the development server:
npm startor
ng serveNavigate to http://localhost:4200/. The application will automatically reload whenever you modify any of the source files.
ng build --configuration developmentnpm run buildBuild artifacts will be stored in the dist/ directory.
npm run watchnpm testUnit tests are executed with Karma test runner. Tests are located in *.spec.ts files throughout the project.
src/
βββ app/
β βββ core/ # Core authentication & services
β β βββ auth/ # Login, Register, Forget Password
β β βββ guards/ # Route guards (auth-guard, is-logged-guard)
β β βββ interceptors/ # HTTP interceptors (error, headers, loader)
β β βββ layouts/ # Main layout components
β β βββ models/ # Data interfaces (Brand, Category, Product)
β β βββ services/ # Core services
β βββ features/ # Feature components
β β βββ home/ # Home page
β β βββ products/ # Products listing
β β βββ product-details/ # Single product view
β β βββ categories/ # Categories page
β β βββ brands/ # Brands page
β β βββ cart/ # Shopping cart
β β βββ wishlist/ # Wishlist page
β β βββ checkout/ # Checkout process
β β βββ all-orders/ # Order history
β β βββ not-found/ # 404 page
β βββ shared/ # Shared components & utilities
β β βββ components/ # Reusable components
β β βββ directives/ # Custom directives
β β βββ pipes/ # Custom pipes
β β βββ Services/ # Shared services
β βββ i18n/ # Internationalization
β βββ app.routes.ts # Application routes
β βββ app.ts # Root component
βββ assets/
β βββ images/ # Project images
β βββ i18n/ # Translation files (ar.json, en.json)
βββ environments/ # Environment configurations
βββ main.ts # Application entry point
The application implements role-based access control using route guards:
- authGuard: Protects routes that require user authentication
- isLoggedGuard: Prevents logged-in users from accessing auth pages (login, register)
All HTTP requests include JWT tokens via the heading-interceptor.
The application supports multiple languages:
- English -
ar.json - Arabic -
en.json
Language translations are located in src/assets/i18n/. The application uses @ngx-translate/core for dynamic language switching.
- UserService: Authentication and user management
- BrandsService: Fetch brands data
- CategoriesService: Fetch categories data
- ProductsService: Fetch products and product details
- FlowbiteService: Initialize Flowbite components
- CartService: Shopping cart management
- ErrorInterceptor: Handles HTTP errors and displays user-friendly messages
- HeadingInterceptor: Adds JWT token to request headers
- LoaderInterceptor: Shows/hides loader during HTTP requests
The project is configured for deployment on Vercel with the following settings:
- Build Command:
npm run build -- --configuration=production - Output Directory:
dist/E-commerce-project/browser - Install Command:
npm install --legacy-peer-deps
vercelCreate a .env.local file for local development with necessary environment variables:
NG_APP_API_URL=https://ecommerce.routemisr.com/api/v1/
Key dependencies include:
@angular/*- Angular core librariestailwindcss- CSS utility frameworkrxjs- Reactive programming library@ngx-translate/core- Translation libraryngx-toastr- Notification libraryowl-carousel- Carousel libraryexpress- Node.js server for SSR
See package.json for complete list and versions.
| Command | Description |
|---|---|
npm start |
Start development server |
npm run build |
Build for production |
npm test |
Run unit tests |
npm run watch |
Build with watch mode |
ng serve |
Angular CLI dev server |
ng generate component name |
Generate new component |
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Angular CLI includes powerful code scaffolding tools. To generate a new component:
ng generate component component-nameFor a complete list of available schematics (components, directives, pipes, services), run:
ng generate --helpThis project is licensed under the MIT License - see the LICENSE file for details.
For support, email support@example.com or open an issue in the repository.
ng e2eAngular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
For more information on using the Angular CLI, including detailed command references, visit the Angular CLI Overview and Command Reference page.