Sign inSign up

kuberlab/kiberflow-ui

By kuberlab

Updated about 9 hours ago

Image
0

10K+

kuberlab/kiberflow-ui repository overview

KiberFlow UI

React SPA front-end for the KiberFlow AI platform — conversational RAG, document processing, structured data extraction, longitudinal timelines, FAQ generation, and analytics. This is the UI counterpart of the ira-chat-api backend.


Backend & Specification References

This project is tightly coupled with the ../ira-chat-api backend. All UI specifications and API references live in that repository.

AI agents: start with UI_INDEX.md — it is the master index with a section cross-reference table linking every spec and topic.

UI Specification Documents (../ira-chat-api/docs/)
DocumentScope
UI_INDEX.mdMaster table of contents — start here
GLOSSARY.mdCanonical domain names — Detection, not detector/Processor
UI_MAP.mdObject hierarchy, data-flow diagrams, route structure, navigation map, permissions, Token model, OAuth
UI_APP_CONFIG.mdPer-screen specs: workspace dashboard, chat, detection, extractor, FAQ, timeline, datasets, dataset/index picker, message grading/tagging
UI_UX_REQUIREMENTS.mdCross-cutting standards: design principles, layout system, component specs, notifications, responsive/mobile, accessibility, empty states, file upload, pagination, dark mode, async status, error handling, keyboard shortcuts
UI_AUTH.mdAuthentication flows: login, registration, email confirmation, workspace invitation, password reset, logout, account settings
UI_ANALYTICS.mdAnalytics: metrics dashboard (KPIs, time-series), analysis dashboard (quality, users, categories, tags), grading UI, usage dashboard, export/import
UI_INTEGRATIONS.mdIntegrations: org API keys, webhooks, external apps, OAuth connections, voice (Twilio), messenger bots (Telegram/Slack/WhatsApp), workspace tokens, org domains
UI_ORG.mdOrganization management: general settings, users (invite/edit/remove), org list & switcher, operations dashboard, sidebar navigation, permissions
BACKEND.mdPlanned backend API changes required by the new UI (confirm endpoints, resend, OAuth disconnect, invite acceptance)
STREAMING_INTEGRATION_RU.mdCentrifuge WebSocket streaming integration details

Tech Stack

LayerTechnology
FrameworkReact 19 + TypeScript 5.9
BuildVite 8 (with Tailwind CSS v4 plugin)
StylingTailwind CSS v4 + motion for animations
Componentsshadcn/ui (radix-nova style) + Radix UI primitives + Lucide icons
Server stateTanStack React Query v5
RoutingReact Router v7 (SPA, lazy-loaded routes)
FormsReact Hook Form + Zod validation
Real-timeCentrifuge (WebSocket for chat streaming)
ChartsRecharts
Markdownreact-markdown + remark-gfm + react-syntax-highlighter

Project Structure

src/
├── main.tsx                  # App entry point
├── App.tsx                   # Root component (providers, router)
├── router.tsx                # Route definitions with lazy loading
├── index.css                 # Global styles (Tailwind base)
├── queryClient.ts            # TanStack Query client config
│
├── auth/                     # Route guards (ProtectedRoute, GuestRoute)
├── context/                  # React contexts
│   ├── AuthContext.tsx        #   Session / user state
│   ├── ThemeContext.tsx       #   Dark/light theme
│   └── WorkspaceContext.tsx   #   Current workspace state
│
├── hooks/                    # Custom hooks
│   ├── useChatSort.ts        #   Chat list sorting
│   ├── useChatStream.ts      #   Centrifuge chat streaming
│   ├── useCurrentOrg.ts      #   Current org from context
│   ├── useDatasetBasePath.ts #   Dataset route helpers
│   ├── useIsMobile.ts        #   Responsive breakpoint
│   ├── useKeyboardShortcuts.ts # Keyboard shortcut handlers
│   ├── useOrgPermissions.ts  #   Org permission checks
│   ├── usePaginationParams.ts # URL pagination params
│   ├── usePolling.ts         #   Interval polling for async ops
│   ├── useSortParams.ts      #   URL sort params
│   ├── useToast.ts           #   Toast shortcut
│   └── useValidationErrors.ts # Form validation error mapping
│
├── lib/
│   ├── api.ts                # Typed fetch wrapper (api.get/post/put/del)
│   ├── constants.ts          # Polling intervals, page sizes, storage keys
│   ├── download.ts            # File download helpers
│   └── utils.ts              # Utility functions
│
├── types/
│   └── api.ts                # Shared TypeScript types
│
├── components/
│   ├── ui/                   # Reusable UI primitives (Button, Input, DataTable,
│   │                         #   Pagination, FileUpload, GradeSelector, etc.)
│   ├── layout/               # PageShell, TopBar, Sidebar, Breadcrumb
│   ├── chats/                # Chat-specific shared components
│   ├── datasets/             # Dataset-specific shared components
│   ├── detections/           # Detection-specific shared components
│   ├── extractors/            # Extractor-specific shared components
│   ├── shared/               # Cross-domain shared components
│   ├── topic-router/         # Topic routing utilities
│   └── workspaces/            # Workspace-specific shared components
│
└── pages/                    # Page components, organized by domain
    ├── ErrorPage.tsx          #   Global error boundary
    ├── ForbiddenPage.tsx      #   403 Forbidden
    ├── NotFoundPage.tsx       #   404 Not Found
    ├── auth/                  #   Login, Register, Confirm, Invite, ResetPassword
    ├── account/               #   Account settings
    ├── org/                   #   Org settings (general, users, API keys, domains,
    │                          #     webhooks, external apps), org list
    ├── datasets/              #   Dataset list, files, indexes
    ├── workspaces/            #   Workspace list, dashboard
    │   └── settings/          #   Workspace settings (general, members, tokens,
    │                          #     API keys, categories, voice, messenger, advanced)
    ├── chats/                 #   Chat list, messages, settings
    ├── detections/            #   Detection list, items, settings
    ├── extractors/            #   Extractor list, files, results, settings
    ├── timelines/             #   Timeline list, points, settings
    ├── faqs/                  #   FAQ list, files, settings
    └── analytics/             #   Metrics, analysis, usage dashboards

