Skip to content

Commit 5fe1b4e

Browse files
committed
fix(github): readme
1 parent d8516f8 commit 5fe1b4e

3 files changed

Lines changed: 33 additions & 121 deletions

File tree

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,5 @@ jobs:
3333
- name: Build All Templates
3434
env:
3535
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
36-
working-directory: sandbox
3736
run: |
3837
node ./scripts/build-and-publish.mjs --mode build

.github/workflows/publish.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish E2B Templates
1+
name: Publish Templates
22

33
on:
44
push:
@@ -35,6 +35,5 @@ jobs:
3535
- name: Publish All Templates
3636
env:
3737
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
38-
working-directory: sandbox
3938
run: |
4039
node ./scripts/build-and-publish.mjs --mode publish

README.md

Lines changed: 32 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,42 @@
1-
# Code0 Sandbox Templates (standalone)
1+
## Code0 Sandbox Templates
22

3-
Standalone E2B sandbox templates used by the Code0 app to spin up ephemeral environments per project.
3+
[![Publish E2B Templates](https://github.com/Code0App/templates/actions/workflows/publish.yml/badge.svg)](https://github.com/Code0App/templates/actions/workflows/publish.yml)
4+
[![Build Templates](https://github.com/Code0App/templates/actions/workflows/build.yml/badge.svg)](https://github.com/Code0App/templates/actions/workflows/build.yml)
45

5-
Once published, the app can create sandboxes in E2B Cloud (no local Docker required at runtime).
6+
Sandbox images that power Code0 projects. These templates provide ready-to-run environments in E2B Cloud for building, previewing, and iterating on code generated by the app.
67

7-
## Templates
8-
- `nextjs-shadcn` — Next.js 15 + shadcn/ui baseline.
9-
- `nextjs-radixui` — Next.js 15 + Radix UI baseline.
8+
### What you get
9+
- Consistent, isolated environments per project
10+
- Preconfigured stacks for rapid iteration and first-render speed
11+
- Cloud-hosted previews that can be resumed later
1012

11-
Each template folder contains:
12-
- `e2b.Dockerfile` — how the template image is built.
13-
- `e2b.toml` — template metadata (team, name/ID, CPU/RAM, start command).
14-
- `compile_page.sh` — start script executed inside the sandbox at `/compile_page.sh`.
13+
### Available templates
14+
- nextjs-shadcn — Next.js 15 baseline paired with shadcn/ui
15+
- nextjs-radixui — Next.js 15 baseline paired with Radix UI
1516

16-
## Prerequisites
17-
- E2B account + API key (`E2B_API_KEY`).
18-
- E2B CLI (use `npx e2b@latest` or install globally with `npm i -g e2b`).
19-
- Docker Desktop (for building/publishing templates).
20-
- Node.js (to run scripts in this repo).
17+
### How the app selects a template
18+
- By project setting in the database (preferred)
19+
- If not set, the app can fall back to an environment variable template name
2120

22-
## Configure (env)
23-
Set your API key before building/publishing:
21+
### Using templates in the app
22+
- When you create or run a project, Code0 launches a sandbox using the project’s template
23+
- The sandbox URL is returned and shown in the project’s thread as a preview
24+
- Sandboxes can be paused and resumed to retain state between runs
2425

25-
PowerShell
26-
```
27-
$env:E2B_API_KEY = "<your_e2b_api_key>"
28-
```
26+
### Versioning and compatibility
27+
- Target: Node 20+/21+, Next.js 15, React 19
28+
- Each template is self-contained and versioned independently through E2B
29+
- Updates to template content are published; new sandboxes use the latest version
2930

30-
In the app that consumes templates, set one of (ID is preferred):
31-
- `E2B_TEMPLATE_ID=<template_id>`
32-
- or `E2B_TEMPLATE_NAME=<template_name>`
33-
- or `E2B_TEMPLATE=<template_name>`
31+
### Governance
32+
- This repo is the source of truth for the official Code0 templates
33+
- Automated publishing can be configured via CI
34+
- For technical details (how to add a template, build/publish, CI setup), see CONTRIBUTING.md
3435

35-
Sandbox names are typically derived from each project’s name.
36+
### Support
37+
- File issues in this repository with the template name and a short description
38+
- For account or infrastructure issues, contact E2B support
3639

37-
## Build & publish (per template)
38-
PowerShell examples:
39-
40-
Using npx (no global install):
41-
```
42-
$env:E2B_API_KEY = "<your_e2b_api_key>"
43-
cd .\nextjs-shadcn\
44-
npx e2b@latest template build
45-
npx e2b@latest template publish
46-
47-
cd ..\nextjs-radixui\
48-
npx e2b@latest template build
49-
npx e2b@latest template publish
50-
```
51-
52-
Or with global CLI:
53-
```
54-
npm i -g e2b
55-
$env:E2B_API_KEY = "<your_e2b_api_key>"
56-
cd .\nextjs-shadcn\ ; e2b template build ; e2b template publish
57-
cd ..\nextjs-radixui\ ; e2b template build ; e2b template publish
58-
```
59-
60-
After publishing, the CLI prints the `template_id`. Use that in your app `.env` as `E2B_TEMPLATE_ID`.
61-
62-
## Build & publish all templates (script)
63-
64-
This repo includes a helper script to build/publish every template under this folder:
65-
66-
```
67-
node ./scripts/build-and-publish.mjs # build + publish all
68-
node ./scripts/build-and-publish.mjs --mode build # build only
69-
node ./scripts/build-and-publish.mjs --mode publish # publish only
70-
```
71-
72-
Requirements: E2B CLI available on PATH (use `npx e2b@latest` or global `e2b`). On Windows, the script spawns with shell support.
73-
74-
## Resource configuration
75-
You can set CPU/RAM per template in `e2b.toml`:
76-
77-
```
78-
cpu_count = 8
79-
memory_mb = 8192
80-
```
81-
82-
Or override at build time:
83-
84-
```
85-
e2b template build --cpu-count 8 --memory-mb 8192
86-
```
87-
88-
## Start command & script path
89-
- `e2b.toml` sets: `start_cmd = "/compile_page.sh"`
90-
- `e2b.Dockerfile` ensures the script exists and is executable:
91-
- `COPY compile_page.sh /compile_page.sh`
92-
- `RUN chmod +x /compile_page.sh`
93-
94-
Always use the absolute path (`/compile_page.sh`) and LF line endings inside the image.
95-
96-
## CI/CD (GitHub Actions example)
97-
```
98-
name: Publish E2B Templates
99-
on:
100-
workflow_dispatch:
101-
push:
102-
branches: [ main ]
103-
jobs:
104-
publish:
105-
runs-on: ubuntu-latest
106-
steps:
107-
- uses: actions/checkout@v4
108-
- uses: actions/setup-node@v4
109-
with:
110-
node-version: 20
111-
- name: Install E2B CLI
112-
run: npm i -g e2b
113-
- name: Build & Publish All Templates
114-
env:
115-
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
116-
run: |
117-
cd sandbox
118-
node ./scripts/build-and-publish.mjs
119-
```
120-
121-
## Troubleshooting
122-
- Docker daemon not running: start Docker Desktop; WSL2 & Linux containers enabled. Verify with `docker version` and `docker run hello-world`.
123-
- Exit 127 / script not found: ensure `start_cmd` is absolute and the script has executable bit and LF line endings.
124-
- Template 404: ensure the template exists in the correct E2B team and you’re using the right `template_id` or name.
125-
- Nested app folder: both Dockerfiles build in `/tmp/app` and copy to `/home/user` to avoid `nextjs-app` nesting.
126-
127-
## Security & license
128-
See `SECURITY.md` and `LICENSE`.
40+
### Security and license
41+
- See SECURITY.md for reporting and handling guidelines
42+
- See LICENSE for terms of use

0 commit comments

Comments
 (0)