Skip to content

Bhuvan-S-prasad/intelliops

Repository files navigation

⚑ IntelliOps

An AI-native operational intelligence platform unifying systems into a single operational layer.

Next.js React TypeScript Tailwind CSS
Neon Prisma Clerk Upstash Redis Supabase
Vercel AI SDK Zod


IntelliOps allows teams to upload system logs, database sheets, reports, and code documents, run advanced semantic queries grounded in their datasets, and monitor operational health through real-time telemetry.


πŸ“Έ Platform Previews

Real-time Telemetry Dashboard Landing page


Modern Chat & File Insights UI Real-time Telemetry Dashboard

🌟 Key Features

  • Advanced Hybrid RAG Pipeline: Combines dense semantic vector retrieval with sparse keyword full-text search, fused using Reciprocal Rank Fusion (RRF) and scored via a custom LLM-based reranking system.
  • Multi-Format Ingestion Engine: Asynchronously parses, chunks, and indexes a wide variety of operational formats: PDFs, CSV sheets, JSON payloads, plain text, and system log files (.log).
  • Real-time Telemetry Dashboard: Tracks workspace metrics, workspace-wide storage details, ingestion stats, and logs detailed, real-time audit logs of workspace actions.
  • Multi-Tenant Workspaces: Complete workspace isolation with role-based access control (RBAC), workspace switching, and teammate onboarding.
  • Modern Chat UI: Implements a premium, full-bleed messaging interface featuring custom scrollbars, streaming AI completions, typing indicators, and inline source citation links.

πŸ—οΈ Architecture & How It Works

1. Data Ingestion Pipeline

When a user uploads a document, it goes through an asynchronous processing flow:

[ File Upload ]
       ↓
[ Storage Bucket ]
       ↓
[ File Processor Worker ]
       ↓
( File Type Detection )
  β”œβ”€β”€ PDF  βž” [ pdf-parse Extraction ]
  β”œβ”€β”€ CSV  βž” [ PapaParse Tabular Extraction ]
  └── TXT  βž” [ Structure-Aware Parsers ]
       ↓
[ Sliding-Window Sentence-Level Chunker ]
       ↓
[ NVIDIA Llama Nemotron Embeddings Batching ]
       ↓
[ Prisma Bulk Vector Insertion ]
  • Chunking & Overlapping: Documents are split into segments matching paragraph and sentence boundaries. If a chunk exceeds maxTokens (512), it splits and uses a sliding window overlap of 64 tokens to preserve semantic context across chunk splits.
  • Vector Embeddings: Chunk texts are grouped in batches of 25 and sent to the embedding model, slicing the dimensions to 1536 (MRL optimization) for dense vector search.

2. The Advanced RAG Retrieval Flow

To minimize hallucination and ensure precise matches for system variables and logs, query execution uses an advanced retrieval workflow:

[ User Query ]
       ↓
[ LLM Query Rewriter ]
       ↓ (Expanded Query)
  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
  β”‚         β”‚
[ Dense ] [ Sparse FTS ]
  β”‚         β”‚
  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ (Top 15 Chunks Each)
       ↓
[ Reciprocal Rank Fusion (RRF) ]
       ↓ (Top 15 Merged)
[ LLM-Based Reranker ]
       ↓ (Top 6 Contexts)
[ Streamed Response Generator ]
  1. Query Rewriting: The user's query is expanded using an LLM (e.g. converting "why did deploy fail?" into search terms like "Error", "deployment", "pipeline aborted", "failed").
  2. Hybrid Search:
    • Dense Search: Cosine-similarity matches using pgvector.
    • Sparse Search: Full-text search over text vectors using PostgreSQL's FTS engine.
  3. Reciprocal Rank Fusion (RRF): Ranks are fused using the formula: $$RRF(d) = \frac{1}{60 + \text{rank}{\text{dense}}(d)} + \frac{1}{60 + \text{rank}{\text{sparse}}(d)}$$
  4. LLM Reranking: The top 15 RRF candidates are scored (0–10) by a fast LLM helper to filter out noise and retain the top 6 most relevant contexts for the final system prompt.

πŸ—„οΈ Database Architecture

The data layer is built on PostgreSQL using Prisma ORM, optimized for multi-tenancy and high-performance vector operations:

