GitHub Clone & Dev Environment Setup
Clone repositories and set up development environments in Daytona sandboxes.
Configuration
export CONVEX_SITE_URL="https://calculating-hummingbird-542.convex.site"
Clone Repository
curl -X POST "$CONVEX_SITE_URL/api/sandbox/git/clone" \
-H "Content-Type: application/json" \
-d '{
"sandboxId": "SANDBOX_ID",
"repoUrl": "https://github.com/owner/repo.git",
"branch": "main",
"targetPath": "/home/user/projects/repo"
}'
Parameters:
- •
sandboxId(required): The Daytona sandbox ID - •
repoUrl(required): Full Git URL (HTTPS) - •
branch(optional): Branch to checkout (default: default branch) - •
targetPath(optional): Clone destination (default:/home/daytona/projects/{repo-name})
Returns: {"success": true, "path": "/home/daytona/projects/repo", "output": "..."}
Complete Development Setup Workflow
1. Clone the Repository
curl -X POST "$CONVEX_SITE_URL/api/sandbox/git/clone" \
-H "Content-Type: application/json" \
-d '{"sandboxId": "abc123", "repoUrl": "https://github.com/BraelinC/planner"}'
2. Check Repository Structure
curl -X POST "$CONVEX_SITE_URL/api/sandbox/execute" \
-H "Content-Type: application/json" \
-d '{"sandboxId": "abc123", "command": "ls -la /home/daytona/projects/planner"}'
3. Install Dependencies
For Node.js projects:
curl -X POST "$CONVEX_SITE_URL/api/sandbox/execute" \
-H "Content-Type: application/json" \
-d '{"sandboxId": "abc123", "command": "cd /home/daytona/projects/planner && npm install", "timeout": 120}'
For Python projects:
curl -X POST "$CONVEX_SITE_URL/api/sandbox/execute" \
-H "Content-Type: application/json" \
-d '{"sandboxId": "abc123", "command": "cd /home/daytona/projects/planner && pip install -r requirements.txt", "timeout": 120}'
4. Start Development Server
Run in background:
curl -X POST "$CONVEX_SITE_URL/api/sandbox/execute" \
-H "Content-Type: application/json" \
-d '{"sandboxId": "abc123", "command": "cd /home/daytona/projects/planner && npm run dev &"}'
5. Open Browser to View App
Option A: Use terminal to open browser
curl -X POST "$CONVEX_SITE_URL/api/sandbox/execute" \
-H "Content-Type: application/json" \
-d '{"sandboxId": "abc123", "command": "firefox http://localhost:3000 &"}'
Option B: Click on browser icon in taskbar First take screenshot to see the desktop, then click on browser icon.
6. Take Screenshot to Verify
curl -X POST "$CONVEX_SITE_URL/api/sandbox/screenshot" \
-H "Content-Type: application/json" \
-d '{"sandboxId": "abc123", "compressed": true, "quality": 80}'
Common Project Types
Next.js / React
# Install npm install # Dev server npm run dev # Default port: 3000
Vite
# Install npm install # Dev server npm run dev # Default port: 5173
Python Flask/Django
# Install pip install -r requirements.txt # Flask flask run # Django python manage.py runserver # Default port: 5000 (Flask) or 8000 (Django)
Editing Code
Read a file
curl -X POST "$CONVEX_SITE_URL/api/sandbox/fs/read" \
-H "Content-Type: application/json" \
-d '{"sandboxId": "abc123", "path": "/home/daytona/projects/planner/src/App.tsx"}'
Write changes
curl -X POST "$CONVEX_SITE_URL/api/sandbox/fs/write" \
-H "Content-Type: application/json" \
-d '{"sandboxId": "abc123", "path": "/home/daytona/projects/planner/src/App.tsx", "content": "..."}'
Hot reload
Most dev servers auto-reload on file changes. Take a screenshot to verify.
Tips
- •Clone timeout is 120 seconds by default for large repos
- •Public repos work without authentication
- •Check
package.jsonorrequirements.txtto understand the project - •Use
cat package.jsonto see available npm scripts - •Start dev servers with
&to run in background - •Take screenshots after starting server to verify it's running
Known Constraints
⚠️ CONSTRAINT: Default sandbox has only 1GB RAM - large npm/bun installs will be killed (OOM).
- •Monorepos with many dependencies need 2-4GB RAM
- •Install bun via npm:
npm install -g bun
⚠️ CONSTRAINT: The sandbox user is daytona, not user.
- •Clone to
/home/daytona/projects/not/home/user/projects/
⚠️ CONSTRAINT: Tier 1-2 sandboxes cannot curl arbitrary URLs.
- •Connection reset errors for non-whitelisted domains
- •npm/pip registries work fine
✅ BEST PRACTICE: For workspace:* dependencies, use bun or pnpm (npm doesn't support workspace protocol).