An Angular (v19) shopping cart / mini shop system with authentication, role-based access (Admin), and a cart flow. UI uses Bootstrap 5.
Project name in code:
lab04-shopping-cart
Angular CLI:19.1.6
-
Authentication
- Default users:
- Admin:
admin / admin - User:
user / user
- Admin:
- Users are stored in localStorage.
- Current session is stored in localStorage (
currentUser).
- Default users:
-
Role-based routing
/adminis protected and only accessible by the admin user./homeis protected and accessible by authenticated users.
-
Shopping cart
- Product listing (example products)
- Add product to cart
- Increase/decrease quantity, remove items
- Purchase checks the current user's balance
- Angular 19
- TypeScript
- RxJS
- Bootstrap 5
npm installnpm start
# or
ng serveThen open:
http://localhost:4200/
From package.json:
npm start # ng serve
npm run build # ng build
npm run watch # ng build --watch --configuration development
npm test # ng testDefined in src/app/app-routing.module.ts:
/login– Login page/signup– Signup page/home– Product list (requires login)/admin– Admin panel (requires admin)/– redirects to/login
This project uses localStorage for persistence:
users: stored user listcurrentUser: current logged-in user
To reset the app state, clear the site storage in your browser (Application/Storage tab).
npm run buildBuild output:
dist/lab04-shopping-cart
This repository is for educational/lab purposes. Add a license if you plan to distribute.