Model Key Fields Purpose Relations
User clerkId, email, name, avatarUrl Synced from Clerk webhooks. One user can belong to many workspaces WorkspaceMember, File, Conversation, AuditLog
Workspace name, slug (unique), description Tenant boundary. All data is scoped to a workspace WorkspaceMember, File, Conversation, AuditLog, Insight
WorkspaceMember role: OWNER/ADMIN/USER, joinedAt RBAC join table. Unique constraint on (workspaceId, userId) Workspace, User
File status: QUEUED/PROCESSING/READY/FAILED, storageKey, fileType, sizeBytes, chunkCount Uploaded file record. storageKey maps to Supabase S3 object Workspace, User, Chunk, Insight
Chunk content, chunkIndex, tokenCount, embedding vector(1536), metadata (Json) Text segments with embeddings. Queried by pgvector for RAG retrieval File
Conversation title, workspaceId, userId Container for a chat session between user and AI Workspace, User, Message
Message role: user/assistant, content, sources (Json) Individual message. sources stores chunk IDs + similarity scores Conversation
Insight type: FILE_SUMMARY/KEY_ISSUES/TREND/ANOMALY, content (Markdown), isStale, metadata (Json) AI-generated structured insights. Linked to workspace or specific file Workspace, File (optional)
AuditLog action, metadata (Json), createdAt Immutable event log. Actions: file.upload, file.delete, member.invite, query.run, workspace.create Workspace, User

πŸ”Œ API Design

The backend utilizes Next.js 16 App Router API Routes (/api/...) following RESTful principles, edge-optimized runtimes, and Upstash Redis rate limiting.

Workspaces & Members

  • POST /api/workspaces - Create a new isolated workspace.
  • GET /api/workspaces - List all workspaces accessible to the user.
  • GET /api/workspaces/[id] - Retrieve details for a specific workspace.
  • PATCH /api/workspaces/[id] - Update workspace settings.
  • DELETE /api/workspaces/[id] - Delete a workspace and cascade delete its data.
  • GET /api/workspaces/[id]/members - List all members and their roles in the workspace.
  • POST /api/workspaces/[id]/members - Invite a new member to the workspace.
  • PATCH /api/workspaces/[id]/members/[uid] - Update a member's role (e.g., USER to ADMIN).
  • DELETE /api/workspaces/[id]/members/[uid] - Remove a member from the workspace.

Files & Ingestion

  • POST /api/workspaces/[id]/files - Generate secure pre-signed URLs for direct-to-S3 uploads and queue files for ingestion.
  • GET /api/workspaces/[id]/files - List all ingested and processing files in the workspace.
  • GET /api/workspaces/[id]/files/[fid] - Retrieve metadata for a specific file.
  • DELETE /api/workspaces/[id]/files/[fid] - Delete a file and its associated vector chunks.

AI Search & Chat

  • POST /api/workspaces/[id]/search - Standalone endpoint for raw hybrid semantic queries (RRF) over indexed chunks.
  • POST /api/workspaces/[id]/conversations - Create a new chat conversation thread.
  • GET /api/workspaces/[id]/conversations - List all conversation threads.
  • GET /api/workspaces/[id]/conversations/[cid] - Retrieve a specific conversation and its messages.
  • DELETE /api/workspaces/[id]/conversations/[cid] - Delete a conversation history.
  • POST /api/workspaces/[id]/conversations/[cid]/messages - Core RAG endpoint. Executes hybrid search, passes context to the LLM, and streams back the response via SSE.

Insights & Telemetry

  • GET /api/workspaces/[id]/insights - Fetch workspace-level AI-generated insights.
  • POST /api/workspaces/[id]/insights/generate - Trigger an async job to generate insights/anomalies over workspace data.
  • GET /api/workspaces/[id]/files/[fid]/insights - Retrieve file-specific generated insights.
  • GET /api/workspaces/[id]/stats - Aggregate telemetry data (file counts, storage used, query volume) for the dashboard, optimized with Redis caching.

