You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A task management application with role-based access control, organizational hierarchy, and a Kanban board interface. Built as an NX monorepo with NestJS and Angular.
Quick Start (3 Commands)
npm install
npx nx run api:seed # Seeds demo data (5 users, 3 orgs, 8 tasks)
npx nx run-many -t serve # Starts API (:3000) + Web (:4200)
Kanban Board with drag-and-drop (To Do → In Progress → Done)
Role-aware UI - buttons/actions hidden based on permissions
Dark/Light mode with system preference detection
Responsive design - sidebar collapses to bottom nav on mobile
Toast notifications for all CRUD feedback
Inline filters for category and priority
User Management page (Owner-only) with role assignment
Organization Management page (Owner-only) with hierarchy
Task completion visualization — progress bar showing done vs remaining tasks
Keyboard shortcuts — N to create new task, Escape to close modals
Demo credential buttons on login page for quick evaluation
Environment Variables
Variable
Default
Description
JWT_SECRET
stms-dev-secret-key-2024
JWT signing secret
JWT_EXPIRES_IN
1h
Token expiration
DATABASE_PATH
./data/stms.sqlite
SQLite database file path
PORT
3000
API server port
Running Tests
npx nx test api # Backend unit tests (AuthService, RBAC, all services)
npx nx test web # Frontend unit tests (services, components)
npx nx test auth # Auth library tests (permission matrix, RbacGuard)
npx nx test data # Data library tests (permission matrix)
Design Decisions
SQLite - Zero-config database for instant evaluation. No Docker, no PostgreSQL setup.
Data-driven RBAC - Permission matrix in libs/data is a lookup table, making it trivial to add roles/permissions.
Org-scoping at query level - OrgScopeService ensures data isolation without middleware magic.
Shared libs - @stms/data and @stms/auth are used by both frontend and backend, ensuring type safety across the stack.
Co-located entities - Each backend module contains its own TypeORM entity alongside its service and controller.
Idempotent seed - Run npx nx run api:seed repeatedly without duplicating data.
Standalone Angular components - Modern Angular patterns with signals, lazy loading, and functional guards.
Diff-tracked audit logging - Only actual changes are logged, not entire DTOs.
Future Considerations
Advanced Role Delegation
Custom roles — Allow organizations to define their own roles beyond Owner/Admin/Viewer, with fine-grained permission sets.
Role delegation chains — Let Owners delegate specific permissions to Admins without promoting them to full Owner status.
Per-resource permissions — Assign permissions scoped to individual tasks or categories rather than entire organizations.
Production-Ready Security
JWT refresh tokens — Implement a refresh token rotation flow with short-lived access tokens (5 min) and long-lived refresh tokens (7 days) stored in HTTP-only cookies. Detect token reuse to identify stolen refresh tokens.
Content Security Policy — Add CSP headers to mitigate XSS and injection attacks in production deployments.
Rate limiting — Add per-IP and per-user rate limiting on auth endpoints to prevent brute-force attacks.
Password policies — Enforce minimum complexity, track password history, and support account lockout after failed attempts.
RBAC Caching
In-memory permission cache — Cache the permission matrix lookups per user session to avoid repeated computation on every request. Invalidate on role or organization changes.
Redis-backed cache — For multi-instance deployments, use Redis to share permission cache across API servers with TTL-based expiration.
Scaling Permission Checks
Bitwise permissions — Replace the array-based permission matrix with a bitfield representation for O(1) permission checks instead of O(n) includes() lookups.
Database-backed permissions — Move the permission matrix to a permissions table for runtime configurability without code deployments.
Organization tree caching — Pre-compute and cache the organization hierarchy to avoid recursive queries when resolving parent/child visibility scopes.
Pagination for scoped queries — Add cursor-based pagination to all list endpoints to handle organizations with thousands of tasks efficiently.
About
Secure Task Management System - NX monorepo with NestJS + Angular