Skip to content
Charming Docs
Esc
navigateopen⌘Jpreview
On this page

Code export

The code behind your app is yours: export it anytime and reuse it anywhere.

What you can do

The code behind your app is yours. It has three parts: the module is the app’s business logic, the ui is the interactive interface, and the styles are the visual look. You can export all three at any time and reuse them: move an app between agents, back it up, or hand it to a different tool. Anyone who can edit the app can export its code; someone with view-only access can’t.

Technical

Exporting source is an agent action, driven through your agent rather than the dashboard.

Copy this prompt for your agent

Export the source for one of my Charming apps so I can reuse it (fork
it into a new app, back it up, or move it to a different agent). Read
https://charm.ing/docs/capabilities/code-export.md first. List my
apps and ask me which one, or if I've only got one, use that, then
export the source.

How an agent performs this job

To export source, an agent calls get_app_source({ app_id }) over MCP or GET /app/<id>/source over HTTP. Both return the same payload: id, url, manifestId, displayName, a monotonic version, capabilities, and source: { module, ui, styles }. To fork that source into a new app, pass source.module (and ui, styles) into a fresh create_app / POST /app call; if you keep the same manifest.id and you’re the owner, create_app replaces your existing app’s stored source in place instead of creating a new row, so bump manifest.id when the fork should live as its own app.

The contract

get_app_source and GET /app/<id>/source require the same edit access as update_app: the caller must be the owner or hold a collaborator (or team-member) grant on the app; get_app_source fails with not_found for anyone else. The HTTP route accepts the original bld_app_* edit token (unclaimed apps) or a signed-in bld_user_* token with that access (claimed apps); a render token or claim cookie is rejected.

Limits and access

  • Who can export. The owner, a collaborator, or a team member with write access can call get_app_source; an end-user or viewer share (read/run only, no edit) can’t.
  • Another way to get a copy. Instead of exporting and re-creating an app yourself, the owner can turn on remixing so visitors get their own copy straight from a shared URL.

Was this page helpful?