Skip to content

patmat511/DevCompiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

image

Real-time Collaborative Code Editor

Free β€’ Open Source β€’ Privacy-First

Live Demo β€’ Documentation β€’ Report Bug β€’ Request Feature

.NET Angular MSSQL License Build


πŸ“– Table of Contents


🎯 About

DevCompiler is a free, open-source collaborative code editor designed for technical interviews, pair programming, and live coding sessions. Built with Clean Architecture principles and modern technologies, it provides real-time code synchronization, instant C# compilation, and seamless collaboration.

Why DevCompiler?

  • βœ… No Sign-Up Required - Jump straight into coding
  • βœ… 100% Free Forever - No premium tiers, no hidden costs
  • βœ… Privacy-First - No tracking, no analytics, no data collection
  • βœ… Real-time Collaboration - See code changes instantly
  • βœ… Built-in Compiler - Execute C# code directly in browser
  • βœ… Self-Hostable - MIT licensed, deploy anywhere

✨ Features

πŸ”₯ Core Features

Feature Description
Real-time Sync Multiple users can edit code simultaneously with zero latency
Monaco Editor VS Code-powered editor with syntax highlighting and IntelliSense
C# Compilation Compile and execute C# code using Roslyn compiler (sandboxed)
Live Chat Built-in chat for communication during coding sessions
Room Management Create, join, and manage collaborative coding rooms
Share Links Simple room sharing via URL - no invitations needed

πŸ”’ Security Features

  • Sandboxed Execution - Blocked dangerous namespaces (IO, Net, Reflection)
  • Code Length Limits - Maximum 10,000 characters per submission
  • Execution Timeout - 5-second timeout for code execution
  • JWT Authentication - Secure token-based authentication
  • No Persistent Storage - Code is never permanently stored on servers

πŸ—οΈ Architecture

DevCompiler follows Clean Architecture (Onion Architecture) principles for maintainability, testability, and scalability.

graph TD
    subgraph Client [Frontend - Angular]
        UI[Monaco Editor]
        SignalR_Client[SignalR Client]
    end

    subgraph API [Presentation Layer - .NET API]
        Controllers
        Hubs[SignalR Hubs]
    end

    subgraph App [Application Layer]
        Services
        DTOs
    end

    subgraph Domain [Domain Layer]
        Entities
        Logic[Business Logic]
    end

    subgraph Infra [Infrastructure Layer]
        EF[EF Core]
        Roslyn[Roslyn Compiler]
    end

    UI --> SignalR_Client
    SignalR_Client <-->|WebSocket| Hubs
    Controllers --> Services
    Hubs --> Services
    Services --> Logic
    Services --> EF
    Services --> Roslyn
    
    style Client fill:#dd0031,stroke:#333,stroke-width:2px,color:#fff
    style API fill:#512bd4,stroke:#333,stroke-width:2px,color:#fff
    style Infra fill:#178cff,stroke:#333,stroke-width:2px,color:#fff
Loading

πŸ› οΈ Tech Stack

Backend

Technology Purpose Version
.NET Backend framework 8.0
ASP.NET Core Web API 8.0
Entity Framework Core ORM 8.0
SignalR Real-time communication 8.0
Roslyn C# compiler Latest
PostgreSQL Database 16
JWT Authentication -

Frontend

Technology Purpose Version
Angular Frontend framework 18
TypeScript Language 5.x
Monaco Editor Code editor Latest
RxJS Reactive programming 7.x
SignalR Client WebSocket client Latest

DevOps

  • Docker - Containerization
  • Docker Compose - Multi-container orchestration
  • GitHub Actions - CI/CD (optional)

πŸš€ Getting Started

Prerequisites

Installation

Option 1: Docker (Recommended)

# Clone repository
git clone https://github.com/patmat511/DevCompiler.git
cd devcompiler

# Start services
docker-compose up -d

# Frontend will be available at: http://localhost:4200
# Backend API at: http://localhost:5000

Option 2: Manual Setup

1. Clone and restore:

git clone https://github.com/patmat511/DevCompiler.git
cd devcompiler
dotnet restore

2. Setup MSSQL:

docker run -e "ACCEPT_EULA=Y" \
  -e "SA_PASSWORD=testpassword" \
  -p 1433:1433 \
  --name devcompiler-sql \
  -d mcr.microsoft.com/mssql/server:2022-latest

3. Update connection string in appsettings.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost,1433;Database=devcompiler;User Id=sa;Password=testpassword;TrustServerCertificate=True;"
  }
}

4. Run migrations:

cd src/DevCompiler.API
dotnet ef database update

5. Start backend:

dotnet run

6. Start frontend (new terminal):

cd devcompiler.client
npm install
npm start

7. Open browser:

http://localhost:4200

πŸ“± Usage

Creating a Room

  1. Navigate to http://localhost:4200
  2. Enter your nickname
  3. Click "Create New Room"
  4. Share the room URL with collaborators

Joining a Room

  1. Open the shared room URL
  2. Enter your nickname
  3. Start coding!

Compiling Code

  1. Write C# code in the editor
  2. Click "Compile & Run"
  3. View output in the results panel

Real-time Collaboration

  • All participants see code changes instantly
  • Live cursor positions shown
  • Built-in chat for communication

πŸ“š API Documentation

Authentication

POST /api/auth/join

Generate JWT token with nickname.

Request:

{
  "nickname": "john_dev"
}

Response:

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "userId": "550e8400-e29b-41d4-a716-446655440000",
  "nickname": "john_dev"
}

Rooms

GET /api/rooms

Get all active rooms.

Response:

[
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "Algorithm Practice",
    "participantCount": 3,
    "createdAt": "2024-12-07T10:30:00Z"
  }
]

POST /api/rooms

Create a new room.

Request:

{
  "name": "Interview Session"
}

GET /api/rooms/{id}

Get room details by ID.

Compiler

POST /api/compiler/compile

Compile and execute C# code.

Request:

{
  "code": "Console.WriteLine(\"Hello World!\");"
}

Response:

{
  "success": true,
  "output": "Hello World!\n",
  "errors": [],
  "warnings": [],
  "executionTime": "00:00:00.1234567"
}

SignalR Hub

Endpoint: /hub

Methods:

  • JoinRoom(roomId) - Join a room
  • LeaveRoom(roomId) - Leave a room
  • SendMessage(roomId, message) - Send chat message
  • UpdateCode(roomId, code) - Sync code changes

πŸ§ͺ Running Tests

# Run all tests
dotnet test

# Run with coverage
dotnet test /p:CollectCoverage=true

About

Free, open-source collaborative code editor for technical interviews and pair programming. Features real-time code synchronization, instant C# compilation via Roslyn, and live chat. Built with Clean Architecture using .NET 8, Angular 18, SignalR, and SQL Server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors