README.md 3.9 KB

AuraK V2 โ€” Frontend (web)

A modern multi-tenant knowledge base and AI assistant platform built with React 19, Vite, and Tailwind CSS.

๐Ÿ—๏ธ Architecture

The frontend uses React Router for navigation with a clean role-based routing structure:

Route Access Description
/login Public Password or API Key sign-in
/ All users Workspace overview
/chat All users AI Chat with scope selection
/knowledge All users Document (Knowledge Base) management
/notebooks All users Notebooks and notes
/settings All users Model and app settings
/admin TENANT_ADMIN+ Team management, share approvals
/admin/tenants SUPER_ADMIN Global tenant management
/admin/models TENANT_ADMIN+ Model configuration

๐Ÿ” Authentication

The app supports two login methods:

  1. Password login โ€” POST to /api/v1/auth/login, receives an apiKey back
  2. Direct API Key โ€” paste the API key directly

All API calls include x-api-key: <key> in the request headers automatically via services/apiClient.ts.

๐Ÿ› ๏ธ Tech Stack

  • React 19 + TypeScript
  • Vite (dev server + build)
  • TailwindCSS v3 (styling)
  • React Router v6 (routing)
  • framer-motion (animations)
  • Lucide React (icons)
  • clsx + tailwind-merge (cn() utility)

๐Ÿš€ Quick Start

1. Install dependencies

cd web
yarn install

2. Configure environment

Copy .env.example to .env and set the backend URL if needed:

VITE_API_BASE_URL=http://localhost:13000

The Vite dev server proxies /api/* to http://localhost:13000 by default (see vite.config.ts).

3. Start the dev server

yarn dev
# โ†’ http://localhost:13001

4. Build for production

yarn build
# Output: dist/

๐Ÿ“ Project Structure

web/
โ”œโ”€โ”€ index.tsx              # App root โ€” BrowserRouter + all routes
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ contexts/
โ”‚   โ”‚   โ””โ”€โ”€ AuthContext.tsx        # User auth state (apiKey, user, role)
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ””โ”€โ”€ layouts/
โ”‚   โ”‚       โ”œโ”€โ”€ WorkspaceLayout.tsx  # Sidebar + header for main workspace
โ”‚   โ”‚       โ””โ”€โ”€ AdminLayout.tsx      # Admin console layout
โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ”œโ”€โ”€ auth/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Login.tsx            # Dual-mode login (password + API key)
โ”‚   โ”‚   โ”œโ”€โ”€ workspace/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ChatPage.tsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ KnowledgePage.tsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ NotebooksPage.tsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ SettingsPage.tsx
โ”‚   โ”‚   โ””โ”€โ”€ admin/
โ”‚   โ”‚       โ”œโ”€โ”€ SuperAdminPage.tsx   # Tenant management (SUPER_ADMIN)
โ”‚   โ”‚       โ””โ”€โ”€ TenantAdminPage.tsx  # Team management (TENANT_ADMIN)
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ””โ”€โ”€ cn.ts                    # clsx + twMerge helper
โ”œโ”€โ”€ components/            # Legacy rich view components (still used)
โ”‚   โ””โ”€โ”€ views/
โ”‚       โ”œโ”€โ”€ ChatView.tsx
โ”‚       โ”œโ”€โ”€ KnowledgeBaseView.tsx
โ”‚       โ”œโ”€โ”€ NotebooksView.tsx
โ”‚       โ””โ”€โ”€ SettingsView.tsx
โ””โ”€โ”€ services/              # API service layer
    โ”œโ”€โ”€ apiClient.ts       # Base HTTP client (auto-injects x-api-key)
    โ”œโ”€โ”€ chatService.ts     # Streaming chat
    โ”œโ”€โ”€ knowledgeBaseService.ts
    โ””โ”€โ”€ ...

๐Ÿ”‘ Default Credentials (Development)

After running the backend migration, a default super admin is seeded:

  • Email: admin@system.local
  • Password: admin123

The /api/v1/auth/api-key endpoint returns your API key after login.

โš ๏ธ Troubleshooting

  • 401 errors: Your session expired. You will be redirected to /login automatically.
  • Upload fails: Ensure the backend is running and the uploads/ directory is writable.
  • No AI response: Configure at least one LLM model in /settings or /admin/models.