@@ -21,6 +21,7 @@ The backend API for the [Typelets Application](https://github.com/typelets/typel
2121- 🔄 ** Real-time Sync** via WebSockets for multi-device support
2222- ⚡ ** Fast & Type-Safe** with TypeScript and Hono
2323- 🐘 ** PostgreSQL** with Drizzle ORM
24+ - 💻 ** Code Execution** via secure Judge0 API proxy
2425
2526## Tech Stack
2627
@@ -37,6 +38,7 @@ The backend API for the [Typelets Application](https://github.com/typelets/typel
3738- pnpm 9.15.0+
3839- PostgreSQL database (local installation or Docker)
3940- Clerk account for authentication ([ sign up here] ( https://dashboard.clerk.com ) )
41+ - Judge0 API key for code execution (optional - [ get from RapidAPI] ( https://rapidapi.com/judge0-official/api/judge0-ce ) )
4042
4143## Local Development Setup
4244
@@ -71,11 +73,14 @@ cp .env.example .env
71734 . ** Configure environment variables:**
7274 - Create a free account at [ Clerk Dashboard] ( https://dashboard.clerk.com )
7375 - Create a new application
76+ - (Optional) Get Judge0 API key from [ RapidAPI] ( https://rapidapi.com/judge0-official/api/judge0-ce )
7477 - Update ` .env ` with your settings:
7578
7679 ``` env
7780 CLERK_SECRET_KEY=sk_test_your_actual_clerk_secret_key_from_dashboard
7881 CORS_ORIGINS=http://localhost:5173,http://localhost:3000
82+ # Optional: For code execution features
83+ JUDGE0_API_KEY=your_judge0_rapidapi_key_here
7984 ```
8085
81865 . ** Set up database schema:**
@@ -199,6 +204,13 @@ All `/api/*` endpoints require authentication via Bearer token in the Authorizat
199204- ` GET /api/files/:id ` - Get file details
200205- ` DELETE /api/files/:id ` - Delete file attachment
201206
207+ ### Code Execution (requires Judge0 API key)
208+
209+ - ` POST /api/code/execute ` - Submit code for execution
210+ - ` GET /api/code/status/:token ` - Get execution status and results
211+ - ` GET /api/code/languages ` - Get supported programming languages
212+ - ` GET /api/code/health ` - Check Judge0 service connectivity
213+
202214### WebSocket Real-time Sync
203215
204216The API provides real-time synchronization via WebSocket connection at ` ws://localhost:3000 ` (or your configured port).
@@ -261,6 +273,9 @@ The application uses the following main tables:
261273| ` WS_RATE_LIMIT_MAX_MESSAGES ` | Max WebSocket messages per window | No | 300 |
262274| ` WS_MAX_CONNECTIONS_PER_USER ` | Max WebSocket connections per user | No | 20 |
263275| ` WS_AUTH_TIMEOUT_MS ` | WebSocket authentication timeout in milliseconds | No | 30000 (30 sec) |
276+ | ` JUDGE0_API_KEY ` | Judge0 API key for code execution | No* | - |
277+
278+ * Required only for code execution features
264279
265280## Development
266281
278293│ ├── rate-limit.ts # Rate limiting middleware
279294│ └── security.ts # Security headers middleware
280295├── routes/
296+ │ ├── code.ts # Code execution routes (Judge0 proxy)
281297│ ├── files.ts # File attachment routes
282298│ ├── folders.ts # Folder management routes
283299│ ├── notes.ts # Note management routes
0 commit comments