├── .env ├── .eslintrc.json ├── .gitignore ├── README.md ├── app ├── favicon.ico ├── globals.css ├── layout.tsx └── page.tsx ├── components.json ├── components ├── Playground.tsx └── ui │ ├── button.tsx │ └── input.tsx ├── e2b-playground ├── agent │ ├── agent.js │ ├── functions.js │ ├── package-lock.json │ ├── package.json │ └── system_prompt.txt ├── dbk-og.toml ├── dbk.toml └── template │ ├── .eslintrc.json │ ├── .gitignore │ ├── README.md │ ├── components.json │ ├── components │ ├── Component.jsx │ └── ui │ │ ├── accordion.jsx │ │ ├── alert-dialog.jsx │ │ ├── alert.jsx │ │ ├── aspect-ratio.jsx │ │ ├── avatar.jsx │ │ ├── badge.jsx │ │ ├── button.jsx │ │ ├── calendar.jsx │ │ ├── card.jsx │ │ ├── checkbox.jsx │ │ ├── collapsible.jsx │ │ ├── command.jsx │ │ ├── context-menu.jsx │ │ ├── dialog.jsx │ │ ├── dropdown-menu.jsx │ │ ├── form.jsx │ │ ├── hover-card.jsx │ │ ├── input.jsx │ │ ├── label.jsx │ │ ├── menubar.jsx │ │ ├── navigation-menu.jsx │ │ ├── popover.jsx │ │ ├── progress.jsx │ │ ├── radio-group.jsx │ │ ├── scroll-area.jsx │ │ ├── select.jsx │ │ ├── separator.jsx │ │ ├── sheet.jsx │ │ ├── skeleton.jsx │ │ ├── slider.jsx │ │ ├── switch.jsx │ │ ├── table.jsx │ │ ├── tabs.jsx │ │ ├── textarea.jsx │ │ ├── toast.jsx │ │ ├── toaster.jsx │ │ ├── toggle.jsx │ │ ├── tooltip.jsx │ │ └── use-toast.ts │ ├── jsconfig.json │ ├── lib │ └── utils.js │ ├── next.config.js │ ├── package-lock.json │ ├── package.json │ ├── pages │ ├── _app.js │ ├── _document.js │ ├── api │ │ └── hello.js │ └── index.js │ ├── postcss.config.js │ ├── public │ ├── favicon.ico │ ├── next.svg │ └── vercel.svg │ ├── styles │ └── globals.css │ └── tailwind.config.js ├── lib └── utils.ts ├── next.config.js ├── package-lock.json ├── package.json ├── postcss.config.js ├── public ├── next.svg └── vercel.svg ├── tailwind.config.js ├── tailwind.config.ts └── tsconfig.json /.env: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_E2B_API_KEY=e2b_d5db0b24b13f426a698503143a06f53e51302059 -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env*.local 29 | 30 | # vercel 31 | .vercel 32 | 33 | # typescript 34 | *.tsbuildinfo 35 | next-env.d.ts 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). 2 | 3 | ## Getting Started 4 | 5 | First, run the development server: 6 | 7 | ```bash 8 | npm run dev 9 | # or 10 | yarn dev 11 | # or 12 | pnpm dev 13 | ``` 14 | 15 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 16 | 17 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. 18 | 19 | This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. 20 | 21 | ## Learn More 22 | 23 | To learn more about Next.js, take a look at the following resources: 24 | 25 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. 26 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. 27 | 28 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! 29 | 30 | ## Deploy on Vercel 31 | 32 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. 33 | 34 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. 35 | -------------------------------------------------------------------------------- /app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mlejva/oss-v0/41dc112aac01b27b45d531a2046745cca875aff4/app/favicon.ico -------------------------------------------------------------------------------- /app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | @layer base { 6 | :root { 7 | --background: 0 0% 100%; 8 | --foreground: 222.2 84% 4.9%; 9 | 10 | --card: 0 0% 100%; 11 | --card-foreground: 222.2 84% 4.9%; 12 | 13 | --popover: 0 0% 100%; 14 | --popover-foreground: 222.2 84% 4.9%; 15 | 16 | --primary: 222.2 47.4% 11.2%; 17 | --primary-foreground: 210 40% 98%; 18 | 19 | --secondary: 210 40% 96.1%; 20 | --secondary-foreground: 222.2 47.4% 11.2%; 21 | 22 | --muted: 210 40% 96.1%; 23 | --muted-foreground: 215.4 16.3% 46.9%; 24 | 25 | --accent: 210 40% 96.1%; 26 | --accent-foreground: 222.2 47.4% 11.2%; 27 | 28 | --destructive: 0 84.2% 60.2%; 29 | --destructive-foreground: 210 40% 98%; 30 | 31 | --border: 214.3 31.8% 91.4%; 32 | --input: 214.3 31.8% 91.4%; 33 | --ring: 222.2 84% 4.9%; 34 | 35 | --radius: 0.5rem; 36 | } 37 | 38 | .dark { 39 | --background: 222.2 84% 4.9%; 40 | --foreground: 210 40% 98%; 41 | 42 | --card: 222.2 84% 4.9%; 43 | --card-foreground: 210 40% 98%; 44 | 45 | --popover: 222.2 84% 4.9%; 46 | --popover-foreground: 210 40% 98%; 47 | 48 | --primary: 210 40% 98%; 49 | --primary-foreground: 222.2 47.4% 11.2%; 50 | 51 | --secondary: 217.2 32.6% 17.5%; 52 | --secondary-foreground: 210 40% 98%; 53 | 54 | --muted: 217.2 32.6% 17.5%; 55 | --muted-foreground: 215 20.2% 65.1%; 56 | 57 | --accent: 217.2 32.6% 17.5%; 58 | --accent-foreground: 210 40% 98%; 59 | 60 | --destructive: 0 62.8% 30.6%; 61 | --destructive-foreground: 210 40% 98%; 62 | 63 | --border: 217.2 32.6% 17.5%; 64 | --input: 217.2 32.6% 17.5%; 65 | --ring: 212.7 26.8% 83.9%; 66 | } 67 | } 68 | 69 | @layer base { 70 | * { 71 | @apply border-border; 72 | } 73 | body { 74 | /* @apply bg-background text-foreground; */ 75 | } 76 | } -------------------------------------------------------------------------------- /app/layout.tsx: -------------------------------------------------------------------------------- 1 | import './globals.css' 2 | import type { Metadata } from 'next' 3 | import { Inter } from 'next/font/google' 4 | 5 | const inter = Inter({ subsets: ['latin'] }) 6 | 7 | export const metadata: Metadata = { 8 | title: 'Create Next App', 9 | description: 'Generated by create next app', 10 | } 11 | 12 | export default function RootLayout({ 13 | children, 14 | }: { 15 | children: React.ReactNode 16 | }) { 17 | return ( 18 | 19 | 20 |
21 |
22 | v0S 23 |
24 | {children} 25 |
26 | 27 | 28 | ) 29 | } 30 | -------------------------------------------------------------------------------- /app/page.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | import { useState } from 'react' 3 | import { Input } from '@/components/ui/input' 4 | import { CornerDownLeft } from 'lucide-react' 5 | import { Button } from '@/components/ui/button' 6 | 7 | import Playground from '@/components/Playground' 8 | 9 | export default function Home() { 10 | const [task, setTask] = useState('') 11 | 12 | function sendRequest() { 13 | fetch('http://localhost:3002', { 14 | method: 'POST', 15 | headers: { 16 | 'Content-type': 'application/json', 17 | }, 18 | body: JSON.stringify({ task }), 19 | }) 20 | } 21 | 22 | return ( 23 |
24 |
25 | 26 |
27 | setTask(e.target.value)} 32 | /> 33 | 39 |
40 | 41 | 42 | 43 |
44 |
45 | ) 46 | } 47 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.js", 8 | "css": "app/globals.css", 9 | "baseColor": "slate", 10 | "cssVariables": true 11 | }, 12 | "aliases": { 13 | "components": "@/components", 14 | "utils": "@/lib/utils" 15 | } 16 | } -------------------------------------------------------------------------------- /components/Playground.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import { useEffect, useState } from 'react' 4 | 5 | import { Session } from '@e2b/sdk' 6 | const logger = { 7 | debug: console.debug, // log debug messages, in default logger this is noop 8 | info: console.info, // log info messages, in default logger this is noop 9 | // don't forget to also specify warn & error handlers, otherwise they won't be logged when overriding the logger 10 | warn: console.warn, 11 | error: console.error, 12 | } 13 | 14 | // function fetchCode() { 15 | // fetch('http://localhost:3002', { 16 | // method: 'POST', 17 | // headers: { 18 | // 'Content-type': 'application/json', 19 | // }, 20 | // body: JSON.stringify({ task }), 21 | // }) 22 | // } 23 | 24 | 25 | function Playground() { 26 | const [playground, setPlayground] = useState(null) 27 | const [url, setURL] = useState('') 28 | 29 | async function initPlayground() { 30 | const session = await Session.create({ 31 | id: 'pTqrJ3prLCDI', // Custom env made for generating react/nextjs code 32 | apiKey: process.env.NEXT_PUBLIC_E2B_API_KEY!, 33 | logger, 34 | }) 35 | 36 | console.log('WRITING FILES') 37 | setTimeout(async () => { 38 | await session.filesystem.write('/code/template/components/Component.jsx', ` 39 | import { Alert } from "@/components/ui/alert"; 40 | import { Button } from "@/components/ui/button"; 41 | 42 | export default function CookieConsentBanner() { 43 | return ( 44 | 45 |
46 | 53 | 59 | 60 | 61 | This website uses cookies to ensure you get the best experience on our website. 62 | 63 |
64 | 65 |
66 | ); 67 | } 68 | `) 69 | console.log('DONE') 70 | }, 2000) 71 | 72 | setURL('https://' + session.getHostname(3000)) 73 | setPlayground(session) 74 | } 75 | 76 | useEffect(function init() { 77 | // initPlayground() 78 | }, []) 79 | 80 | return ( 81 |
82 | {/*