Skip to content

The-Natri/codeReviewBuddy

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Code Review Buddy πŸš€

A modern web-based IDE and code review tool with Docker-powered sandboxing, AI assistance, and real-time collaboration features.

πŸ› οΈ Tech Stack

  • Frontend: React 18, Vite, Monaco Editor, Socket.IO Client
  • Backend: Node.js, Express.js, Socket.IO
  • Containerization: Docker (isolated sandbox environments)
  • AI Integration: Groq API (Llama 3.1)
  • Code Execution: PISTON API
  • Styling: CSS3

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

πŸš€ Quick Start

1. Fork & Clone the Repository

  1. Fork this repository by clicking the "Fork" button at the top right
  2. Clone your forked repository:
    git clone https://github.com/YOUR_USERNAME/codeReviewBuddy.git
    cd codeReviewBuddy

2. Navigate to Project Directory

cd codeReviewBuddy

3. Install Dependencies

Install frontend dependencies:

npm install

Install backend dependencies:

cd backend
npm install
cd ..

4. Docker Setup

  1. Start Docker Desktop and ensure it's running

  2. Build the sandbox image:

    cd backend
    docker build -t code-sandbox:latest .

5. Environment Setup

  1. Get your Groq API key (optional - mock AI works without it):

  2. Create environment file:

    cd backend
    touch .env
  3. Add your API key to backend/.env:

    # For real AI (optional)
    GROQ_API_KEY=your_actual_api_key_here
    USE_MOCK_AI=false
    
    # For mock AI (works without API key)
    USE_MOCK_AI=true

6. Start the Application

From the root directory:

npm start

This will start both frontend (http://localhost:5173) and backend (http://localhost:3001) servers.

🎯 Alternative Start Methods

Start Frontend Only

npm run dev

Start Backend Only

npm run server

Start Separately

# Terminal 1 - Frontend
npm run dev

# Terminal 2 - Backend
cd backend
npm run dev

🐳 Docker Architecture

Isolated Sandbox Environment

  • Each user session gets a dedicated Docker container
  • Complete isolation from host system
  • Pre-installed with Python, Node.js, Java, C++, and development tools
  • Automatic cleanup when session ends

Security Features

  • Process Isolation: Container processes can't affect host
  • Filesystem Isolation: No access to host files
  • Network Isolation: Controlled network access
  • Resource Limits: CPU and memory quotas enforced
  • User Isolation: Runs as non-root user in container

πŸ“ Project Structure

codeReviewBuddy/
β”œβ”€β”€ codeReviewBuddy/
β”‚   β”œβ”€β”€ src/                 # React frontend source
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”œβ”€β”€ assets/         # Static assets
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ backend/            # Node.js backend
β”‚   β”‚   β”œβ”€β”€ controllers/    # API controllers
β”‚   β”‚   β”œβ”€β”€ routes/        # API routes
β”‚   β”‚   β”œβ”€β”€ .env           # Environment variables (not in git)
β”‚   β”‚   └── server.js      # Main server file
β”‚   β”œβ”€β”€ public/            # Public assets
β”‚   └── package.json       # Frontend dependencies
└── README.md

πŸ”§ Development

Available Scripts

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

VS Code Setup

  1. Install recommended extensions:

    • ES7+ React/Redux/React-Native snippets
    • Prettier - Code formatter
    • ESLint
  2. Open project in VS Code:

    code .

🌟 Features

πŸ”’ Secure Development Environment

  • Docker-powered sandboxing - Complete isolation from host system
  • Multi-language support - Python, JavaScript, Java, C++, C, HTML, CSS
  • Real-time file synchronization - Changes in terminal instantly appear in file explorer
  • Integrated terminal - Full bash/PowerShell access within container

πŸ€– AI-Powered Code Assistance

  • Intelligent code review - Groq API with Llama 3.1 model
  • Interactive AI chat - Context-aware conversations about your code
  • Code suggestions - Real-time improvement recommendations
  • Mock AI fallback - Works without API key for testing

πŸ’» Professional IDE Experience

  • Monaco Editor - VS Code-like editing experience
  • Multi-file support - Tabbed interface with file explorer
  • Syntax highlighting - Support for multiple programming languages
  • Code execution - Run code safely via PISTON API
  • Real-time collaboration - Socket.IO powered live updates

🎨 Modern UI/UX

  • VS Code-inspired design - Familiar interface for developers
  • Responsive layout - Works on desktop and tablet devices
  • Dark theme - Easy on the eyes for long coding sessions
  • Status bar - Real-time information about active file and system status

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“ License

This project is open source and available under the MIT License.

πŸ†˜ Troubleshooting

Common Issues

Port already in use:

# Kill process on port 3001 (backend)
npx kill-port 3001

# Kill process on port 5173 (frontend)
npx kill-port 5173

Dependencies issues:

# Clear npm cache
npm cache clean --force

# Delete node_modules and reinstall
rm -rf node_modules package-lock.json
npm install

Environment variables not loading:

  • Ensure .env file is in the backend/ directory
  • Check that your API key is valid
  • Restart the backend server after changing .env

πŸ”§ Docker Troubleshooting

Common Docker Issues

Docker not running:

# Check Docker status
docker --version
docker ps

Container build fails:

# Clean Docker cache and rebuild
docker system prune -f
cd backend
docker build -t code-sandbox:latest .

Permission issues (Linux/Mac):

# Add user to docker group
sudo usermod -aG docker $USER
# Logout and login again

Container cleanup:

# Remove all containers
docker container prune -f

# Remove sandbox image
docker rmi code-sandbox:latest

πŸš€ Production Deployment

Environment Variables

# Production settings
NODE_ENV=production
PORT=3000
GROQ_API_KEY=your_production_api_key
USE_MOCK_AI=false

# Docker settings
DOCKER_HOST=unix:///var/run/docker.sock
CONTAINER_MEMORY_LIMIT=512m
CONTAINER_CPU_LIMIT=0.5

Security Considerations

  • Run Docker daemon in rootless mode
  • Use container resource limits
  • Implement session timeouts
  • Monitor container usage
  • Regular security updates

πŸ“ž Support

If you encounter any issues:

  1. Check Docker Desktop is running
  2. Verify all dependencies are installed
  3. Check the Issues page
  4. Create a new issue with:
    • Error messages
    • Docker version (docker --version)
    • Node.js version (node --version)
    • Steps to reproduce

Built with ❀️ for developers who value security and productivity

Happy coding in your secure sandbox! πŸŽ‰πŸ³

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 69.2%
  • CSS 29.5%
  • Other 1.3%