Skip to main content
This guide provides an overview of the Claude Code Templates project architecture, including the CLI tool, component system, website, and infrastructure.

Project Structure

CLI Tool Architecture

Main Entry Point

Location: cli-tool/src/index.js The CLI tool is a Node.js application that:
  1. Parses command-line arguments using commander
  2. Fetches component files from GitHub
  3. Installs components to the user’s project
  4. Tracks downloads via API
  5. Provides interactive installation mode

Installation Flow

Component System

Component Types

Agents (cli-tool/components/agents/)
  • Format: Markdown with YAML frontmatter
  • Installation: .claude/agents/{name}.md
  • Purpose: AI specialists for specific domains
Commands (cli-tool/components/commands/)
  • Format: Markdown with YAML frontmatter
  • Installation: .claude/commands/{name}.md
  • Purpose: Custom slash commands for workflows
MCPs (cli-tool/components/mcps/)
  • Format: JSON
  • Installation: .mcp.json (merged)
  • Purpose: External service integrations
Settings (cli-tool/components/settings/)
  • Format: JSON
  • Installation: .claude/settings.json (merged)
  • Purpose: Claude Code configuration
Hooks (cli-tool/components/hooks/)
  • Format: JSON + optional scripts
  • Installation: .claude/settings.json + .claude/hooks/
  • Purpose: Automation triggers for events
Skills (cli-tool/components/skills/)
  • Format: Markdown + references + scripts
  • Installation: .claude/skills/{name}/
  • Purpose: Modular capabilities (Anthropic format)

Component Categories

Components are organized by category:

Analytics Dashboard

Location: cli-tool/src/analytics/ Real-time monitoring dashboard for Claude Code sessions.

Architecture

Features

  • Real-time conversation monitoring
  • State detection (active, idle, stopped)
  • Process detection (running commands)
  • Performance metrics
  • WebSocket-based live updates
  • Multi-level caching for performance

Usage

Website Architecture

Location: docs/ Static website at aitmpl.com for browsing components.

Data Flow

  1. Component Scanning: scripts/generate_components_json.py scans cli-tool/components/
  2. Catalog Generation: Generates docs/components.json with embedded content
  3. Website Loading: Browser loads JSON and renders component cards
  4. Download Tracking: Installation tracked via /api/track-download-supabase

Component Catalog Format

API Architecture

Location: api/ Vercel Serverless Functions for backend operations.

Critical Endpoints

/api/track-download-supabase
  • Tracks component downloads for analytics
  • Used by CLI on every installation
  • Database: Supabase (component_downloads table)
/api/discord/interactions
  • Discord bot slash commands
  • Features: /search, /info, /install, /popular
/api/claude-code-check
  • Monitors Claude Code releases
  • Vercel Cron: every 30 minutes
  • Database: Neon (version tracking)

Dashboard Architecture

Location: dashboard/ Astro + React + Tailwind dashboard at app.aitmpl.com.

Architecture

  • Framework: Astro 5 with React islands
  • Auth: Clerk (user collections)
  • Styling: Tailwind v4
  • Data: Fetches from https://www.aitmpl.com/components.json
  • API Proxy: Proxies to main site API

Directory Structure

Cloudflare Workers

Location: cloudflare-workers/ Independent serverless functions on Cloudflare.

docs-monitor

Monitors code.claude.com/docs for changes:
  • Runs every hour
  • Sends Telegram notifications
  • Tracks documentation updates

pulse

Weekly KPI reports:
  • Runs Sundays at 14:00 UTC
  • Collects metrics from multiple sources:
    • GitHub (stars, forks, commits)
    • Discord (members, messages)
    • Supabase (downloads)
    • Vercel (deployments)
    • Google Analytics (traffic)
  • Sends consolidated Telegram report

Deployment Architecture

Vercel Projects

Two separate Vercel projects:

CI/CD Pipeline

GitHub Actions (.github/workflows/deploy.yml):
  • Changes in docs/, api/, or vercel.json → Deploy main site
  • Changes in dashboard/ → Deploy dashboard
  • Auto-deploy on push to main branch

Deployment Commands

Always use the deployer agent (.claude/agents/deployer.md) for deployments. It runs pre-deploy checks and handles the pipeline safely.

Database Architecture

Supabase

Purpose: Download tracking and analytics Tables:
  • component_downloads - Track component installations
    • id, component_type, component_name, component_category
    • installed_at, user_id, project_id

Neon (PostgreSQL)

Purpose: Claude Code release monitoring Tables:
  • claude_code_versions - Version history
  • claude_code_changes - Change tracking
  • discord_notifications_log - Notification history
  • monitoring_metadata - Monitoring state

Security Architecture

Environment Variables

All secrets stored in environment variables:
NEVER hardcode secrets in code. Always use environment variables. See Code Standards for details.

Path Security

  • Use relative paths only
  • No absolute paths in components
  • No hardcoded home directories
  • Use $CLAUDE_PROJECT_DIR for dynamic paths

Performance Considerations

Component Catalog

  • Generated catalog is ~2MB (compressed)
  • Loaded once and cached in browser
  • Components filtered client-side for speed

Analytics Dashboard

  • Multi-level caching (memory + disk)
  • WebSocket for real-time updates (not polling)
  • Efficient file watching (chokidar)
  • Performance monitoring built-in

API Endpoints

  • Serverless functions (fast cold starts)
  • Database connection pooling
  • Response caching where appropriate

Monitoring and Observability

Vercel Logs

Health Checks

  • Analytics dashboard: GET /api/health
  • API endpoints: Built-in error logging
  • Cloudflare Workers: Error tracking

Metrics Tracking

  • Component downloads (Supabase)
  • Website traffic (Google Analytics)
  • API usage (Vercel analytics)
  • GitHub activity (pulse worker)

Next Steps

Component Guidelines

Best practices for creating components

Code Standards

Coding conventions and style guide

Testing Workflow

How to test your contributions

Publishing Workflow

Complete publishing process