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
This repository deploys a React app and Hono API as one Cloudflare Worker. D1 stores auth, access rules, metadata, and artifact HTML.
4
-
5
-
- Run `npm run check` after changes.
6
-
- Keep authorization in the Worker. Emails locate pending invitations; durable owner, workspace-viewer, and recipient authorization uses immutable Better Auth user IDs.
3
+
- Keep authorization in the Worker. Emails locate invitations; durable owner, workspace-viewer, and recipient authorization uses immutable Better Auth user IDs.
7
4
- New artifacts stay non-public. Owners and configured workspace viewers may read them until an owner adds recipients or enables public access.
8
5
- Only owners may change artifacts or access. Replacing HTML preserves omitted exact-email, domain, and public settings.
9
-
- Keep the artifact iframe sandbox free of `allow-same-origin`. Artifact HTML is untrusted relative to the authenticated shell.
6
+
-Treat artifact HTML as untrusted. Keep the iframe sandbox free of `allow-same-origin`.
10
7
- Keep one artifact below 512 KiB and total artifact HTML below the 400 MiB application budget.
11
8
- Treat released D1 migrations as append-only. Add a numbered migration for later schema changes.
12
-
- Keep `.dev.vars`, `.env.cloudflare.*`, `wrangler.jsonc`, database exports, and deployment tokens out of git.
13
-
- Keep Node built-ins in scripts and build configuration. Worker and browser code must use runtime-compatible APIs.
14
9
- Update `shared/api.ts`, the Worker route, and the browser client together when an internal contract changes.
15
-
- Use `node scripts/publish.mjs ...` when asked to publish HTML through a configured deployment.
10
+
- Treat setup as the update path. Preserve saved owners, viewers, secrets, database, URL, and custom domain unless the user explicitly replaces them.
11
+
- Keep service deployment separate from artifact publishing. Deployment automation must not receive the publishing token or create artifacts.
12
+
- Keep credentials, deployment configuration, database exports, workspace-viewer invitations, and private artifact URLs out of commits and public reports. Rotate exposed secrets immediately.
Codex Artifacts publishes self-contained HTML files as private, shareable web pages. Coding agents can publish reports, dashboards, plans, and walkthroughs while the deployment owner controls who may open them.
5
+
<h1align="center">Codex Artifacts</h1>
4
6
5
-
Each installation runs in the owner's Cloudflare account. It has separate data, credentials, and a publishing token. There is no shared hosted service.
7
+
<palign="center">Turn an agent's HTML output into a private link you can open and share.</p>
6
8
7
-
**[Explore the public capabilities demo](https://codex-artifacts.none23.workers.dev/?artifact=capabilities-demo)**
9
+
Codex Artifacts is a self-hosted home for reports, dashboards, plans, and walkthroughs made by coding agents. It is useful when a chat response is too cramped, a file is awkward to pass around, or you want to revisit the result later at the same URL.
8
10
9
-
## Set up your service
11
+
Your installation runs in your Cloudflare account. You control its data, credentials, and access. There is no shared hosted service.
10
12
11
-
You need:
13
+
**[Open the public demo](https://codex-artifacts.none23.workers.dev/?artifact=capabilities-demo)**
12
14
13
-
- Node.js 26.7 or later
14
-
- A free Cloudflare account
15
-
- A Google OAuth web client
15
+
## How it works
16
+
17
+
1. Ask your agent to create an artifact.
18
+
2. The agent builds and publishes the page.
19
+
3. The page opens in your browser.
20
+
4. You share it only with the people who need it.
21
+
22
+
Artifacts start private and expire after three days unless you ask for a different lifetime. Reusing an artifact keeps the same URL, which is handy for plans and reports that change over time.
16
23
17
-
### 1. Create the Google OAuth client
24
+
##Install with your agent
18
25
19
-
Create a web OAuth client in Google Cloud Console. Add this local redirect URI:
26
+
You need Node.js 26.7 or later, a Cloudflare account, and a Google account.
27
+
28
+
Give this request to Codex or Claude Code:
20
29
21
30
```text
22
-
http://localhost:5173/api/auth/callback/google
31
+
Install Codex Artifacts for me from https://github.com/none23/codex-artifacts.
32
+
First, ask me for the owner email address and any workspace viewers. Guide me
33
+
through creating a Google OAuth web client, then ask for its client ID and
34
+
secret. Have me enter secrets locally instead of in chat. Ask me to authorize
35
+
Cloudflare when needed. Then deploy the service, link its included skill into
36
+
this agent, verify the deployment, and tell me how to create my first artifact.
23
37
```
24
38
25
-
Copy the client ID and client secret. Setup will print the production redirect URI after the first deployment. Add that URI to the same Google client before signing in.
39
+
The agent can handle the repository, deployment, and skill setup. You will still need to sign in to Cloudflare and create a Google OAuth web client when prompted. Enter secrets locally instead of pasting them into chat.
40
+
41
+
<details>
42
+
<summary><strong>Prefer to install it yourself?</strong> Show the manual steps.</summary>
43
+
44
+
### 1. Create a Google OAuth client
45
+
46
+
Create a web OAuth client in Google Cloud Console. Add this redirect URI:
47
+
48
+
```text
49
+
http://localhost:5173/api/auth/callback/google
50
+
```
26
51
27
-
If you already know the custom domain, add `https://your-domain/api/auth/callback/google` now and pass the domain to setup with `--domain`.
52
+
Copy the client ID and client secret. You will add the production redirect URI after deployment.
Wrangler opens Cloudflare login if needed. Setup then creates D1 storage, applies migrations, deploys the Worker, and prints the service URL and Google callback URL.
66
+
Setup signs in to Cloudflare, creates the required storage, deploys the service, and prints its URL.
43
67
44
-
To use a custom domain already managed by Cloudflare:
68
+
To give someone read-only access to every artifact, add them as a workspace viewer:
45
69
46
70
```sh
47
-
npm run setup -- --owner you@example.com --domain artifacts.example.com
71
+
npm run setup -- --owner you@example.com --viewer teammate@example.com
48
72
```
49
73
50
-
### 3. Finish Google configuration and signin
74
+
### 3. Finish Google sign-in
51
75
52
-
Add the printed production callback URL to the Google OAuth client. Open the service URL and choose **Sign in with Google**. The first matching sign-in accepts the owner invitation.
76
+
Add the production callback URL printed by setup to the same Google OAuth client. Open the service URL and choose **Sign in with Google**.
53
77
54
-
### 4. Install the agent skill
78
+
### 4. Connect your agent
55
79
56
-
Link the included skill for Codex, Claude Code, or both:
80
+
Link the included skill into Codex, Claude Code, or both:
--slug architecture-report # Reuse the URL on future updates
90
-
--share person@example.com # Set additional exact-email recipients
91
-
--share-domain example.com # Set additional recipient domains
92
-
--clear-share # Remove all exact-email recipients
93
-
--clear-share-domain # Remove all recipient domains
94
-
--expires-in 1h # Override the default three-day lifetime
95
-
--expires-in never # Keep the artifact until deletion
96
-
--public # Allow anyone with the link to view
97
-
--private # Revoke public access
98
-
--no-open # Do not open the result in a browser
99
-
-- --option-like-name.html # Publish a filename beginning with "-"
108
+
```text
109
+
Publish this as a private artifact, share it with teammate@example.com, and keep it for one week.
100
110
```
101
111
102
-
Workspace viewers always retain access. On update, `--share` and `--share-domain` replace their respective artifact-specific lists. The corresponding `--clear-*` option removes every rule in that list, while omission preserves it. Use `--public` or `--private` to change public access. Omitting both preserves the current setting. Republishing resets the three-day expiration unless `--expires-in` supplies another duration or `never`.
103
-
104
-
The publisher rejects a process-level URL override paired with a token from the saved configuration. Override `ARTIFACTS_URL` and `ARTIFACTS_PUBLISH_TOKEN` together.
105
-
106
-
If the skill is copied away from this repository instead of linked, set `CODEX_ARTIFACTS_ENV` to the absolute path of `.env.cloudflare.server`.
107
-
108
-
## Identity and access
109
-
110
-
New artifacts start private. Owners and the deployment's workspace viewers can read them immediately. Each artifact may also allow exact email addresses, email domains, or public access.
111
-
112
-
Owner, workspace-viewer, and per-artifact recipient emails are invitations. They are not permanent authorization keys.
113
-
114
-
- Better Auth verifies Google sign-in and assigns an immutable user ID.
115
-
- The first matching sign-in binds an invitation to that user ID.
116
-
- Later requests authorize the bound ID and check that its invitation still exists.
117
-
- Removing an owner or workspace-viewer email and redeploying revokes its access.
118
-
- Removing an artifact email or domain rule invalidates grants created from it.
119
-
- Owners can manage every artifact. Workspace viewers can read every artifact but cannot change them.
120
-
- Per-artifact recipients can read only artifacts shared with their exact email or domain.
121
-
122
-
Owner access wins when an address appears in both deployment lists.
123
-
124
-
Domain invitations are broad. A rule such as `gmail.com` would admit every matching signed-in account. Prefer exact-email invitations for sensitive artifacts.
112
+
The skill handles the publishing commands. You only need to describe the result and who should see it.
125
113
126
-
## Configuration
114
+
## Access and configuration
127
115
128
-
Setup writes these ignored files:
129
-
130
-
-`.env.cloudflare.server` contains the publisher profile and saved setup values.
131
-
-`.env.cloudflare.secrets` contains Worker secrets uploaded during deployment.
132
-
-`.dev.vars` contains secrets for local development.
133
-
-`wrangler.jsonc` binds this clone to its D1 database and deployment settings.
Never commit the ignored configuration, Cloudflare credentials, publishing tokens, database exports, or private artifact URLs.
152
-
153
-
The automation contract remains documented in [openapi.yaml](openapi.yaml).
154
-
155
-
## Operations
156
-
157
-
### Automatic service deployments
158
-
159
-
The GitHub Actions workflow checks every pull request and push to `main`. After a push to `main` passes, its production job applies pending D1 migrations and deploys the Worker. The job does not receive the publishing token and never creates or updates individual artifacts.
118
+
| Owner | Can publish, update, delete, and manage access for every artifact |
119
+
| Workspace viewer | Can read every artifact but cannot change anything |
120
+
| Artifact recipient | Can read one artifact shared with their email address or email domain |
121
+
| Public access | Anyone with the link can read that artifact |
160
122
161
-
Create a `production` environment in the GitHub repository with:
123
+
Prefer exact email addresses for sensitive artifacts. Sharing with a domain gives every signed-in account on that domain access.
162
124
163
-
| Name | Kind | Value |
164
-
| --- | --- | --- |
165
-
|`ARTIFACTS_URL`| Environment variable | The deployed service origin |
166
-
|`CLOUDFLARE_ACCOUNT_ID`| Environment secret | The target Cloudflare account ID |
167
-
|`CLOUDFLARE_API_TOKEN`| Environment secret | A token restricted to the target account with Workers Scripts and D1 edit access |
168
-
|`CLOUDFLARE_WRANGLER_CONFIG`| Environment secret | The full contents of the ignored production `wrangler.jsonc`|
169
-
170
-
Restrict the environment's deployment branches to the selected branch `main`. This prevents workflows on other branches from requesting the production secrets.
171
-
172
-
The Wrangler configuration contains deployment metadata rather than Worker secrets, but storing it as an environment secret keeps owner and viewer email lists out of the public repository. Better Auth, Google OAuth, and publishing secrets remain stored in Cloudflare and survive normal Worker deployments.
173
-
174
-
### Manual service update
175
-
176
-
```sh
177
-
git pull --ff-only
178
-
npm run check
179
-
npm run setup
180
-
```
181
-
182
-
Setup preserves existing owners, viewers, secrets, database, URL, and custom domain unless command options replace them. It applies pending migrations before deployment.
183
-
184
-
### Back up D1
185
-
186
-
```sh
187
-
npx wrangler d1 export DB --remote \
188
-
--config wrangler.jsonc \
189
-
--output codex-artifacts-backup.sql
190
-
```
191
-
192
-
Keep exports private. They contain artifact HTML, identities, sessions, invitations, and access rules.
193
-
194
-
### Rotate secrets or change access lists
195
-
196
-
Edit `.env.cloudflare.server`, export any changed Google values if needed, then run `npm run setup`. To replace workspace viewers from the command line:
197
-
198
-
```sh
199
-
npm run setup -- --viewer one@example.com,two@example.com
200
-
npm run setup -- --clear-viewers
201
-
```
202
-
203
-
Changing `PUBLISH_TOKEN` takes effect at deployment. Update any separate publisher configuration that copied the old token. If GitHub deployment is configured, replace the `CLOUDFLARE_WRANGLER_CONFIG` environment secret after `wrangler.jsonc` changes so later deployments retain the new access lists and routes.
204
-
205
-
## Security and capacity
206
-
207
-
Artifact HTML is untrusted. The app renders it through `srcDoc` in an iframe sandbox without `allow-same-origin`. Scripts, forms, popups, downloads, and outbound requests are allowed inside the artifact. An artifact can transmit data embedded in its own HTML. Downloaded HTML is not sandboxed when opened directly.
208
-
209
-
The publishing token has owner-level automation authority. Anyone holding it can create artifacts and replace an artifact whose slug they know.
210
-
211
-
The service limits each artifact to 512 KiB and total artifact HTML to 400 MiB. A free D1 database allows 500 MB, leaving roughly 100 MB for auth data, access records, and indexes. Cloudflare's free plan also limits Worker requests and D1 operations. Monitor usage in the Cloudflare dashboard before production traffic approaches those ceilings.
212
-
213
-
Reads reject expired artifacts immediately. An hourly Cron Trigger reclaims expired rows, and publishing also removes expired rows before checking capacity.
214
-
215
-
## Local development
216
-
217
-
After setup has written `.dev.vars` and `wrangler.jsonc`:
218
-
219
-
```sh
220
-
npx wrangler d1 migrations apply DB --local --config wrangler.jsonc
221
-
npm run dev
222
-
```
223
-
224
-
Run the full check before committing:
225
-
226
-
```sh
227
-
npm run check
228
-
```
229
-
230
-
Local D1 data persists under `.wrangler/`. Google sign-in needs the local callback URL listed on the OAuth client.
231
-
232
-
## How it works
125
+
Setup saves the deployment configuration and secrets in ignored local files. Keep the repository clone, keep those files private, and rerun `npm run setup` when you need to change the installation. `npm run setup -- --help` lists the available settings.
233
126
234
-
Cloudflare Workers hosts the Hono API and Vite-built React app. Better Auth stores Google users and sessions in D1. D1 also stores artifact metadata, access rules, and HTML in one row so publication stays atomic. The browser talks to a typed internal client, while automation uses the stable bearer-token HTTP API. HTML previews inject an `about:srcdoc` base URL at render time so fragment links stay inside the artifact without changing stored or downloaded HTML.
127
+
For security reporting and secret-handling guidance, read [SECURITY.md](SECURITY.md). For development setup and contribution rules, read [CONTRIBUTING.md](CONTRIBUTING.md).
235
128
236
129
Codex Artifacts is independent and is not affiliated with or endorsed by OpenAI or Anthropic.
Copy file name to clipboardExpand all lines: SECURITY.md
-4Lines changed: 0 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,3 @@ Include:
16
16
- Any suggested mitigation
17
17
18
18
Do not test against a deployment you do not own or have explicit permission to assess.
19
-
20
-
## Deployment secrets
21
-
22
-
Publishing tokens, Cloudflare tokens, Google OAuth secrets, `.dev.vars`, `.env.cloudflare.*`, `wrangler.jsonc`, database exports, workspace-viewer invitations, and private artifact URLs must not be committed or included in reports. Rotate a secret immediately if it is exposed.
0 commit comments