Full-stack Angular + NestJS (Nx) with role-based access (admin/user). Admins can view and edit users via dialog; login flow uses JWT.
- Node 18+ and npm
- Postgres running locally (default:
localhost:5432) - Nx via
npx(already in dev deps)
Copy .env (already checked in) or set:
PORT=3000
NODE_ENV=development
DB_HOST=localhost
DB_PORT=5432
DB_NAME=postgres
DB_USER=postgres
DB_PASS=postgres
JWT_SECRET=dev-secret
REFRESH_TOKEN_SECRET=dev-refresh-secret
npm install
npm run migration:run # runs TypeORM migrations (includes seed data)
# Build backend image
docker build -t fs-angular-nest-api -f Dockerfile .
# Start Postgres only
docker compose up -d postgres
# Start API (depends on Postgres); builds if needed
docker compose up --build api
# Run migrations/seed inside the API container
docker compose exec api npm run db:migration:run
# Stop containers
docker compose down
npx nx serve api # backend on http://localhost:3000
npx nx serve frontend # frontend on http://localhost:4200
- Admin: admin@email.com / Admin123!
- Frontend consumes backend at port 3000 by default.
- If ports differ, update
.envand Angular environment config accordingly.
- Testing foundation (backend & frontend): add
api/jest.config.ts, NXtesttarget for backend; unit tests forUsersService(create hashes password, duplicate email conflict, update not-found) andAuthService(invalid password returns null, invalid refresh returns 401); add Angular unit tests for auth reducer/effects and a key component (LoginPageor users list) to cover UI state/interaction basics. - E2E coverage: add Playwright flows for login, unauthorized redirect to login, admin user list renders, admin edits a user successfully (seeded data), and basic error display on failed login; use
data-testidselectors already in templates. - Frontend error handling: add a global HTTP error interceptor that maps 400/401/403/404/409/5xx/network to user-friendly messages; provide
MessageServiceandToastModuleapp-wide with<p-toast>in root template; surface errors from users load/create/update selectors as toasts. - Backend error codes: tighten global
ValidationPipe(whitelist + transform + forbidNonWhitelisted) and add an HTTP exception filter to normalize{ statusCode, message }responses; keep existing 401/403/409 semantics. - Table filtering/sorting: wire PrimeNG table filters/sort to API query params (email/name/role filtering, sort by createdAt/name/email if exposed) so UI leverages backend capabilities.
- Shared types library: create an Nx lib for shared DTOs/types/constants used by both frontend and backend (e.g., auth payloads, user roles), and consume it in API DTOs and Angular models to keep contracts in sync.