An enterprise request management system with intelligent routing, anonymity vaults, and SLA tracking. This system allows employees and guests to submit requests which are automatically triaged to the correct department (IT, HR, Operations, etc.) based on keyword analysis.
- Framework: Next.js 14 (App Router)
- Database: PostgreSQL
- ORM: Prisma
- Language: TypeScript
- Styling: Tailwind CSS
- Authentication: NextAuth.js (In Progress)
Follow these steps to set up the project locally.
- Node.js (v18+)
- PostgreSQL (installed locally or a cloud URL like Supabase/Neon)
# Clone the repository
git clone <repository_url>
# Enter the directory
cd direct-line-portal
# Install dependencies
npm install
Create a .env file in the root directory. You can duplicate .env.example if it exists.
Add your database connection string:
# .env
DATABASE_URL="postgresql://USER:PASSWORD@localhost:5432/direct_line_db?schema=public"
Replace USER, PASSWORD, and direct_line_db with your local Postgres credentials.
Since this project uses Prisma, you must sync your local database with the schema and seed the default data (Departments, Keywords, Admin Users).
# 1. Generate the Prisma Client
npx prisma generate
# 2. Push the schema to your database (creates tables)
npx prisma db push
# 3. Seed the database with default data
# (Creates Departments: IT, HR, Admin, etc. & Routing Keywords)
npx prisma db seed
npm run dev
Open http://localhost:3000 with your browser.
1. Database Check
After seeding, check your database (using pgAdmin or npx prisma studio). You should see:
- 5 Departments (IT, HR, Operations, Finance, Admin)
- Defined Categories & Keywords
- Mock Users (Managers)
2. Submit a Request (Triage Engine Test)
- Go to
http://localhost:3000/submit - Note: Currently, the
userIdin the code is hardcoded for testing purposes. If you get an error, ensure theMOCK_USER_IDinapp/submit/page.tsxmatches a valid UUID from youruserstable. - Scenario: Submit a ticket with the text: "Help, the main server is down and throwing 500 errors."
- Expected Result: The system should automatically categorize this as a "Technical System Issue" and route it to the Technical Management department.
3. Verify Routing & Audit Logs
- Check the
requesttable: Thedepartment_idshould match the Technical Management UUID. - Check the
auditlogstable: A "CREATED" log entry should exist. - Check the
identityvaulttable: The user's real identity should be linked here.
4. View Dashboard
- Go to
http://localhost:3000/dashboardto see the list of requests submitted by the current mock user.
├── app/
│ ├── api/ # API Route Handlers (Triage Logic)
│ ├── dashboard/ # User/Manager Dashboard
│ ├── submit/ # Request Submission Form
│ ├── lib/ # Shared logic (Triage Engine, Utilities)
├── prisma/
│ ├── schema.prisma # Database Schema Definition
│ ├── seed.ts # Database Seeding Script
├── middleware.ts # RBAC Security Middleware