Architecture
VulnTrack uses Next.js Server Actions instead of traditional REST endpoints. Server Actions provide a type-safe, RPC-style API that integrates seamlessly with React Server Components and Next.js App Router.What are Server Actions?
Server Actions are asynchronous functions that run on the server and can be called directly from client or server components. They are marked with the'use server' directive at the top of the file.
Key Benefits:
- Type-safe communication between client and server
- Automatic request/response serialization
- Built-in CSRF protection
- Integrated with React’s Suspense and transitions
- No need to manually define API routes
Server Action Pattern
All server actions in VulnTrack follow a consistent pattern:Response Format
All server actions return a consistent response format:Indicates whether the operation succeeded
The requested data or operation result (present on success)
Error message explaining what went wrong (present on failure)
Calling Server Actions
From Client Components
- Form Actions
- Direct Calls
From Server Components
Security Features
Multi-Tenant Isolation
All server actions enforce strict team isolation:- Users can only access resources within their team
- Admins have elevated privileges but are still scoped to their team
- Cross-tenant access attempts return “Unauthorized” errors
Session Management
Every action validates the user session:Audit Logging
Critical operations are logged for compliance:Rate Limiting
Some actions include rate limiting to prevent abuse:Error Handling
Server actions return structured errors instead of throwing:Next Steps
Authentication
Learn about NextAuth.js integration and session management
Vulnerabilities
Create, read, update, and delete vulnerability records
Teams
Manage team members and assignments
Scoring
Calculate DREAD, STRIDE, and CVSS scores