πŸ”’ Security & Data Protection

  • πŸ›‘οΈ Authentication: Clerk JWT validated server-side on every protected route via requireAuth().
  • 🏒 Role-Based Access Control (RBAC): Workspace RBAC enforced in API middleware. Role hierarchy (OWNER > ADMIN > USER) is strictly verified on the server and never trusted from the client.
  • ⚑ Rate Limiting: Sliding window rate limiters (via Upstash Redis) protect all AI and file upload endpoints against abuse and expensive DDoS patterns.
  • βœ… Input Validation: Zod validation on all API inputs. Malformed requests are rejected at the boundary with a 400 Bad Request error.
  • πŸ” Secure Uploads: File uploads use secure pre-signed URLs, allowing direct-to-S3 object storage without passing large payloads through the Node.js server.
  • πŸ“œ Immutable Audit Trails: Every destructive or critical workspace action (e.g., file.delete, member.invite) is logged in an immutable AuditLog for compliance and observability.

πŸš€ Getting Started

Prerequisites

  • Node.js v18+
  • PostgreSQL database instance with the vector extension enabled

Environment Variables

Configure a .env file in the root directory:

DATABASE_URL="postgresql://user:password@host:port/dbname?sslmode=require"
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."
CLERK_SECRET_KEY="sk_test_..."
OPENROUTER_API_KEY="sk-or-v1-..."

Installation & Run

  1. Clone the repository and install dependencies:
    npm install
  2. Apply database schemas and run migrations:
    npx prisma db push
  3. Run the development server:
    npm run dev

πŸ› οΈ Tech Stack & Libraries

  • Framework: Next.js 16 (App Router Β· TypeScript strict)
  • Styling: Tailwind CSS (Custom design tokens Β· Dark mode)
  • Database: NeonDB (Postgres with pgvector extension for embeddings)
  • ORM: Prisma (Type-safe queries Β· Migrations)
  • Authentication: Clerk (JWT Β· Webhooks Β· RBAC)
  • AI / LLM: OpenRouter (GPT OSS 20B)
  • AI Streaming: Vercel AI SDK (streamText Β· StreamingTextResponse)
  • Cache + Rate Limits: Upstash Redis (Sliding window limiters)
  • Object Storage: Supabase S3 (S3-compatible API Β· Signed URLs)
  • Validation: Zod (All API inputs validated)

🧠 Engineering Challenges Solved

This project was built to solve complex engineering challenges, demonstrating proficiency in full-stack architecture, asynchronous processing, and AI integrations:

1. Hybrid Search (RAG) Optimization

Achieving high relevance in semantic search required moving beyond simple vector similarity. I implemented Reciprocal Rank Fusion (RRF) to combine dense vector search with sparse full-text search (PostgreSQL FTS). A secondary LLM-based reranking step was added to eliminate hallucinated or loosely-related chunks, ensuring the final context window is highly accurate.

2. Intelligent Data Chunking

Processing large PDFs, CSVs, and logs sequentially blocks operations and leads to timeouts. The ingestion pipeline was designed to handle files efficiently, utilizing structural chunking (sentence and paragraph boundaries) with sliding window overlaps (64 tokens) to maintain semantic integrity without hitting LLM context limits.

3. Streaming AI Responses

To provide a premium, low-latency user experience, responses are streamed directly to the client using the Vercel AI SDK. The UI handles real-time markdown rendering and syntax highlighting (react-markdown, react-syntax-highlighter) without re-rendering the entire DOM tree, optimizing React's reconciliation process.

4. Scalable Multi-Tenant Architecture

Workspaces are strictly isolated at the database level. Each user operation, file upload, and query is verified against the user's workspace role and permissions via Clerk middleware and API checks.


πŸ“ Project Structure Highlights

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ (auth)/             # Authentication routes (Clerk)
β”‚   β”œβ”€β”€ (dashboard)/        # Protected workspace routes
β”‚   └── api/                # REST/Serverless endpoints & Webhooks
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ chat/               # Streaming chat interface & markdown renderers
β”‚   └── ui/                 # Reusable, accessible UI components (Shadcn/Base UI)
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ chunker.ts          # Advanced sliding-window text chunking algorithm
β”‚   β”œβ”€β”€ file-processor.ts   # Multi-format parsing (PDF, CSV, Logs)
β”‚   └── rag-pipeline.ts     # RRF fusion, dense/sparse search & LLM reranking
└── prisma/
    └── schema.prisma       # Database schema including pgvector mappings

About

IntelliOps is an AI-native operational intelligence platform that consolidates fragmented tools into a unified operational layer. It allows teams to upload system logs, database sheets, reports, and code documents, run advanced semantic queries grounded in their datasets, and monitor operational health through real-time telemetry.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages