Skip to content

DejvyK/githire-e2b-cookbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

"It ain't much, but it's honest work"

GitHire - AI Coding Interview Platform

AI interviewer that generates coding questions, executes Python code in isolated E2B sandboxes, and provides automated feedback.

Features

  • AI-Generated Questions - LLM generates coding challenges
  • Safe Code Execution - E2B sandboxes isolate user code
  • Automated Scoring - LLM evaluates correctness and code quality
  • Modern UI - Dark mode, Monaco editor, real-time feedback

Tech Stack

Backend:

  • FastAPI - Modern Python web framework
  • LangChain - LLM orchestration
  • E2B Code Interpreter - Secure sandboxed execution
  • Pydantic - Data validation

Frontend:

  • Next.js 14 - React framework
  • TypeScript - Type safety
  • Tailwind CSS - Styling
  • Monaco Editor - Code editing
  • React Hot Toast - Notifications

Quick Start

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • OpenAI API key
  • E2B API key

Environment Setup

# Copy environment template
cp .env.example .env

# Add your API keys to .env
OPENAI_API_KEY=your_openai_api_key
E2B_API_KEY=your_e2b_api_key

Running Locally

Backend:

cd backend
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000

Frontend:

cd frontend
npm install
npm run dev

Access the application at http://localhost:3000

Docker Deployment

# Build and start all services
docker-compose up --build

# Run in background
docker-compose up -d --build

# Stop services
docker-compose down

See DEPLOYMENT.md for detailed instructions.

Project Structure

githire-e2b-cookbook/
├── backend/
│   ├── app/
│   │   ├── api/          # API routes
│   │   ├── services/     # Business logic (E2B, LLM)
│   │   ├── models/       # Pydantic schemas
│   │   ├── utils/        # Logging, helpers
│   │   └── main.py       # FastAPI application
│   ├── Dockerfile
│   └── requirements.txt
├── frontend/
│   ├── src/
│   │   ├── app/          # Next.js pages
│   │   └── components/   # React components
│   ├── Dockerfile
│   └── package.json
├── docker-compose.yml
├── DEPLOYMENT.md         # Docker deployment guide
├── E2B.md               # E2B technical documentation
└── .env.example

API Endpoints

  • POST /api/start - Start new interview session
  • POST /api/submit - Submit code for evaluation
  • GET /api/session/{id} - Get session data
  • GET /health - Health check
  • GET /docs - API documentation (Swagger)

E2B Sandboxing

E2B runs user code in isolated Docker containers:

  • Each execution gets a fresh container
  • No access to host system or secrets
  • Automatic cleanup after execution
  • 30s timeout and output limits

Configuration

Environment variables (.env):

# Required
OPENAI_API_KEY=           # OpenAI API key
E2B_API_KEY=              # E2B API key

# Optional
LLM_MODEL=gpt-4o-mini     # OpenAI model (default: gpt-4o-mini)
ENVIRONMENT=development    # Environment mode
LOG_LEVEL=INFO            # Logging level
FRONTEND_URL=http://localhost:3000
NEXT_PUBLIC_API_URL=http://localhost:8000

Development

Backend:

# Run with auto-reload
uvicorn app.main:app --reload --port 8000

# Format code
black app/

Frontend:

# Development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

Production Deployment

Recommended for production:

  • Use Docker deployment
  • Set ENVIRONMENT=production
  • Configure LOG_LEVEL=WARNING
  • Implement rate limiting
  • Add session persistence (Redis)
  • Set up monitoring and alerts

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors