Skip to content

git-adventures/polaris-clone

Repository files navigation

✨ Cursor Clone - AI-Powered Code Editor

Cursor Clone

A production-ready AI-powered code editor and IDE with an intelligent coding agent, in-browser code execution, GitHub integration, and complete subscription management. Built with Next.js 16, CodeMirror 6, WebContainers, multiple AI providers (Claude, Gemini), and Clerk authentication.

Credit: This project is based on the tutorial by Antonio Erdeljac (Code With Antonio)

✨ Features

✏️ CodeMirror 6 Editor

  • 🎨 Syntax Highlighting - Support for JavaScript, TypeScript, HTML, CSS, JSON, Python, Markdown
  • πŸ—ΊοΈ Minimap - Replit-powered code minimap for navigation
  • πŸŒ™ One Dark Theme - Beautiful dark theme out of the box
  • πŸ“ Indentation Markers - Visual indentation guides
  • πŸ“‚ File Explorer - Full project file tree with create, rename, delete operations

πŸ€– AI-Powered Features

  • 🧠 AI Coding Agent - Claude-powered agent with file manipulation tools (read, write, create, delete, rename)
  • ⚑ Quick Edit (Cmd+K) - Edit selected code with AI instructions inline
  • πŸ’‘ Code Suggestions - Real-time AI-powered code suggestions as you type
  • πŸ“ Auto Title Generation - AI-generated conversation titles
  • πŸ“š URL Scraping - Fetch and include web documentation in AI context via Firecrawl
  • πŸ”§ Multi-Tool Agent - AI agent with 7+ tools for file system operations

πŸ’¬ Conversation System

  • πŸ—¨οΈ Chat Interface - Full conversation UI with streaming AI responses
  • πŸ“Ž File Attachments - Attach project files to conversations
  • πŸ”„ Message Streaming - Real-time streaming responses with status tracking
  • 🧩 Rich AI Elements - 50+ specialized components for displaying AI responses (code blocks, reasoning, plans, artifacts)
  • ❌ Cancellable - Cancel in-progress AI responses

▢️ In-Browser Code Execution

  • 🌐 WebContainer Runtime - Run Node.js projects directly in the browser
  • πŸ–₯️ Integrated Terminal - xterm.js terminal with full output streaming
  • πŸ‘οΈ Live Preview - Real-time preview of running applications
  • πŸ”₯ Hot Reload - Automatic reload on file changes
  • βš™οΈ Custom Commands - Configurable install and dev commands per project

πŸ™ GitHub Integration

  • πŸ“₯ Import Repositories - Import GitHub repos into the editor (Pro)
  • πŸ“€ Export to GitHub - Push projects to new GitHub repositories (Pro)
  • πŸ” GitHub OAuth - Secure token-based access via Clerk
  • πŸ“Š Status Tracking - Real-time import/export progress

πŸš€ Core Platform Features

  • πŸ” Clerk Authentication - Google, GitHub, and Email/Password sign-in
  • πŸ’³ Subscription Billing - Pro plan with Clerk organizations
  • ⚑ Background Jobs - Inngest-powered reliable AI agent execution
  • πŸ—„οΈ Real-time Database - Convex for live data sync
  • πŸ› Error Tracking - Sentry integration with LLM monitoring
  • πŸŒ“ Dark/Light Mode - Theme switching with next-themes
  • πŸ“ Resizable Panels - Allotment-powered split pane layout

πŸ’Ž Pro Subscription Benefits

  • πŸ™ GitHub repository import
  • πŸ“€ GitHub repository export
  • ✨ Full AI agent capabilities
  • πŸ“Š Priority support

πŸ› οΈ Tech Stack

Frontend

Backend & Database

AI & Integrations

Code Execution & GitHub

Authentication & Payments

Development & Monitoring

  • Sentry - Error tracking with LLM monitoring
  • Zod - Schema validation
  • Sonner - Toast notifications

πŸ“‹ Prerequisites

Before you begin, ensure you have:

  • Node.js (v18 or higher)
  • npm, yarn, pnpm, or bun
  • Git
  • Accounts for:

πŸš€ Getting Started

1. Clone the repository

git clone https://github.com/git-adventures/polaris-clone.git
cd polaris-clone

2. Install dependencies

npm install
# or
bun install

3. Setup Environment Variables

Create a .env.local file in the root directory:

# Clerk (Authentication)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
CLERK_JWT_ISSUER_DOMAIN=your_clerk_jwt_issuer_domain

# Convex (Database)
CONVEX_DEPLOYMENT=your_convex_deployment
NEXT_PUBLIC_CONVEX_URL=your_convex_url
NEXT_PUBLIC_CONVEX_SITE_URL=your_convex_site_url
POLARIS_CONVEX_INTERNAL_KEY=your_convex_internal_key

# AI Providers
ANTHROPIC_API_KEY=your_anthropic_api_key
GOOGLE_GENERATIVE_AI_API_KEY=your_google_ai_api_key

# Model Selection (optional)
TITLE_GENERATOR_MODEL=claude-3-5-haiku-20241022
CODING_AGENT_MODEL=claude-haiku-4-5-20251001

# Firecrawl (Web Scraping)
FIRECRAWL_API_KEY=your_firecrawl_api_key

# Sentry (Error Tracking)
SENTRY_AUTH_TOKEN=your_sentry_auth_token

# App Configuration
NEXT_PUBLIC_APP_URL=http://localhost:3000

4. Setup Convex Database

# Start the Convex dev server
npx convex dev

5. Setup Inngest (for local development)

# Run Inngest dev server in a separate terminal
npx --ignore-scripts=false inngest-cli@latest dev

6. Start the development server

npm run dev
# or
bun run dev

Open http://localhost:3000 in your browser.

πŸ“¦ Available Scripts

Command Description
npm run dev Start development server
npm run build Build for production
npm start Start production server
npm run lint Run ESLint

πŸ”§ Troubleshooting

Database Issues

  • Ensure Convex dev server is running (npx convex dev)
  • Check Convex dashboard for deployment status
  • Verify NEXT_PUBLIC_CONVEX_URL is set correctly

Inngest Issues

  • Make sure Inngest dev server is running
  • Check Inngest dashboard for function logs
  • Verify NEXT_PUBLIC_APP_URL is set correctly

Authentication Issues

  • Verify Clerk API keys are correct
  • Check OAuth callback URLs in Clerk dashboard
  • Ensure CLERK_JWT_ISSUER_DOMAIN matches your Clerk instance

WebContainer Issues

  • WebContainers require specific browser headers (COOP/COEP)
  • Ensure you're using a Chromium-based browser for best compatibility
  • Check browser console for WebContainer boot errors

GitHub Integration Issues

  • Ensure GitHub OAuth is configured in Clerk
  • Pro plan is required for import/export features
  • Check GitHub token permissions

πŸ“š Resources

πŸ™ Acknowledgments


⭐ If you found this project helpful, please give it a star!

πŸ“š Resources:

Releases

No releases published

Packages

 
 
 

Contributors

Languages