Skip to content

AutumnsGrove/ClaudeLocal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

50 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ClaudeLocal πŸ€–

A fully functional, feature-complete local clone of Claude.ai that runs entirely on your machine.

ClaudeLocal TypeScript Prisma Anthropic

✨ Features

Chat & Messaging

  • βœ… Real-time streaming responses with Server-Sent Events (SSE)
  • βœ… All Claude 4 models (Sonnet 4.5, Opus 4.1, Opus 4, Sonnet 4) + Claude 3.5 & 3
  • βœ… Prompt caching for 90% cost reduction on repeated context
  • βœ… Markdown rendering with GitHub Flavored Markdown support
  • βœ… Syntax highlighting for 15+ programming languages
  • βœ… Code copy buttons with one-click copying
  • βœ… Auto-scrolling message list

Organization

  • βœ… Projects with custom instructions and knowledge base
  • βœ… Conversation management (create, rename, archive, delete)
  • βœ… Search & filter conversations
  • βœ… Date grouping (Today, Yesterday, Last 7 days, Older)
  • βœ… Project filtering to organize chats

File Handling

  • βœ… PDF viewer with zoom and page navigation
  • βœ… Image preview with zoom and lightbox mode
  • βœ… Markdown preview with live rendering
  • βœ… Code file syntax highlighting
  • βœ… File attachments (coming soon)

UI/UX

  • βœ… Dark/light theme toggle
  • βœ… Responsive design (desktop and mobile)
  • βœ… Collapsible sidebar with persistent state
  • βœ… Toast notifications for user feedback
  • βœ… Loading states and error handling

πŸ› οΈ Tech Stack

Category Technology
Framework Next.js 15 (App Router)
Language TypeScript 5.7
Styling Tailwind CSS 3.4
Database SQLite with Prisma ORM
AI Anthropic SDK + Claude API
UI Components Shadcn UI (Radix UI primitives)
State Management React Hooks
Markdown react-markdown + remark-gfm
Code Highlighting Prism.js
PDF Rendering pdfjs-dist

πŸš€ Quick Start

Prerequisites

  • Node.js 18.0 or higher
  • npm (comes with Node.js)
  • Anthropic API Key (Get one here)

Installation

# 1. Navigate to the project
cd /Users/mini/Documents/projects/ClaudeLocal

# 2. Install dependencies (already done if coming from setup)
npm install

# 3. Create your secrets file
cp secrets_template.json secrets.json

# 4. Edit secrets.json and add your API key
# {
#   "anthropic_api_key": "sk-ant-api03-YOUR-KEY-HERE"
# }

# 5. Initialize database (already done if coming from setup)
npx prisma db push

# 6. Start the development server
npm run dev

# 7. Open http://localhost:3000

πŸ“– For detailed setup instructions, see SETUP.md

πŸ’° Prompt Caching - Automatic Cost Optimization

ClaudeLocal automatically implements Anthropic's Prompt Caching to save you up to 90% on API costs:

  • πŸš€ Conversation history cached automatically
  • πŸ“ Project instructions cached across all project conversations
  • ⏱️ 5-minute cache TTL - perfect for active conversations
  • πŸ’΅ Huge savings - 20-message conversation costs ~80% less
  • πŸ”§ Zero configuration - works automatically out of the box

Example: A 10-message conversation that would normally cost $0.15 now costs ~$0.03!

See PROMPT_CACHING.md for technical details.

πŸ“ Project Structure

ClaudeLocal/
β”œβ”€β”€ app/                    # Next.js App Router
β”‚   β”œβ”€β”€ api/               # API Routes
β”‚   β”‚   β”œβ”€β”€ chat/         # Streaming chat endpoint
β”‚   β”‚   β”œβ”€β”€ conversations/ # Conversation CRUD
β”‚   β”‚   β”œβ”€β”€ models/       # Model listing
β”‚   β”‚   └── projects/     # Project management
β”‚   β”œβ”€β”€ layout.tsx        # Root layout
β”‚   β”œβ”€β”€ page.tsx          # Home page
β”‚   └── globals.css       # Global styles
β”œβ”€β”€ components/            # React Components
β”‚   β”œβ”€β”€ chat/             # Chat UI (MessageList, MessageInput, MessageBubble)
β”‚   β”œβ”€β”€ sidebar/          # Sidebar (ConversationList, ProjectSelector)
β”‚   β”œβ”€β”€ preview/          # File previews (PDF, Image, Markdown, Code)
β”‚   β”œβ”€β”€ model/            # Model picker
β”‚   └── ui/               # Shadcn UI base components
β”œβ”€β”€ lib/                  # Utilities
β”‚   β”œβ”€β”€ db.ts            # Prisma client singleton
β”‚   β”œβ”€β”€ secrets.ts       # API key management
β”‚   └── utils.ts         # Helper functions (cn, etc.)
β”œβ”€β”€ prisma/              # Database
β”‚   β”œβ”€β”€ schema.prisma    # Database schema
β”‚   └── dev.db           # SQLite database file
β”œβ”€β”€ types/               # TypeScript Types
β”‚   └── index.ts         # Shared type definitions
β”œβ”€β”€ public/uploads/      # File uploads storage
β”œβ”€β”€ secrets.json         # API keys (create from template)
└── secrets_template.json # Template for secrets

πŸ“ Available Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm run start        # Start production server
npm run lint         # Run ESLint
npm run db:push      # Sync database with schema
npm run db:studio    # Open Prisma Studio (database GUI)
npm run db:migrate   # Create database migration
npm run db:generate  # Generate Prisma Client

🎯 Usage

Starting a Chat

  1. Open http://localhost:3000
  2. Click "New Chat" button in the sidebar
  3. Select a Claude model from the dropdown
  4. Type your message and press Enter to send

Managing Conversations

  • Rename: Hover over a conversation β†’ Click β‹― β†’ Rename
  • Archive: Hover over a conversation β†’ Click β‹― β†’ Archive
  • Delete: Hover over a conversation β†’ Click β‹― β†’ Delete
  • Search: Use the search box in the sidebar to filter conversations

Using Projects

  1. Create a new project (Projects feature in sidebar)
  2. Add custom instructions for the project
  3. Upload knowledge base files (PDF, markdown, code)
  4. Start conversations within the project context

Keyboard Shortcuts

  • Enter - Send message
  • Shift+Enter - New line in message
  • Ctrl/Cmd+K - Focus search (coming soon)
  • Ctrl/Cmd+N - New chat (coming soon)

πŸ”§ Configuration

Changing Models

Edit the CLAUDE_MODELS array in types/index.ts to add/remove models.

Database Schema Changes

  1. Edit prisma/schema.prisma
  2. Run npx prisma db push to apply changes
  3. Run npx prisma generate to update the client

Custom Themes

Edit the CSS variables in app/globals.css under :root and .dark selectors.

πŸ› Troubleshooting

See SETUP.md for common issues and solutions.

πŸ”’ Security

  • βœ… API keys stored in secrets.json (gitignored)
  • βœ… All sensitive operations server-side only
  • βœ… SQLite database local to your machine
  • βœ… No data leaves your system except API calls to Anthropic
  • βœ… File uploads stored locally in public/uploads/

🀝 Contributing

This is a personal project template. Feel free to fork and customize for your own use!

πŸ“„ License

MIT


Built with Claude Code by Anthropic πŸ€–

About

Local Claude Desktop with API keys

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors