Skip to content

Latest commit

Β 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ClaudeUI

A modern, local web-based chat interface for Claude CLI that mimics the Claude.ai website experience with real-time streaming, conversation history, and admin monitoring capabilities.

License Node TypeScript

✨ Features

  • 🎨 Modern Chat Interface - Clean, responsive UI mimicking Claude.ai
  • πŸ’¬ Real-Time Streaming - Live message streaming via Socket.IO
  • πŸ“ Rich Markdown Support - Full markdown rendering with syntax highlighting
  • πŸ’Ύ Conversation Persistence - SQLite database for chat history
  • πŸ“Š Admin Panel - Monitor CLI calls, performance metrics, and audit trails
  • πŸ”„ Conversation Management - Switch between conversations, view history
  • βš™οΈ Settings Panel - Manage API keys and configuration
  • πŸ—‘οΈ Soft/Hard Delete - Flexible conversation deletion options
  • 🎯 TypeScript - Full type safety for better development experience

πŸ—οΈ Architecture

Three-Layer Communication Model

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Frontend (React + TypeScript + Vite)                   β”‚
β”‚  - Chat UI with Socket.IO client                        β”‚
β”‚  - Markdown rendering & syntax highlighting             β”‚
β”‚  - Conversation management                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ Socket.IO (Port 5173 β†’ 3001)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Backend (Node.js + Express + Socket.IO)                β”‚
β”‚  - Real-time communication server                       β”‚
β”‚  - REST API endpoints                                   β”‚
β”‚  - Claude CLI process management                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚ Child Process
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Claude CLI                                             β”‚
β”‚  - Executed as child processes                          β”‚
β”‚  - Handles user requests                                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ Prerequisites

  • Node.js v16 or higher
  • Claude CLI installed and configured
    • Must be available in system PATH
    • Must be configured with valid API credentials

πŸš€ Quick Start

Installation

# Clone the repository
git clone <repository-url>
cd ClaudeUI

# Navigate to the claude-ui directory
cd claude-ui

# Install frontend dependencies
npm install

# Install backend dependencies
cd server
npm install
cd ..

Running the Application

You must run both processes simultaneously in separate terminals:

Terminal 1 - Backend Server

cd claude-ui/server
npm start

Backend server starts on http://localhost:3001

Terminal 2 - Frontend Development Server

cd claude-ui
npm run dev

Frontend starts on http://localhost:5173

πŸŽ‰ Access the application at http://localhost:5173

πŸ“ Project Structure

ClaudeUI/
β”œβ”€β”€ claude-ui/                  # Main application directory
β”‚   β”œβ”€β”€ src/                    # Frontend source files
β”‚   β”‚   β”œβ”€β”€ App.tsx             # Main chat interface
β”‚   β”‚   β”œβ”€β”€ Admin.tsx           # Admin panel
β”‚   β”‚   β”œβ”€β”€ App.css             # Styles
β”‚   β”‚   └── main.tsx            # Entry point
β”‚   β”œβ”€β”€ server/                 # Backend server
β”‚   β”‚   β”œβ”€β”€ index.js            # Express + Socket.IO server
β”‚   β”‚   β”œβ”€β”€ database.js         # SQLite database layer
β”‚   β”‚   └── claude-cli.db       # SQLite database (created at runtime)
β”‚   β”œβ”€β”€ tests/                  # Playwright tests
β”‚   β”œβ”€β”€ index.html              # HTML entry point
β”‚   β”œβ”€β”€ package.json            # Frontend dependencies
β”‚   └── vite.config.ts          # Vite configuration
β”œβ”€β”€ CLAUDE.md                   # Claude Code instructions
└── README.md                   # This file

πŸ› οΈ Development

Build Commands

# Build for production
npm run build

# Run linter
npm run lint

# Preview production build
npm preview

Testing

# Run Playwright tests
cd claude-ui/tests
npx playwright test

πŸ—„οΈ Database Schema

The application uses SQLite with three main tables stored in server/claude-cli.db:

conversations

Stores chat sessions with title and timestamps

  • id (INTEGER PRIMARY KEY)
  • title (TEXT)
  • created_at (DATETIME)
  • deleted_at (DATETIME)

messages

Stores individual messages linked to conversations

  • id (INTEGER PRIMARY KEY)
  • conversation_id (INTEGER)
  • role (TEXT) - 'user' or 'assistant'
  • content (TEXT)
  • created_at (DATETIME)

cli_calls

Audit log of all Claude CLI executions

  • id (INTEGER PRIMARY KEY)
  • conversation_id (INTEGER)
  • command (TEXT)
  • user_message (TEXT)
  • response (TEXT)
  • error (TEXT)
  • duration_ms (INTEGER)
  • exit_code (INTEGER)
  • success (BOOLEAN)
  • created_at (DATETIME)

πŸ”§ Configuration

Port Configuration

  • Backend: Port 3001 (configurable in server/index.js:225)
  • Frontend: Port 5173 (Vite default, configurable in vite.config.ts)

⚠️ Important: When changing backend port, update Socket.IO connection URL in src/App.tsx:43

CORS Configuration

CORS is configured in server/index.js for development. Adjust origins as needed for production deployment.

πŸ“¦ Tech Stack

Frontend

  • React 19.1.1 - UI framework
  • TypeScript 5.8.3 - Type safety
  • Vite 7.1.7 - Build tool and dev server
  • Socket.IO Client 4.8.1 - Real-time communication
  • react-markdown 10.1.0 - Markdown rendering
  • react-syntax-highlighter 15.6.6 - Code syntax highlighting
  • Axios 1.12.2 - HTTP client

Backend

  • Node.js - Runtime environment
  • Express 5.1.0 - Web server framework
  • Socket.IO 4.8.1 - Real-time bidirectional communication
  • better-sqlite3 12.4.1 - SQLite database
  • CORS 2.8.5 - Cross-origin resource sharing

πŸ› Troubleshooting

Common Issues

Issue Solution
"Disconnected" status Backend server not running on port 3001. Start the backend server.
"Failed to start Claude CLI" Claude CLI not in PATH or not configured. Verify installation with claude --version
Port conflicts Change ports in both backend server and frontend Socket.IO connection URL
Database errors Ensure the server directory is writable for SQLite database creation
CORS issues Check CORS configuration in server/index.js if accessing from different origins

Verifying Claude CLI Installation

# Check if Claude CLI is installed
claude --version

# Test Claude CLI
claude chat

πŸ“„ License

MIT

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“§ Support

For issues and questions, please open an issue in the GitHub repository.


Built with ❀️ using React, TypeScript, Node.js, and Claude CLI

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages