A comprehensive, modern web application for data loss prevention and enterprise security management.
Features β’ Installation β’ Documentation β’ Contributing
The DLP Dashboard is an enterprise-grade security platform that provides comprehensive tools for:
- π Secure Authentication - Multi-factor authentication with TOTP, Passkeys, and OAuth
- π₯ User Management - Complete lifecycle management with role-based access control
- π± Device Monitoring - Real-time device tracking and policy enforcement
- π Analytics & Reporting - Comprehensive dashboards with actionable insights.
- π Data Protection - Advanced DLP policies to prevent unauthorized data exfiltration
Multi-Factor Authentication (MFA)
-
TOTP (Time-based One-Time Password)
- Secure 2FA setup with QR code generation
- Compatible with Google Authenticator, Authy, and other authenticator apps
- Manual entry key fallback for accessibility
- Session-based setup flow with temporary tokens
- Automatic token expiration and validation
-
Passkey Support (WebAuthn/FIDO2)
- Passwordless authentication using biometrics or security keys
- Device-bound credentials for enhanced security
- Multiple passkey registration per user
- Last usage tracking and management
- Cross-platform compatibility (Windows Hello, Face ID, Touch ID)
-
JWT-based Sessions
- Secure token management with automatic expiration
- Token refresh mechanism
- Client-side token validation
- Secure localStorage with fallback mechanisms
-
Role-Based Access Control (RBAC)
- Granular permission system
- Admin and User role separation
- Protected routes with automatic redirection
- Context-based authentication state management
Google OAuth Integration
- Single Sign-On (SSO) capability
- Seamless user onboarding
- Profile information synchronization
Dashboard & Analytics
-
User Metrics
- Total active users
- New user registrations
- User activity trends
-
Device Statistics
- Total registered devices
- Active device count
- Device compliance status
-
Group Management
- User group overview
- Group membership statistics
- Group policy distribution
- Parallel data fetching for optimal performance
- Loading states with visual indicators (Commet loader)
- Error handling with user-friendly messages
- Responsive grid layout for statistics cards
User Management
-
Create Users
- Individual user creation with detailed form
- Username, email, and role assignment
- Password generation or custom password
- Initial access setup
-
Edit Users
- Update user information
- Modify roles and permissions
- Enable/disable user accounts
- Password reset functionality
-
Delete Users
- Safe user deletion with confirmation
- Cascading deletion handling
- Audit trail maintenance
- CSV Import/Export
- Mass user creation via CSV upload
- Template download for correct formatting
- Validation and error reporting
- Progress tracking for large imports
- Export user data for reporting
-
User Search & Filter
- Real-time search across user attributes
- Filter by role, status, and group
- Sortable columns (name, email, created date)
-
User Modal
- Quick view user details
- Inline editing capabilities
- Action buttons (edit, delete, reset password)
-
Checkbox Selection
- Multi-select for bulk operations
- Select all/deselect all functionality
- Bulk action menu
User Group Management
-
Create Groups
- Custom group naming
- Description and metadata
- Initial member assignment
-
Group Membership
- Add/remove users from groups
- View group members list
- Member count tracking
- Nested group support
- Dynamic routing to group details
- Member management interface
- Group-based policy application
Device Management
- Device registration and tracking
- Device overview page with sidebar
- Device logs and activity monitoring
- Device profile management
- Device settings and configuration
- Compliance reporting
Applications Dashboard
- Visual Application Grid
- Logo display with fallback initials
- Clean card-based layout
- Responsive grid (2-4 columns based on screen size)
-
Real-time Search
- Instant search as you type
- Case-insensitive matching
- Search icon indicator
-
Favorites System
- Star/unstar applications
- Favorites tab for quick access
- Favorite count in tab badge
- AWS Cloud
- Google Chrome
- Mozilla Firefox
- Notion
- Motrix
- Visual Studio Code
- Figma
- Slack
Passkey Management
-
Register Passkey
- One-click registration
- Browser-native biometric prompt
- Automatic device detection
-
View Registered Passkeys
- Credential ID display (truncated for security)
- Device type information
- Registration date
- Last used timestamp
- Sortable table view
-
Delete Passkeys
- Individual passkey removal
- Confirmation dialog
- Immediate UI update
- Toast notifications for success/error
Profile & Settings
- Personal profile management
- Update contact information
- Security preferences
- Password change
- Session management
- Activity history
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Next.js 15.1.1 β
β (App Router + Server Components) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β React 19.0.0 β
β (Client Components + Hooks + Context) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β TypeScript 5.0+ β
β (Type Safety + Interfaces) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Tailwind CSS 3.4 + Radix UI β
β (Responsive Design + Accessible Components) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Package | Version | Purpose |
|---|---|---|
next |
15.1.1 | React framework with SSR/SSG |
react |
19.0.0 | UI library |
typescript |
5.0+ | Type safety |
tailwindcss |
3.4.1 | Utility-first CSS |
@simplewebauthn/browser |
13.2.0 | WebAuthn/Passkey support |
otplib |
12.0.1 | TOTP generation/validation |
jwt-decode |
4.0.0 | JWT token decoding |
react-hot-toast |
2.5.2 | Toast notifications |
lucide-react |
0.469.0 | Icon library |
@radix-ui/* |
Latest | Accessible UI primitives |
dlp-frontend/
βββ src/
β βββ app/ # Next.js App Router
β β βββ admin/ # Admin-only pages
β β β βββ dashboard/ # Analytics dashboard
β β β βββ users/ # User management
β β β βββ user-groups/ # Group management
β β β βββ device/ # Device management
β β βββ auth/ # Authentication pages
β β β βββ user/login/ # User login
β β β βββ admin/login/ # Admin login
β β β βββ totp-setup/ # 2FA setup
β β β βββ verify-totp/ # 2FA verification
β β βββ user/ # User dashboard
β β β βββ applications/ # App catalog
β β β βββ passkey/ # Passkey management
β β β βββ profile/ # User profile
β β β βββ settings/ # User settings
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Home page
β β βββ globals.css # Global styles
β β
β βββ components/ # Reusable components
β β βββ admin/ # Admin components
β β β βββ UserList.tsx # User table
β β β βββ CreateUserForm.tsx
β β β βββ EditUserForm.tsx
β β β βββ CSVImportForm.tsx
β β β βββ UserGroupList.tsx
β β β βββ UserModal.tsx
β β βββ user/ # User components
β β β βββ passkey.tsx # Passkey utilities
β β βββ ui/ # UI primitives
β β β βββ button.tsx
β β β βββ input.tsx
β β β βββ sidebar.tsx
β β β βββ ...
β β βββ NavbarAdmin.tsx
β β βββ NavbarUser.tsx
β β βββ SideNavBarAdmin.tsx
β β βββ PrivateRoute.tsx # Route protection
β β
β βββ context/ # React Context
β β βββ AuthContext.tsx # Auth state management
β β
β βββ hooks/ # Custom hooks
β β βββ use-mobile.tsx # Mobile detection
β β βββ use-hydration.tsx # SSR hydration
β β
β βββ lib/ # Utilities
β β βββ apiFetch.ts # API client
β β βββ utils.ts # Helper functions
β β βββ date-utils.ts # Date formatting
β β
β βββ types/ # TypeScript types
β β βββ admin.types.ts
β β βββ user.types.ts
β β
β βββ middleware.ts # Next.js middleware
β
βββ public/ # Static assets
βββ package.json # Dependencies
βββ tsconfig.json # TypeScript config
βββ tailwind.config.ts # Tailwind config
βββ next.config.ts # Next.js config
βββ README.md # Documentation
sequenceDiagram
participant C as Component
participant A as apiFetch
participant L as localStorage
participant B as Backend API
C->>A: Request data/action
A->>L: Get authToken
L-->>A: Return token
A->>A: Add Authorization header
A->>B: HTTP Request
B->>B: Validate & Process
B-->>A: JSON Response
A->>A: Parse & validate
A-->>C: Return data/error
C->>C: Update UI state
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/auth/user/login |
User authentication |
POST |
/api/auth/admin/login |
Admin authentication |
POST |
/api/auth/google/login |
Google OAuth login |
POST |
/api/user/totp/setup |
Initialize TOTP setup |
POST |
/api/user/totp/verify-setup |
Verify TOTP setup |
POST |
/api/auth/user/login/totp |
Login with TOTP |
POST |
/api/passkey/register/generate-options |
Generate passkey registration options |
POST |
/api/passkey/register/verify |
Verify passkey registration |
POST |
/api/passkey/authenticate/generate-options |
Generate passkey auth options |
POST |
/api/passkey/authenticate/verify |
Verify passkey authentication |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/user |
List all users |
POST |
/api/user |
Create new user |
GET |
/api/user/{id} |
Get user details |
PUT |
/api/user/{id} |
Update user |
DELETE |
/api/user/{id} |
Delete user |
POST |
/api/user/{id}/reset-password |
Reset user password |
GET |
/api/user-group |
List all user groups |
POST |
/api/user-group |
Create user group |
GET |
/api/user-group/{id} |
Get group details |
POST |
/api/user-group/{id}/members |
Add group members |
DELETE |
/api/user-group/{id}/members/{userId} |
Remove group member |
GET |
/api/device |
List all devices |
GET |
/api/device/{id}/logs |
Get device logs |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/user/profile |
Get current user profile |
PUT |
/api/user/profile |
Update user profile |
GET |
/api/user/applications |
List available applications |
GET |
/api/user/passkeys |
Get user's passkeys |
DELETE |
/api/user/passkeys/{id} |
Delete passkey |
The centralized API client (src/lib/apiFetch.ts) provides:
Features:
- β Automatic JWT token injection from localStorage
- β Configurable base URL via environment variables
- β Consistent error handling
- β Type-safe response handling
- β Support for all HTTP methods
- β Header management
Usage Example:
import { apiFetch } from '@/lib/apiFetch';
// GET request
const users = await apiFetch('/user');
// POST request
const newUser = await apiFetch('/user', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(userData)
});
// PUT request
await apiFetch(`/user/${userId}`, {
method: 'PUT',
body: JSON.stringify(updates)
});
// DELETE request
await apiFetch(`/user/${userId}`, {
method: 'DELETE'
});- Node.js 18.0.0 or higher
- pnpm (recommended) or npm
- Backend API server running (separate repository)
Create a .env.local file in the project root:
# Backend API Configuration (Required)
NEXT_PUBLIC_API_BASE_URL=http://localhost:5000
# Optional: Application URL
NEXT_PUBLIC_APP_URL=http://localhost:3030
# Optional: OAuth Configuration
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secretFor production, create .env.production:
NEXT_PUBLIC_API_BASE_URL=https://api.yourdomain.com
NEXT_PUBLIC_APP_URL=https://yourdomain.com# Clone the repository
git clone https://github.com/letsbld/dlp-frontend.git
cd dlp-frontend
# Install dependencies
pnpm install
# Start development server
pnpm dev
# The application will start at http://localhost:3030# Development
pnpm dev # Start dev server with Turbopack on port 3030
# Production
pnpm build # Build for production
pnpm start # Start production server
# Code Quality
pnpm lint # Run ESLint
# Type Checking
npx tsc --noEmit # Check TypeScript typesThe application runs on port 3030 by default. To change this:
Option 1: package.json
{
"scripts": {
"dev": "next dev --turbopack --port 3000",
"start": "next start --port 3000"
}
}Option 2: Command line
pnpm dev -- --port 3000sequenceDiagram
participant U as User
participant F as Frontend
participant B as Backend
participant DB as Database
U->>F: Enter credentials
F->>B: POST /auth/user/login
B->>DB: Validate credentials
alt TOTP Enabled
DB-->>B: User has TOTP
B-->>F: Redirect to TOTP verification
F->>U: Show TOTP input
U->>F: Enter TOTP code
F->>B: POST /auth/user/login/totp
B->>B: Verify TOTP
else TOTP Setup Required
DB-->>B: TOTP required but not set
B-->>F: Redirect to TOTP setup
F->>U: Show QR code
U->>F: Scan & verify
else No TOTP
DB-->>B: No TOTP required
end
B-->>F: JWT token + user data
F->>F: Store in localStorage
F->>U: Redirect to dashboard
sequenceDiagram
participant U as User
participant F as Frontend
participant B as Backend
participant A as Authenticator
U->>F: Click "Login with Passkey"
F->>B: POST /passkey/authenticate/generate-options
B-->>F: Challenge + options
F->>A: navigator.credentials.get()
A->>U: Biometric/PIN prompt
U->>A: Authenticate
A-->>F: Assertion
F->>B: POST /passkey/authenticate/verify
B->>B: Verify assertion
B-->>F: JWT token + user data
F->>U: Redirect to dashboard
sequenceDiagram
participant U as User
participant F as Frontend
participant B as Backend
participant A as Authenticator App
U->>F: Login (first time)
F->>B: POST /user/totp/setup
B-->>F: QR code + secret
F->>U: Display QR code
U->>A: Scan QR code
A->>U: Generate 6-digit code
U->>F: Enter code
F->>B: POST /user/totp/verify-setup
B->>B: Validate code
B-->>F: Success
F->>U: TOTP enabled, redirect to login
β Token Management
- JWT tokens stored in localStorage
- Automatic token expiration checking
- Token validation on page load
- Secure token transmission
β Route Protection
PrivateRoutecomponent for role-based access- Automatic redirection for unauthorized access
- Client-side and middleware protection
β Input Validation
- Client-side validation before submission
- Type-safe forms with TypeScript
- Sanitized user inputs
β API Security
- Authorization header on all requests
- CORS configuration
- Rate limiting (backend)
- SQL injection prevention (backend)
-
Connect Repository
- Import your GitHub repository to Vercel
- Select the
dlp-frontendproject
-
Configure Environment Variables
NEXT_PUBLIC_API_BASE_URL=https://your-api-domain.com -
Deploy
- Vercel will automatically build and deploy
- Subsequent pushes to main branch auto-deploy
Dockerfile:
# Stage 1: Build
FROM node:18-alpine AS builder
WORKDIR /app
# Install dependencies
COPY package.json pnpm-lock.yaml ./
RUN npm install -g pnpm && pnpm install --frozen-lockfile
# Build application
COPY . .
RUN pnpm build
# Stage 2: Production
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
# Copy built files
COPY --from=builder /app/next.config.ts ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3030
CMD ["node", "server.js"]Build & Run:
# Build image
docker build -t dlp-frontend:latest .
# Run container
docker run -p 3030:3030 \
-e NEXT_PUBLIC_API_BASE_URL=https://api.yourdomain.com \
dlp-frontend:latestDocker Compose:
version: '3.8'
services:
frontend:
build: .
ports:
- "3030:3030"
environment:
- NEXT_PUBLIC_API_BASE_URL=http://backend:5000
depends_on:
- backend
restart: unless-stopped
backend:
image: dlp-backend:latest
ports:
- "5000:5000"
environment:
- DATABASE_URL=postgresql://user:pass@db:5432/dlp
restart: unless-stopped# On your server
git clone https://github.com/letsbld/dlp-frontend.git
cd dlp-frontend
# Install dependencies
pnpm install
# Build
pnpm build
# Use PM2 for process management
npm install -g pm2
pm2 start npm --name "dlp-frontend" -- start
pm2 save
pm2 startup
# Setup Nginx reverse proxy
sudo nano /etc/nginx/sites-available/dlp-frontendNginx Configuration:
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://localhost:3030;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}- Admin Dashboard: All statistics fetched simultaneously using
Promise.all - Reduced Load Time: 3x faster dashboard loading
- Better User Experience: Immediate visual feedback with loading states
// Before: Sequential (slow)
const users = await apiFetch('/user/');
const devices = await apiFetch('/device');
const groups = await apiFetch('/user-group');
// After: Parallel (fast)
const [users, devices, groups] = await Promise.all([
apiFetch('/user/'),
apiFetch('/device'),
apiFetch('/user-group')
]);- Lazy loading for heavy components
- Memoization of expensive computations
- Efficient re-render prevention
- Optimized image loading with Next.js Image
- Loading Indicators: Beautiful Commet loader for all async operations
- Toast Notifications: Instant feedback for user actions
- Error States: User-friendly error messages
- Empty States: Helpful guidance when no data exists
- Mobile-first approach with Tailwind CSS
- Adaptive layouts for all screen sizes
- Touch-friendly interfaces
- Collapsible sidebars for mobile
- Real-time Application Search: Instant results as you type
- Smart Filtering: Case-insensitive search
- Visual Search Indicator: Clear search icon
- No Results State: Helpful empty state
- Multiple Auth Methods: Username/Password, TOTP, Passkeys, OAuth
- Session Management: Automatic token expiration and refresh
- Secure Storage: Encrypted localStorage with validation
- Client-side validation before API calls
- TypeScript type checking
- Sanitized inputs to prevent XSS
- CSRF protection
- Modern passwordless authentication
- Biometric authentication support
- Device-bound credentials
- Platform authenticator support
- Full Type Safety: All components and functions typed
- Interface Definitions: Clear contracts for data structures
- Type Inference: Reduced boilerplate with smart inference
- Strict Mode: Catch errors early in development
- Reusable Components: DRY principle throughout codebase
- Consistent Styling: Unified design system with Tailwind
- Props Interfaces: Clear component APIs
- Separation of Concerns: Logic separated from presentation
- Try-catch blocks for all async operations
- Graceful degradation on failures
- User-friendly error messages
- Error boundaries for component crashes
β
Clear folder structure
β
Modular components
β
Centralized utilities
β
Consistent naming conventions
β
Comprehensive documentation
- Visual application catalog with logos
- Favorites system with persistent state
- Real-time search functionality
- Responsive grid layout
- Tab-based navigation (All/Favorites)
- Register new passkeys
- View all registered passkeys
- Delete passkeys with confirmation
- Display credential details
- Last usage tracking
- Create and manage user groups
- Add/remove group members
- Navigate to group details
- View member lists
- Group-based policies
- Bulk user import from CSV
- Template download
- Validation and error reporting
- Progress tracking
- Export functionality
# Run tests (when configured)
pnpm test
# Run tests in watch mode
pnpm test:watch
# Generate coverage report
pnpm test:coverage- User login with username/password
- Admin login flow
- TOTP setup and verification
- Passkey registration
- Passkey authentication
- User creation/editing/deletion
- User group management
- CSV import functionality
- Application search and favorites
- Responsive design on mobile
- Token expiration handling
- Error state handling
We welcome contributions! Please follow these guidelines:
-
Fork the repository
git clone https://github.com/your-username/dlp-frontend.git
-
Create a feature branch
git checkout -b feature/amazing-feature
-
Make your changes
- Follow the existing code style
- Add TypeScript types
- Update documentation
- Test thoroughly
-
Commit your changes
git commit -m 'Add some amazing feature' -
Push to the branch
git push origin feature/amazing-feature
-
Open a Pull Request
- Describe your changes
- Link related issues
- Request review
- Use TypeScript for all new code
- Follow existing naming conventions
- Use functional components with hooks
- Keep components small and focused
- Add comments for complex logic
- Use Tailwind CSS for styling
- Ensure responsive design
type(scope): subject
body
footer
Types: feat, fix, docs, style, refactor, test, chore
Example:
feat(auth): add passkey authentication
- Implement WebAuthn registration flow
- Add passkey management UI
- Update authentication context
Closes #123
This project is private and proprietary software. All rights reserved.
Β© 2025 BLD. Unauthorized copying, modification, distribution, or use of this software is strictly prohibited.
- π§ Email: support@yourdomain.com
- π¬ Discord: Join our community
- π Documentation: Full docs
- π Bug Reports: GitHub Issues
How do I reset my password?
Contact your administrator or use the "Forgot Password" link on the login page.
Can I use multiple passkeys?
Yes! You can register multiple passkeys for backup and convenience.
What browsers support passkeys?
Chrome 67+, Firefox 60+, Safari 13+, Edge 18+
How do I enable TOTP?
Your administrator can require TOTP. Once enabled, you'll be guided through setup on your next login.
- Next.js Team - Amazing React framework
- Vercel - Hosting and deployment platform
- Radix UI - Accessible component primitives
- Tailwind Labs - Beautiful utility-first CSS
- SimpleWebAuthn - WebAuthn implementation
- All Contributors - Thank you for your contributions!
Built with β€οΈ using Next.js, TypeScript, and modern web technologies