You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
import { Daytona } from '@daytonaio/sdk'
const main = async () => {
const daytona = new Daytona(({
apiKey: "YOUR_API_KEY",
}))
console.log("Creating the sandbox...")
const sandbox = await daytona.create({
language: 'typescript',
autoStopInterval: 0
})
let rootDir = await sandbox.getUserRootDir()
if (!rootDir) {
throw new Error("Failed to get user root directory")
}
console.log("Cloning the repo ...")
await sandbox.git.clone(
"https://github.com/stackblitz/starters",
rootDir+"/starters",
)
// Create a new session and execute a command
const execSessionId = "app-server"
await sandbox.process.createSession(execSessionId)
console.log("Installing and running the app ...")
await sandbox.process.executeSessionCommand(execSessionId, ({
command: `cd ${rootDir}/starters/bolt-vite-react-ts && npm install && npm run dev -- --host 0.0.0.0`,
async: true,
}))
console.log("Waiting for the app to run ...")
// Replace this with a poller that checks if the app is available
await new Promise(resolve => setTimeout(resolve, 10000))
const previewLink = sandbox.getPreviewLink(5173)
console.log(`App is available at: ${previewLink}`)
}
main().catch(console.error)