Self-Hosting Guide
This guide covers installing and running Polaris locally or on your own infrastructure. Perfect for developers who want full control over their IDE environment.Prerequisites
Before you begin, ensure you have:System Requirements
- Node.js: Version 20.09 or higher
- Package Manager: npm or pnpm
- Terminal: Access to run multiple simultaneous processes
- Git: For cloning the repository
Required Services
You’ll need accounts for these services:*You need either Anthropic (Claude) or Google AI Studio (Gemini), not both. Claude Sonnet 4 is recommended for best results, but Gemini 2.0 Flash works great on the free tier.
Installation Steps
Clone the Repository
Clone the Polaris repository from GitHub:
The repository includes:
- Full source code with TypeScript
- Convex schema and functions
- Pre-configured Next.js setup
- shadcn/ui components
Set Up Environment Variables
Create your environment configuration file:Add the following variables:
Configure Clerk
Set up authentication:
- Create a new application at clerk.com
- Enable GitHub OAuth in Settings → Authentication
- Copy your publishable and secret keys to
.env.local - Add your local URL to allowed origins:
- Development:
http://localhost:3000
- Development:
Clerk handles authentication in the app with protected routes:
Configure Convex
Set up your real-time database:
- Create a project at convex.dev
- Copy your deployment URL to
.env.local - The database schema includes:
Configure AI Provider
Choose and set up your AI provider:
Option A: Anthropic Claude (Recommended)
Best for production use with superior code understanding:- Sign up at anthropic.com
- Create an API key
- Add to
.env.local:ANTHROPIC_API_KEY=sk-ant-... - Model used:
claude-3-7-sonnet-20250219
Option B: Google Gemini (Free Tier)
Perfect for development and learning:- Visit aistudio.google.com
- Generate an API key
- Add to
.env.local:GOOGLE_GENERATIVE_AI_API_KEY=... - Model used:
gemini-2.0-flash-exp
The AI provider is automatically detected based on which key is present. Anthropic takes priority if both are set.
Running Polaris
Polaris requires three separate processes running simultaneously. Open three terminal windows:Terminal 1: Convex Development Server
Starts the real-time database with live reloading:The Convex dev server:
- Syncs your schema and functions automatically
- Provides a dashboard at the URL shown
- Hot-reloads on file changes in
convex/
Terminal 2: Next.js Development Server
Starts the web application:Terminal 3: Inngest Development Server
Starts the background job processor:Inngest handles:
- Long-running AI conversations
- GitHub import/export jobs (Part 2)
- Async file processing
- Background tasks without blocking the UI
Verifying Your Installation
Check Authentication
Visit
http://localhost:3000 and click “Sign in with GitHub”. You should be redirected to Clerk’s OAuth flow.If this fails, verify:- Clerk keys in
.env.localare correct - GitHub OAuth is enabled in Clerk dashboard
http://localhost:3000is in allowed origins
Create a Test Project
After signing in, click “New Project” and enter a prompt. If the project creates successfully, Convex is working.Check the Convex dashboard to see your project record:
Test AI Suggestions
Create a new file (e.g., After 300ms, you should see ghost text suggesting the completion. If suggestions don’t appear:
test.js) and start typing:- Check browser console for errors (F12)
- Verify your AI API key in
.env.local - Confirm the API key has sufficient credits
- Check the Next.js terminal for API errors
Production Deployment
Deployment Checklist
Deploy to Vercel
Deploy to Vercel (recommended) or your hosting provider:Add all environment variables in Vercel dashboard:
- Settings → Environment Variables
- Add each variable from
.env.local
Configure Inngest
Update Inngest to point to your production URL:
- Go to Inngest dashboard
- Add your production URL:
https://your-domain.com/api/inngest - Verify the webhook connection succeeds
Customization
Change AI Model
Edit the API routes to use different models:claude-3-7-sonnet-20250219(recommended)claude-3-5-sonnet-20241022claude-3-opus-20240229
gemini-2.0-flash-exp(free tier)gemini-1.5-pro-latest
Adjust Suggestion Debounce
Change how quickly suggestions appear:Customize Editor Theme
Modify the CodeMirror theme:Troubleshooting
Convex connection errors
Convex connection errors
Symptoms:
Failed to connect to deployment errorsSolutions:- Ensure
npx convex devis running - Check
NEXT_PUBLIC_CONVEX_URLmatches the terminal output - Verify network connectivity
- Try
npx convex dev --onceto resync
Inngest webhook failures
Inngest webhook failures
Symptoms: Background jobs not processing, conversation messages stuckSolutions:
- Confirm
npx inngest-cli devis running - Check Inngest dashboard at
http://localhost:8288 - Verify Next.js dev server is running on port 3000
- Look for errors at
/api/inngestendpoint
AI API rate limits
AI API rate limits
Symptoms: “Rate limit exceeded” errorsSolutions:
- Check your API provider’s dashboard for limits
- Add billing information to increase limits
- Switch to Google Gemini for unlimited free tier
- Increase
DEBOUNCE_DELAYto reduce requests
Authentication redirects fail
Authentication redirects fail
Symptoms: Infinite redirect loops, 401 errorsSolutions:
- Clear browser cookies for
localhost:3000 - Verify Clerk environment variables
- Check Clerk dashboard for error logs
- Ensure GitHub OAuth app is approved
File upload/storage errors
File upload/storage errors
Symptoms: Binary files fail to uploadSolutions:
- Files under 5MB are stored in Convex directly
- Larger files use Convex Storage (check quota)
- Binary detection uses
isbinaryfilepackage - Check Convex dashboard → Files tab
Project Structure
Understanding the codebase:Additional Resources
YouTube Tutorial
Watch the full tutorial series building Polaris
GitHub Repository
Source code, issues, and discussions
Convex Docs
Learn about the real-time database
CodeMirror Guide
Customize the editor with extensions
Getting Help
If you encounter issues:- Check the GitHub Issues
- Review the YouTube tutorial for visual walkthrough
- Ask in GitHub Discussions
- Verify all three processes (Convex, Next.js, Inngest) are running
What’s Next?
Part 2 Coming Soon: The next tutorial chapter will add:
- AI Agent with file modification tools
- WebContainer for in-browser code execution
- Terminal integration with xterm.js
- GitHub repository import/export
- AI-powered project generation from prompts