Skip to content

RichardKituyi/direct-line-portal

Repository files navigation

Direct Line - Intelligent Request Portal

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.

🛠 Tech Stack

  • Framework: Next.js 14 (App Router)
  • Database: PostgreSQL
  • ORM: Prisma
  • Language: TypeScript
  • Styling: Tailwind CSS
  • Authentication: NextAuth.js (In Progress)

🚀 Getting Started

Follow these steps to set up the project locally.

1. Prerequisites

  • Node.js (v18+)
  • PostgreSQL (installed locally or a cloud URL like Supabase/Neon)

2. Installation

# Clone the repository
git clone <repository_url>

# Enter the directory
cd direct-line-portal

# Install dependencies
npm install

3. Environment Setup

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.

4. Database Initialization (Crucial)

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

5. Running the Application

npm run dev

Open http://localhost:3000 with your browser.


🧪 How to Test (Phase 1 & 2 Features)

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 userId in the code is hardcoded for testing purposes. If you get an error, ensure the MOCK_USER_ID in app/submit/page.tsx matches a valid UUID from your users table.
  • 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 request table: The department_id should match the Technical Management UUID.
  • Check the auditlogs table: A "CREATED" log entry should exist.
  • Check the identityvault table: The user's real identity should be linked here.

4. View Dashboard

  • Go to http://localhost:3000/dashboard to see the list of requests submitted by the current mock user.

📂 Project Structure

├── 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages