Add v2 sandbox implementation with new API routes and sandbox library

This commit is contained in:
Developers Digest
2025-09-02 19:14:27 -04:00
parent d7ae41ba9d
commit dbf34e2d63
15 changed files with 1978 additions and 0 deletions
@@ -0,0 +1,25 @@
# Open Lovable Configuration - E2B Provider
# Sandbox Provider
SANDBOX_PROVIDER=e2b
# REQUIRED - Sandboxes for code execution
# Get yours at https://e2b.dev
E2B_API_KEY=your_e2b_api_key_here
# REQUIRED - Web scraping for cloning websites
# Get yours at https://firecrawl.dev
FIRECRAWL_API_KEY=your_firecrawl_api_key_here
# OPTIONAL - AI Providers (need at least one)
# Get yours at https://console.anthropic.com
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# Get yours at https://platform.openai.com
OPENAI_API_KEY=your_openai_api_key_here
# Get yours at https://aistudio.google.com/app/apikey
GEMINI_API_KEY=your_gemini_api_key_here
# Get yours at https://console.groq.com
GROQ_API_KEY=your_groq_api_key_here
@@ -0,0 +1,38 @@
# Open Lovable - E2B Sandbox
This project is configured to use E2B sandboxes for code execution.
## Setup
1. Get your E2B API key from [https://e2b.dev](https://e2b.dev)
2. Get your Firecrawl API key from [https://firecrawl.dev](https://firecrawl.dev)
3. Copy `.env.example` to `.env` and add your API keys
4. Run `npm install` to install dependencies
5. Run `npm run dev` to start the development server
## E2B Features
- Full-featured development sandboxes
- 15-minute default timeout (configurable)
- Persistent file system during session
- Support for complex package installations
- Built-in Python runtime for code execution
## Configuration
You can adjust E2B settings in `config/app.config.ts`:
- `timeoutMinutes`: Sandbox session timeout (default: 15)
- `vitePort`: Development server port (default: 5173)
- `viteStartupDelay`: Time to wait for Vite to start (default: 7000ms)
## Troubleshooting
If you encounter issues:
1. Verify your E2B API key is valid
2. Check the console for detailed error messages
3. Ensure you have a stable internet connection
4. Try refreshing the page and creating a new sandbox
For more help, visit the [E2B documentation](https://docs.e2b.dev).
@@ -0,0 +1,28 @@
# Open Lovable Configuration - Vercel Provider
# Sandbox Provider
SANDBOX_PROVIDER=vercel
# REQUIRED - Vercel Sandboxes
# Option 1: OIDC Token (automatic in Vercel environment)
# Option 2: Personal Access Token (configure below)
VERCEL_TEAM_ID=your_team_id
VERCEL_PROJECT_ID=your_project_id
VERCEL_TOKEN=your_access_token
# REQUIRED - Web scraping for cloning websites
# Get yours at https://firecrawl.dev
FIRECRAWL_API_KEY=your_firecrawl_api_key_here
# OPTIONAL - AI Providers (need at least one)
# Get yours at https://console.anthropic.com
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# Get yours at https://platform.openai.com
OPENAI_API_KEY=your_openai_api_key_here
# Get yours at https://aistudio.google.com/app/apikey
GEMINI_API_KEY=your_gemini_api_key_here
# Get yours at https://console.groq.com
GROQ_API_KEY=your_groq_api_key_here
@@ -0,0 +1,52 @@
# Open Lovable - Vercel Sandbox
This project is configured to use Vercel Sandboxes for code execution.
## Setup
1. Configure Vercel authentication (see below)
2. Get your Firecrawl API key from [https://firecrawl.dev](https://firecrawl.dev)
3. Copy `.env.example` to `.env` and add your credentials
4. Run `npm install` to install dependencies
5. Run `npm run dev` to start the development server
## Vercel Authentication
### Option 1: OIDC Token (Recommended for Vercel deployments)
When running in a Vercel environment, authentication happens automatically via OIDC tokens. No configuration needed!
### Option 2: Personal Access Token (For local development)
1. Create a Personal Access Token in your [Vercel account settings](https://vercel.com/account/tokens)
2. Get your Team ID from your [team settings](https://vercel.com/teams)
3. Create a project and get the Project ID
4. Add these to your `.env` file:
- `VERCEL_TOKEN`
- `VERCEL_TEAM_ID`
- `VERCEL_PROJECT_ID`
## Vercel Sandbox Features
- Lightweight ephemeral Linux VMs
- Powered by Firecracker MicroVMs
- 5-minute default timeout (max 45 minutes)
- 8 vCPUs maximum
- Root access for package installation
- Node 22 runtime included
## Configuration
You can adjust Vercel settings in `config/app.config.ts`:
- `maxDuration`: Sandbox session timeout (default: 5 minutes)
- Authentication method (OIDC or PAT)
## Troubleshooting
If you encounter issues:
1. Verify your authentication credentials
2. Check if you're using the correct authentication method
3. Ensure your Vercel account has sandbox access
4. Check the console for detailed error messages
For more help, visit the [Vercel Sandbox documentation](https://vercel.com/docs/vercel-sandbox).