Skip to content

Latest commit

 

History

History
174 lines (127 loc) · 3.96 KB

File metadata and controls

174 lines (127 loc) · 3.96 KB

🚀 GitHub & Vercel Deployment Guide

Step 1: Push to GitHub

Create a new repository on GitHub

  1. Go to https://github.com/new
  2. Repository name: codecrush (or any name you prefer)
  3. Make it Public or Private
  4. DO NOT initialize with README, .gitignore, or license
  5. Click "Create repository"

Push your code

Run these commands in your terminal:

cd /home/yash/CodeCrush

# Add GitHub as remote (replace YOUR_USERNAME with your GitHub username)
git remote add origin https://github.com/YOUR_USERNAME/codecrush.git

# Push to GitHub
git branch -M main
git push -u origin main

Step 2: Deploy to Vercel

Option A: Deploy via Vercel Website (Recommended)

  1. Go to Vercel:

  2. Import Project:

    • Click "Add New..." → "Project"
    • Select "Import Git Repository"
    • Find your codecrush repository and click "Import"
  3. Configure Project:

    • Framework Preset: Next.js (auto-detected)
    • Root Directory: ./ (default)
    • Build Command: npm run build (default)
    • Output Directory: .next (default)
  4. Add Environment Variables: First, get your API keys:

    Gemini API Key:

    Judge0 API Key:

    Then add these environment variables:

    Name: GEMINI_API_KEY
    Value: your_actual_gemini_api_key_here
    
    Name: JUDGE0_API_KEY
    Value: your_actual_judge0_api_key_here
    
    Name: JUDGE0_API_HOST
    Value: judge0-ce.p.rapidapi.com
    
  5. Deploy:

    • Click "Deploy"
    • Wait 1-2 minutes for build to complete
    • Your app will be live at https://your-project-name.vercel.app

Option B: Deploy via Vercel CLI

# Install Vercel CLI
npm i -g vercel

# Login to Vercel
vercel login

# Deploy
vercel

# Follow the prompts:
# - Set up and deploy? Y
# - Which scope? (select your account)
# - Link to existing project? N
# - Project name? codecrush
# - Directory? ./ (press Enter)
# - Override settings? N

# Add environment variables
vercel env add GEMINI_API_KEY
# Paste: your_actual_gemini_api_key_here
# Environment: Production

vercel env add JUDGE0_API_KEY
# Paste: your_actual_judge0_api_key_here
# Environment: Production

vercel env add JUDGE0_API_HOST
# Type: judge0-ce.p.rapidapi.com
# Environment: Production

# Deploy to production
vercel --prod

Step 3: Verify Deployment

  1. Visit your Vercel URL (e.g., https://codecrush.vercel.app)
  2. Test the features:
    • ✅ Generate test cases (tests Gemini API)
    • ✅ Run code (tests Judge0 API)
    • ✅ Evaluate against test cases

Troubleshooting

API Not Working

  • Check environment variables in Vercel dashboard
  • Ensure no extra spaces in API keys
  • Check Vercel deployment logs for errors

Build Fails

  • Check the build logs in Vercel dashboard
  • Ensure all dependencies are in package.json
  • Try redeploying

404 Errors

  • Ensure you're using Next.js 14+ App Router structure
  • Check that API routes are in src/app/api/ directory

Next Steps

Custom Domain (Optional)

  1. Go to your project in Vercel dashboard
  2. Click "Settings" → "Domains"
  3. Add your custom domain and follow DNS instructions

Auto-Deploy on Push

Vercel automatically redeploys when you push to GitHub:

# Make changes to your code
git add .
git commit -m "feat: Add new feature"
git push origin main

# Vercel will automatically rebuild and deploy

Monitor Usage


🎉 You're Live!

Share your CodeCrush deployment with the world! 🚀

Your app: https://your-project-name.vercel.app