{"id":18756074,"url":"https://github.com/nirdosh17/go-sandbox","last_synced_at":"2025-11-29T19:30:18.014Z","repository":{"id":231912054,"uuid":"782908184","full_name":"nirdosh17/go-sandbox","owner":"nirdosh17","description":"gRPC API sandbox to execute arbitrary Go code.","archived":false,"fork":false,"pushed_at":"2024-04-27T10:07:12.000Z","size":27,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-29T01:58:02.606Z","etag":null,"topics":["container","go","golang","grpc","grpc-go","isolate","sandbox","sandbox-playground"],"latest_commit_sha":null,"homepage":"https://nirdoshgautam.dev/sandbox-grpc-api-golang","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nirdosh17.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-06T11:41:13.000Z","updated_at":"2024-11-10T11:33:34.000Z","dependencies_parsed_at":"2024-04-06T19:24:00.120Z","dependency_job_id":"d65f889d-16a0-4f46-86fd-71b6ae5a26e1","html_url":"https://github.com/nirdosh17/go-sandbox","commit_stats":null,"previous_names":["nirdosh17/go-sandbox"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirdosh17%2Fgo-sandbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirdosh17%2Fgo-sandbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirdosh17%2Fgo-sandbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirdosh17%2Fgo-sandbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nirdosh17","download_url":"https://codeload.github.com/nirdosh17/go-sandbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239644126,"owners_count":19673580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["container","go","golang","grpc","grpc-go","isolate","sandbox","sandbox-playground"],"created_at":"2024-11-07T17:35:04.456Z","updated_at":"2025-11-29T19:30:17.104Z","avatar_url":"https://github.com/nirdosh17.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Sandbox Service\n\nA containerized service that exposes a gRPC server streaming endpoint for running an arbitrary Go code in a sandbox.\n\nThe arbitrary code runs inside multiple sandboxes using [isolate](https://github.com/ioi/isolate).\n\n\u003cimg src=\"https://github.com/nirdosh17/go-sandbox/assets/5920689/d71453d4-6843-42cf-a09e-23d668f6e72d\" width=\"600\" alt=\"sandbox arch\" /\u003e\n\n**Sandbox:**\n- Multiple sandboxes are created to handle concurrent requests. One sandbox serves one request at a time and keeps other requests waiting till the sandbox is available again.\n- Network calls / File creation(size) are restricted.\n- Files created inside a specific sandbox are not visible to any other sandboxes.\n- Sandboxes are cleaned up periodically.\n\n#### See the full implementation in action: [https://goplayground.dev](https://goplayground.dev)\n\n## Running locally\n1. **Build image**\n    ```bash\n    make build\n    ```\n2. **Run gRPC service (server streaming)**\n    ```bash\n    # starts service in localhost:8080\n    make run\n    ```\n3. **Make RPC call to execute arbitrary code**\n\n    You get real-time output from the executing code through the streaming endpoint, mirroring local execution.\n    \u003cvideo src=\"https://github.com/nirdosh17/go-sandbox/assets/5920689/cd67a4a3-ef32-43fa-bd33-969c34abc124\" width=\"600\" alt=\"sandbox api call demo\" /\u003e\n\n    **Request sample:**\n\n    `session_id` can be used to bind a sandbox to a session(execution), e.g for authenticated users. If not provided, the code will run in random sandboxes.\n\n    ```jsonc\n    {\n      \"code\": \"package main\\n\\nimport (\\n\\t\\\"fmt\\\"\\n\\t\\\"time\\\"\\n)\\n\\nfunc main() {\\n\\tfor i := 0; i \u003c 3; i++ {\\n\\t\\ttime.Sleep(time.Second)\\n\\t\\tfmt.Println(\\\"Hello\\\", i)\\n\\t}\\n\\n}\\n\",\n      \"session_id\": \"user_1\" // optional\n    }\n    ```\n\n    **Response Stream:**\n\n    Success:\n    ```jsonc\n    {\n      \"output\": \"Hello\",            // stdout/stderr from executed Go code\n      \"exec_err\": \"\",               // server error\n      \"is_error\": false,            // true for server error\n      \"timestamp\": \"1712415917223\"  // stdout/err timestamp\n    }\n    ```\n    Error:\n    ```json\n    {\n      \"output\": \"main.go:10:8: undefined: time.Slseep\",\n      \"exec_err\": \"\",\n      \"is_error\": false,\n      \"timestamp\": \"1712416529383\"\n    }\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirdosh17%2Fgo-sandbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnirdosh17%2Fgo-sandbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirdosh17%2Fgo-sandbox/lists"}