Getting Started

Prerequisites
  • Node.js 22+ (recommended: use the version from .nvmrc or the Dockerfile)
Install & Run
# Install dependencies
npm ci

# Install Playwright's Chromium browser for e2e tests
npx playwright install chromium

# Start dev server (http://localhost:5174)
npm run dev
API Proxy

In development, Vite proxies all /api/v1 requests to the backend. The default target is https://dev.dev-hotline.kibernetika.io.

To proxy to a local backend instead:

cp .env.example .env
# Edit .env and uncomment:
# API_PROXY_TARGET=http://localhost:8083
Available Scripts
ScriptDescription
npm run devStart Vite dev server with HMR
npm run buildType-check + production build
npm run previewPreview production build locally (port 5174)
npm run typecheckTypeScript type checking (no emit)
npm run lintESLint
npm run test:e2eRun the Playwright smoke suite headlessly against a local app server on port 4173
npm run test:e2e:headedRun the Playwright smoke suite in headed mode
npm run test:e2e:uiOpen the Playwright UI runner
npm run check:build-assetsValidate build output assets
Browser Smoke Tests

Playwright smoke coverage runs the real SPA in Chromium and mocks /api/v1/** traffic inside the browser tests, so the suite does not depend on the default remote Vite proxy target.

# One-time browser install after npm ci
npx playwright install chromium

# Run the smoke suite
npm run test:e2e

Reports are written to playwright-report/ and transient artifacts to test-results/. On Linux CI or first-time local setup, use npx playwright install --with-deps chromium if the host still needs system browser dependencies.


Docker

Multi-stage build: Node 22 (build) → Nginx 1.29 (serve).

# Build image
./build.sh

# Build and push to registry
./build.sh --push
Runtime Configuration
Env VariableEffect
BACKEND_URLIf set, nginx proxies /api/ to this URL (for local Docker / docker-compose). If unset, uses a static nginx config assuming an external ingress handles API routing (Kubernetes).

Architecture Notes

  • API layer — cookie-based auth (IRA_SESSION_ID cookie); all requests go through src/lib/api.ts which handles JSON serialization, error mapping, and automatic logout on 401
  • Route structure — mirrors the backend scopes (org-scoped, workspace-scoped); see UI_MAP.md for the full route map
  • Real-time — WebSocket for chat message streaming; interval polling for detection, extractor, FAQ, and dataset index operations
  • Code splitting — vendor chunks for react, tanstack-query, markdown libs, and chart libs (configured in vite.config.ts)
  • Path alias@/ resolves to src/

App Domains

The platform organizes features around five workspace app types plus org-level services:

AppPurpose
ChatConversational RAG interface with streaming, grading, file attachments, and corrected answers
DetectionDocument analysis (prescriptions, med lists, etc.) via OCR + LLM
ExtractorStructured data extraction driven by JSON Schema
TimelineLongitudinal point-in-time tracking with diff views
FAQKnowledge-base clustering generated from chat history

Org-level features: datasets (shared document corpora), analytics (metrics, analysis, usage), integrations (API keys, webhooks, external apps, OAuth, voice, messenger bots), and organization management (users, domains).

Tag summary

Content type

Image

Digest

sha256:5784a5242

Size

26.6 MB

Last updated

about 9 hours ago

docker pull kuberlab/kiberflow-ui