Live Web Application: https://ums-user-management-and-access-control-system.app/
User Management System (UMS) is a production-ready, full-stack web application designed for robust identity management, multi-tier role-based access control (RBAC), and an administrator review pipeline. Built with Next.js 16 (App Router), TypeScript, Tailwind CSS, and Supabase (Auth + PostgreSQL RLS).
UMS-USER_MANAGEMENT_SYSTEM.1.mp4
- π Test Accounts
- π― Reference & Scope
- β¨ Core Features
- π¨ Visual & Interaction Fidelity
- ποΈ Architecture & Security
- π§° Tech Stack
- π€ AI Workflow & Verification Suite
- π Project Structure
- π Local Development
- π¦ Production Build & Quality Gates
- π Database Schema & RLS Setup
- π Admin Provisioning
- π¨π» Author
Use these credentials for the deployed evaluation environment:
- Email:
admin@gmail.com - Password:
admin@123 - Role:
Admin(Full Administrative Access) - Portal:
/admin/login
- Email:
Joel@gmail.com - Password:
Joel@123 - Role:
User(Approved Status β Full User Dashboard Access) - Portal:
/login
- Email:
hazim@gmail.com - Password:
Hazim@123 - Role:
User(Pending / Rejected β Blocked from Protected Dashboard) - Portal:
/login
- Email:
hmpibnurnh3@gmail.com - Password:
hashmil@123 - Role:
User - Portal:
/login
This project implements the complete technical specification for the User Management System Internship Technical Assessment. The system is architected into two strictly segregated portals:
- User Panel: Self-service registration, real-time pending approval gate, interactive profile dashboard, notifications center, account activity timeline, and complete support ticketing system.
- Admin Panel: Secure authentication portal, live system metrics, full user lifecycle management (Approve, Reject, Deactivate, Reactivate, Delete), and an administrative support helpdesk with threaded messaging.
- Registration & Authentication: Secure sign-up with password confirmation, inline validation, and automatic pending account creation.
- Account Approval Gate: Users cannot access the dashboard until approved by an administrator. Unapproved accounts are cleanly redirected to a dedicated status screen.
- Dynamic Account Status Screen (
/account-status): Real-time feedback forPending,Approved,Rejected, andSuspendedstates with contextual guidance and actions. - User Dashboard (
/user/dashboard): High-level account overview displaying account status, active support requests, unread notifications, and quick actions. - Profile Management (
/user/profile): View and update editable details (full name, phone, bio) with cryptographic protection preventing client-side role or status tampering. - Notifications Hub (
/user/notifications): Instant notifications for account approval, status changes, and administrative ticket replies. - Account Activity Audit (
/user/activity): Immutable log of sign-ins, profile edits, and ticket submissions.
- Dedicated Admin Login (
/admin/login): Multi-layer authentication validating both Supabase Auth credentials and databaserole === 'admin'. Non-admins are immediately rejected and signed out. - Dashboard Metrics (
/admin/dashboard): Live database statistics tracking Total Users, Pending Approvals, Active Accounts, and Open Support Tickets. - User Directory & Search (
/admin/users): Search users by name or email, with dynamic status filtering (All,Pending,Approved,Rejected,Suspended). - Approval Workflow: One-click approval or rejection of pending registrations with automated notification dispatch.
- Account Suspension & Reactivation: Deactivate malicious or inactive accounts while preserving historical records.
- Safety Guards:
- Self-deactivation and self-rejection prevention.
- Self-deletion prevention.
- Last-admin protection preventing accidental lockout.
- Support Queue (
/admin/support): Comprehensive ticket queue with status filters and direct access to customer conversations.
- Ticket Creation (
/user/support/new): Submit support requests with subject, category, priority (Low,Medium,High,Urgent), and detailed description. - Support History (
/user/support): Complete log of user tickets with unique UUID tracking, category badges, and submission timestamps. - Threaded Conversation (
/user/support/[id]&/admin/support/[id]):- Real-time conversation thread between user and support team.
- Support for public replies and administrative internal notes.
- Status progression:
OpenβIn ProgressβResolvedβClosed. - Automated ticket status update when an administrator replies.
The application adheres to modern, premium enterprise design principles:
- Curated Palette: Slate, Deep Navy (
#0F172A), Vivid Royal Blue (#2563EB), Emerald Green (#10B981), and Crimson Red (#EF4444). - Typography: Modern typography using Google Font Outfit and Inter for clean readability.
- Glassmorphism & Micro-Interactions: Subtle backdrop blurs (
backdrop-blur-md), smooth hover states, and card depth transitions. - Empty States & Skeletons: Animated pulse loading skeletons and contextual empty states across all table views and ticket lists.
- Responsive Layouts: Desktop sidebar navigation transitioning into a touch-friendly mobile drawer on viewports below 768px.
graph TD
Client["Client Browser (React 19)"] --> NextProxy["Next.js Proxy / Middleware"]
NextProxy --> ServerLayout["Server Route Guards (SSR)"]
ServerLayout --> ServerActions["Next.js Server Actions (Node.js)"]
ServerActions --> Guard["requireAdminUser() / requireApprovedUser()"]
Guard --> SupabaseAuth["Supabase Auth (JWT / Cookies)"]
Guard --> SupabaseDB["Supabase PostgreSQL"]
SupabaseDB --> RLS["Row Level Security (RLS Policies)"]
SupabaseDB --> DBTrigger["Trigger: handle_new_user()"]
- Defense-in-Depth Authorization: Role checks are never delegated solely to the client. Every privileged server action explicitly executes
requireAdminUser(). - Escalation-Proof Triggers: The
handle_new_user()PostgreSQL trigger hardcodesrole = 'user'andaccount_status = 'pending', discarding any client-forged metadata. - Strict Row Level Security (RLS):
- Users can only read their own tickets, messages, notifications, and activity logs.
- Profile
UPDATEpolicy enforcesWITH CHECKto prevent updatingroleoraccount_status.
- Secret Key Isolation:
SUPABASE_SERVICE_ROLE_KEYis strictly confined to server-side Node.js utilities and never bundled in client assets. - Environment Protection:
.env.localis strictly excluded from version control via.gitignore.
- Framework: Next.js 16 (App Router with Turbopack)
- Library: React 19
- Language: TypeScript 5 (Strict Mode)
- Styling: Tailwind CSS + Vanilla CSS Design Tokens
- Icons: Lucide React
- Runtime: Node.js 22 (LTS)
- Database: Supabase PostgreSQL
- Authentication: Supabase Auth (SSR Cookie Sessions)
- Security: PostgreSQL Row Level Security (RLS) & Server Actions
This application was engineered with a disciplined multi-phase development and automated verification lifecycle:
- Automated Type Checking:
npx tsc --noEmitverifies zero TypeScript compiler errors. - Code Standards:
npm run lintenforces ESLint rules across all routes and components. - Production Build:
npm run buildcompiles all 17 static and dynamic App Router endpoints. - End-to-End Chrome Testing: Verified in Google Chrome with responsive checks (mobile 375px & desktop 1280px).
USER MANAGEMENT SYSTEM/
βββ app/
β βββ (public)/
β β βββ page.tsx # Landing Page
β β βββ login/page.tsx # User Sign In
β β βββ register/page.tsx # User Registration
β β βββ account-status/page.tsx # Dynamic Account Status Banner
β βββ admin/
β β βββ login/page.tsx # Admin Portal Login
β β βββ actions.ts # Privileged Admin Server Actions
β β βββ (protected)/ # Guarded Admin Routes (requireAdminUser)
β β βββ layout.tsx # Admin Shell & Navigation
β β βββ dashboard/page.tsx # Live Admin Statistics
β β βββ users/page.tsx # User Management & Status Actions
β β βββ support/ # Support Queue & Conversation Threads
β βββ user/ # Guarded User Routes (requireApprovedUser)
β βββ layout.tsx # User Portal Shell & Sidebar
β βββ dashboard/page.tsx # User Dashboard
β βββ profile/page.tsx # Profile Details & Edit
β βββ notifications/page.tsx # Notifications Hub
β βββ activity/page.tsx # Activity Log Timeline
β βββ support/ # Support History & Ticket Creation
βββ components/
β βββ layout/ # Navbar, Sidebar, DashboardLayout
β βββ ui/ # Button, Card, Input, Modal, Badge, etc.
βββ lib/
β βββ supabase/ # SSR Client, Browser Client, Server Auth Guards
β βββ utils.ts # Class merging and formatting utilities
βββ public/
β βββ logo.png # Transparent UMS Brand Emblem
βββ supabase/
β βββ schema.sql # Complete PostgreSQL Schema & RLS Policies
βββ types/
β βββ database.ts # Supabase TypeScript Schema Definitions
βββ run-user-management.bat # One-Click Windows Launch Script
βββ package.json
βββ README.md
- Node.js: v18.0.0 or higher (v20+ recommended)
- npm: v9.0.0 or higher
- Supabase Account: Free project at supabase.com
Open the project directory in your terminal:
cd "D:\CodingSpace\Projects\USER MANAGEMENT SYSTEM"npm installCreate a .env.local file in the root directory:
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-publishable-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-secret-key
NEXT_PUBLIC_APP_URL=http://localhost:3000Double-click run-user-management.bat in the project root, or execute:
run-user-management.batnpm run devOpen http://localhost:3000 in your browser.
Run the automated verification suite before submitting or deploying:
# 1. Type Check
npx tsc --noEmit
# 2. Lint Check
npm run lint
# 3. Production Build
npm run buildInitialize your Supabase project by executing the contents of supabase/schema.sql in the Supabase SQL Editor:
- Open your project on Supabase Dashboard.
- Navigate to the SQL Editor tab.
- Paste the contents of
supabase/schema.sqland click Run. - The script creates:
- Tables:
profiles,support_tickets,support_messages,notifications,activity_logs. - Enums:
user_role,account_status,ticket_status,ticket_priority,notification_type. - Triggers: Automatic user profile generation on sign-up (
handle_new_user). - RLS Policies: Complete read/write security rules for users and administrators.
- Tables:
The application does not use any hardcoded admin passwords. To safely promote any registered account to administrator:
- Register an account through
/register(e.g.,admin@gmail.com). - Open the Supabase SQL Editor and run:
UPDATE public.profiles SET role = 'admin', account_status = 'approved', updated_at = NOW() WHERE email = 'admin@gmail.com';
- Verify the role update:
SELECT id, email, full_name, role, account_status FROM public.profiles WHERE email = 'admin@gmail.com';
- Navigate to
http://localhost:3000/admin/loginand sign in with your credentials.
The application is deployed on Vercel.
Live Web Application: https://ums-user-management-and-access-control-system.vercel.app/
Hashmil Muhammed
Full-Stack Engineer & AI/ML Developer
