# AuraK โ€” Enterprise AI Knowledge Base & Talent Assessment Platform AuraK is a multi-tenant intelligent platform built with **React 19 + NestJS**, combining RAG-powered knowledge management, interactive AI assessment, and enterprise-grade RBAC permission system. --- ## โœจ Features ### ๐Ÿ” Enterprise Multi-Tenant & RBAC - **Tenant Isolation** โ€” Strict data isolation between tenants with independent member management - **RBAC Permissions** โ€” 3-tier roles (SUPER_ADMIN / TENANT_ADMIN / USER) with 26 granular permissions across 7 categories - **Custom Roles** โ€” Create and assign custom roles with specific permission sets - **Permission Matrix UI** โ€” Visual permission matrix editor in Settings panel - **Role Auto-Seed** โ€” Default roles with permission sets created on startup ### ๐Ÿ“Š Interactive AI Assessment - **AI-Powered Exams** โ€” Automated question generation, grading, and follow-up questioning via LangGraph workflow - **Dual Question Sources** โ€” Pre-built question banks + AI generation on-the-fly - **Multi-Dimension Scoring** โ€” Weighted scoring across customizable dimensions (Prompt, LLM, IDE, Dev Patterns, Work Capability) - **Certificate System** โ€” Auto-generated certificates with score breakdown by dimension - **Adaptable Templates** โ€” Configure question count, dimensions, time limits, passing scores per template - **Non-Technical Mode** โ€” Separate templates for non-technical staff (exclude IDE/Dev Patterns) **Exam Flow:** Admin creates accounts โ†’ Candidates login โ†’ Take assessment โ†’ AI grades + issues certificate โ†’ View history ### ๐Ÿ“š Intelligent Knowledge Base - **Dual Processing Modes** โ€” Fast mode (Tika text extraction) + High-precision mode (Vision Pipeline for image/PDF) - **Hybrid Search** โ€” BM25 keyword + vector embedding with Elasticsearch - **Multi-Format Support** โ€” PDF, Word, PPT, Excel, images - **Hierarchical Groups** โ€” Folder-style knowledge group management ### ๐Ÿค– Multi-Model AI Engine - OpenAI-compatible APIs (OpenAI, DeepSeek, Claude, etc.) - Google Gemini native SDK - Configurable LLM / Embedding / Rerank / Vision models ### ๐ŸŒ Additional Features - Streaming SSE responses - Multi-language (Chinese, English, Japanese) - Feishu (Lark) bot integration - Podcast generation from documents - Notebook/shared notes system - User quota management --- ## ๐Ÿ—๏ธ Tech Stack ### Frontend - **Framework:** React 19 + TypeScript + Vite 6 - **Styling:** Tailwind CSS v4 + custom design system - **Icons:** Lucide React - **State:** React Context - **UI Components:** Framer Motion, react-router-dom v7 ### Backend - **Framework:** NestJS 11 + TypeScript - **AI Engine:** LangChain + LangGraph (assessment workflow) - **Database:** SQLite (better-sqlite3, metadata) + Elasticsearch 9 (vector + full-text) - **Auth:** JWT + API Key dual mechanism - **Document Processing:** Apache Tika + Vision Pipeline + LibreOffice ### Infrastructure - Docker Compose (Elasticsearch, Tika, LibreOffice) - Nginx reverse proxy (production) --- ## ๐Ÿš€ Quick Start ### Prerequisites - Node.js 18+, Yarn - Docker & Docker Compose ### 1. Install & Start ```bash # Clone and install git clone cd AuraK yarn install # Configuration cp server/.env.sample server/.env # Edit server/.env โ€” set JWT_SECRET, API keys # Start infrastructure (optional โ€” AI features need Elasticsearch) docker-compose up -d elasticsearch tika libreoffice # Start development servers yarn dev # Frontend: http://localhost:13001 # Backend: http://localhost:3001 ``` ### 2. Default Login ``` Username: admin Password: admin123 ``` ### 3. Quick Start (without Docker) ```bash # Start backend (production mode) cd server && node dist/main.js & # Start frontend cd web && npx vite --port 13001 & ``` --- ## ๐Ÿ“– User Guide ### System Setup & User Management ``` ่ทฏๅพ„: ็ณป็ปŸ่ฎพ็ฝฎ โ†’ ็”จๆˆท็ฎก็† ``` 1. **Create Users** โ€” Add users with username, password, display name 2. **Assign Roles** โ€” Click edit on any user โ†’ select USER / TENANT_ADMIN / SUPER_ADMIN 3. **Role Preview** โ€” Each role shows its permission count 4. **Bulk Import/Export** โ€” XLSX import and export ### Permission Management ``` ่ทฏๅพ„: ็ณป็ปŸ่ฎพ็ฝฎ โ†’ ๆƒ้™็ฎก็† ``` 1. **Role List** โ€” Left panel shows all roles (SUPER_ADMIN, TENANT_ADMIN, USER + custom) 2. **Permission Matrix** โ€” Click a role โ†’ toggle individual permissions 3. **Custom Roles** โ€” Create role โ†’ set permissions โ†’ assign to users 4. **System Role Protection** โ€” Built-in roles cannot be modified ### Assessment Setup ``` ่ทฏๅพ„: ็ณป็ปŸ่ฎพ็ฝฎ โ†’ ๆต‹่ฏ„ๆจกๆฟ ``` 1. **Create Template** โ€” Set name, question count, passing score, time limits 2. **Configure Dimensions** โ€” Add/remove dimensions, set weights (e.g., PROMPT:30%, LLM:30%, IDE:20%, DEV_PATTERN:20%) 3. **Link Question Bank** โ€” Create/attach a question bank with published items 4. **AI Generation** โ€” If no bank linked, AI generates questions from knowledge base ### Running an Exam ``` ่ทฏๅพ„: ่€ƒๆ ธ่ฏ„ไผฐ โ†’ ้€‰ๆ‹ฉๆจกๆฟ โ†’ ๅผ€ๅง‹ไธ“ไธš่ฏ„ไผฐ ``` **For Organizers (Admin):** 1. Go to Settings โ†’ User Management โ†’ Create student accounts 2. Tell students their credentials **For Candidates:** 1. Login with credentials 2. Go to Assessment โ†’ Select template โ†’ Start 3. Answer multiple-choice and short-answer questions 4. AI may ask follow-up questions (multi-round dialogue) 5. View results after completion **Viewing Results:** - **History** โ€” Right sidebar on Assessment page shows past attempts - **Details** โ€” Click any history entry to see per-question scores - **Certificate** โ€” Click "ๆŸฅ็œ‹่ฏไนฆ" to view grade and dimension breakdown - **Export** โ€” PDF report and Excel download available ### Tenant Management (SUPER_ADMIN only) ``` ่ทฏๅพ„: ็ณป็ปŸ่ฎพ็ฝฎ โ†’ ็งŸๆˆท็ฎก็† ``` - Create/edit/delete tenants with hierarchical parent-child structure - Manage tenant members: add users, assign roles (USER / TENANT_ADMIN) - Separate knowledge bases and settings per tenant - Data isolation: users in Tenant A cannot see Tenant B's data --- ## ๐Ÿ”„ Key System Flows ### Authentication Flow ``` Password Login โ†’ JWT issued โ†’ API Key generated (stored in localStorage) โ†’ All subsequent requests via x-api-key header โ†’ x-tenant-id header for tenant context ``` ### Question Selection Algorithm ``` Template dimensions (e.g., PROMPT:30, LLM:30, IDE:20, DEV_PATTERN:20) โ†’ floor + remainder allocation (guarantees sum = question count) โ†’ Higher weight dimensions get remainder priority โ†’ Each dimension's pool shuffled independently โ†’ Final result shuffled before return ``` ### Role โ†’ Permission Resolution ``` User โ†’ TenantMember.role (SUPER_ADMIN/TENANT_ADMIN/USER) โ†’ Maps to Role entity via baseRole โ†’ RolePermission table gives permission keys โ†’ Legacy: user.isAdmin = true โ†’ ALL permissions ``` --- ## ๐Ÿงช Testing Playwright test scripts in project root: | Command | Coverage | |---|---| | `node test-systematic.mjs` | **142 tests** โ€” auth, CRUD, RBAC, boundary, UI, user stories | | `node test-e2e-full.mjs` | 94 tests โ€” full E2E with 3 roles | | `node test-user-lifecycle.mjs` | 42 tests โ€” user lifecycle, edge cases | | `node exam-organizer.mjs` | Exam scenario: create students โ†’ take exam โ†’ view results | | `node test-permission-flow.mjs` | 3-role permission boundary verification | | `node test-multiround.mjs` | Multi-round dialogue in assessments | --- ## ๐Ÿ—๏ธ Project Structure ``` AuraK/ โ”œโ”€โ”€ web/ # React frontend โ”‚ โ”œโ”€โ”€ components/ โ”‚ โ”‚ โ”œโ”€โ”€ views/ # Main page components โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ SettingsView.tsx # System settings (users, models, tenants) โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ PermissionSettingsView.tsx # RBAC permission matrix UI โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ AssessmentView.tsx # Assessment flow UI โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ AssessmentTemplateManager.tsx # Template editor โ”‚ โ”‚ โ”œโ”€โ”€ PermissionGate.tsx # Component-level permission gate โ”‚ โ”‚ โ””โ”€โ”€ LoginPage.tsx # Login page โ”‚ โ”œโ”€โ”€ src/ โ”‚ โ”‚ โ”œโ”€โ”€ contexts/AuthContext.tsx # Auth state + tenant switching โ”‚ โ”‚ โ”œโ”€โ”€ hooks/usePermissions.ts # Permissions hook โ”‚ โ”‚ โ”œโ”€โ”€ pages/workspace/ # Route pages โ”‚ โ”‚ โ””โ”€โ”€ services/ # API clients โ”‚ โ””โ”€โ”€ index.tsx # Entry + routing โ”œโ”€โ”€ server/ # NestJS backend โ”‚ โ”œโ”€โ”€ src/ โ”‚ โ”‚ โ”œโ”€โ”€ auth/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ permission/ # RBAC module โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ permission.constants.ts # 26 permission definitions โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ permission.service.ts # Resolution + seed โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ permission.guard.ts # @Permission() guard โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ role.entity.ts # Role entity โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ role-permission.entity.ts # Role โ†” Permission join โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ role.controller.ts # Role CRUD API โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ permission.controller.ts # Permission API โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ roles.guard.ts # @Roles() guard โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ combined-auth.guard.ts # Global auth guard โ”‚ โ”‚ โ”œโ”€โ”€ assessment/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ services/question-bank.service.ts # Question selection algorithm โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ assessment.service.ts # Session management + grading โ”‚ โ”‚ โ”œโ”€โ”€ user/ # User CRUD + controller โ”‚ โ”‚ โ”œโ”€โ”€ tenant/ # Multi-tenant model โ”‚ โ”‚ โ”œโ”€โ”€ admin/ # Admin API โ”‚ โ”‚ โ””โ”€โ”€ super-admin/ # Super admin API โ”‚ โ””โ”€โ”€ dist/ # Compiled output โ”œโ”€โ”€ docker-compose.yml โ””โ”€โ”€ test-*.mjs # Playwright test scripts ``` --- ## ๐Ÿ”ง Configuration Reference ### Server Environment (server/.env) | Variable | Default | Purpose | |---|---|---| | PORT | 3001 | API server port | | DATABASE_PATH | ./data/metadata.db | SQLite file location | | ELASTICSEARCH_HOST | http://127.0.0.1:9200 | Elasticsearch endpoint | | TIKA_HOST | http://127.0.0.1:9998 | Tika text extraction | | LIBREOFFICE_URL | http://127.0.0.1:8100 | Document conversion | | JWT_SECRET | (required) | JWT signing key | | UPLOAD_FILE_PATH | ./uploads | File storage | | MAX_FILE_SIZE | 104857600 | Upload limit | --- ## ๐Ÿ“„ License See [LICENSE](LICENSE) file.