Design: Collaborative Notebook with Executable User Functions (JAR Upload)
Context
Design a collaborative, browser-based code notebook service. The system must support real-time editing, execution of user-submitted functions, and a proxy that fetches execution results/logs and returns them to the browser.
Users can upload custom Java JARs, specify a fully-qualified class and method as the entrypoint, and submit executions with arguments. The system must be secure, scalable, and support streaming logs/results.
Requirements
-
Define RESTful endpoints and request/response schemas for:
-
Uploading user code (JARs) and registering entrypoints
-
Submitting executions (sync/async, with args)
-
Fetching logs and results (polling and streaming)
-
Cancelling executions
-
Discuss:
-
Sandboxing and isolation for untrusted code
-
Dependency management for user JARs (Maven coordinates, shading, etc.)
-
Resource limits and quotas
-
Concurrency model and scheduling
-
Streaming logs/results to the browser via a proxy
Make minimal assumptions where the prompt is ambiguous (e.g., use Java 17, JSON over HTTP, and an API Gateway/Proxy).