Skip to main content

Choose your setup method

Claude Analytics offers two ways to get started:
  • Local mode — Run the development server and automatically load your ~/.claude/ data
  • Hosted mode — Export your data and upload it to the hosted version for client-side processing
Both modes are completely privacy-focused. Local mode gives you direct filesystem access, while hosted mode processes everything client-side in your browser.
Local mode reads your Claude Code data directly from ~/.claude/ and provides the most seamless experience.
1

Clone the repository

Clone the repository and navigate to the project directory:
git clone https://github.com/1shanpanta/claude-analytics.git
cd claude-analytics
2

Install dependencies

Install the required packages using npm or bun:
npm install
The project uses bun as the default package manager, but npm and yarn also work.
3

Start the development server

Run the development server:
npm run dev
The application will start at http://localhost:3000 and automatically load your ~/.claude/ data.
4

Explore your analytics

Open your browser and navigate to http://localhost:3000. You’ll see:
  • Activity heatmap showing daily message activity
  • Session explorer with expandable message threads
  • Model breakdown with token usage and costs
  • Tool usage charts and statistics
  • Searchable prompt history
Your dashboard is now running! All data is loaded from your local ~/.claude/ directory.

Hosted mode

Hosted mode lets you use Claude Analytics without running a local server. Export your data and upload it to the hosted version.
1

Clone the repository

You only need to clone the repository to access the export script:
git clone https://github.com/1shanpanta/claude-analytics.git
cd claude-analytics
No installation required for the export script — it uses only Node.js built-ins.
2

Export your data

Run the export script to generate a JSON file with your Claude Code data:
node scripts/export.mjs
The script will:
  1. Read ~/.claude/stats-cache.json for aggregated statistics
  2. Collect all session metadata from ~/.claude/usage-data/session-meta/*.json
  3. Parse ~/.claude/history.jsonl for prompt history
  4. Extract account information from ~/.claude/statsig/
  5. Include project memory files from ~/.claude/projects/*/memory/*.md
You’ll see output showing what data was found:
Claude Code Analytics — Data Export

  stats-cache.json ✓
  session-meta/ ✓ (42 sessions)
  history.jsonl ✓ (156 entries)
  account info ✓ (a1b2c3d4...)
  memories ✓ (8 files across 3 projects)

Exported to: /path/to/claude-analytics-export.json (2.3 MB)
Upload this file at: https://claude-analytics.vercel.app
3

Upload to the hosted version

Visit the hosted application and drag-and-drop the generated claude-analytics-export.json file.
While the file is uploaded to your browser, all processing happens client-side. No data is sent to any server.
The dashboard will load with all your data, providing the same features as local mode.
4

Switch between profiles (optional)

You can upload multiple export files to compare different accounts or time periods:
  1. Click the profile switcher in the top navigation
  2. Upload additional export files
  3. Switch between profiles to compare analytics
Each profile maintains its own data and state. You can analyze multiple accounts side-by-side.

Available npm scripts

The package.json includes several useful scripts:
package.json
{
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "eslint",
    "export-data": "node scripts/export.mjs"
  }
}
  • npm run dev — Start the development server with hot reload
  • npm run build — Build the production application
  • npm run start — Start the production server
  • npm run export-data — Export your Claude Code data to JSON
  • npm run lint — Run ESLint on the codebase
Use npm run export-data as a shortcut instead of node scripts/export.mjs.

What data is included?

The export script collects comprehensive data from your ~/.claude/ directory:
Aggregated statistics from stats-cache.json:
  • Total sessions and messages
  • Daily activity and token usage
  • Model usage breakdown with costs
  • Hour-by-hour session distribution
  • Longest session metadata
Individual session files from usage-data/session-meta/*.json:
  • Session ID and project path
  • Start time and duration
  • Message counts (user and assistant)
  • Tool usage and language statistics
  • Git commits and pushes
  • Token usage (input and output)
  • Lines added/removed and files modified
Complete prompt log from history.jsonl:
  • Display text of each prompt
  • Timestamp and project association
  • Pasted contents and attachments
Account details from statsig/ cache:
  • Account UUID
  • Organization UUID (if applicable)
Memory files from projects/*/memory/*.md:
  • Project-specific context
  • Memory file contents (truncated to 5000 characters)

Next steps

Explore features

Learn about all the analytics features available in the dashboard

Setup guides

Detailed setup instructions for both local and hosted modes

Understanding data

Deep dive into Claude Code’s data structure and how it’s used

Privacy & security

Learn about Claude Analytics’ privacy-first architecture

Build docs developers (and LLMs) love