Developer

Project Filesystem (projectFs)

Read and write files in the project folder root from an applet method.

ctx.sdk.projectFs reads and writes files relative to the project folder root, not applet-data. Use it for content that should live with the user’s project tree, such as rendered Markdown, cached HTML, or exported assets.

Scope required: fs:project / fs:project:write

Usage

await ctx.sdk.projectFs.writeFile(
  `${ctx.resourceFolderPath}/cache/feed-${id}.html`,
  rendered
);
const files = await ctx.sdk.projectFs.readDir("rightplace/docs");

ctx.resourceFolderPath is populated for runIn: "frontend" hooks, so you can anchor writes to the calling resource’s own folder.

Read vs write scope

  • fs:project grants read-only access (readFile, readDir, and similar).
  • fs:project:write grants read plus write (writeFile, and the rest). It implies read access, so you do not need to list both.

Manifest configuration

{
  "scopes": [
    "fs:project"
  ]
}

For write access:

{
  "scopes": [
    "fs:project:write"
  ]
}

Notes

  • Paths are relative to the project folder root; projectFs shares the same shape as the applet-data filesystem surface but rooted at the project tree.
  • Anchor resource-scoped writes to ctx.resourceFolderPath, populated for runIn: "frontend" hooks.
  • For structured data, prefer typed entities or projectDb over hand-rolled files.