Browse topics
Projects API
Read project metadata from your custom resource.
Projects API
The Projects API provides read-only access to project metadata. Use it to list all projects or get the project that owns the current resource.
Capability required: projects:read
Frontend (iframe)
import { createResourceClient } from "@rightplace/sdk";
const rp = createResourceClient();
await rp.ready();
// Get the project that owns this resource
const current = await rp.projects.getCurrent();
// -> { id: "abc123", name: "My Site", icon: "globe", color: "#3b82f6" }
// List all projects
const all = await rp.projects.list();
// -> [{ id: "abc123", name: "My Site", ... }, { id: "def456", name: "Blog", ... }]
Backend (Node.js)
import { createResourceServer } from "@rightplace/sdk/server";
const server = createResourceServer({
methods: {
getProjectInfo: async (_params, { rp }) => {
const project = await rp.projects.getCurrent();
return { projectName: project.name };
},
listAllProjects: async (_params, { rp }) => {
return await rp.projects.list();
},
},
});
server.start();
API Reference
rp.projects.getCurrent()
Returns the project that owns the current resource.
| Parameter | Type | Description |
|---|---|---|
| Returns | Promise<ProjectInfo> | The owning project |
rp.projects.list()
Returns all projects in the workspace.
| Parameter | Type | Description |
|---|---|---|
| Returns | Promise<ProjectInfo[]> | All projects |
ProjectInfo
| Field | Type | Description |
|---|---|---|
id | string | Project ID |
name | string | Project name |
icon | string | null | Icon identifier |
color | string | null | Header color (hex) |
Manifest Configuration
{
"capabilities": [
"projects:read"
]
}
Notes
- This API is read-only. Resources cannot create, update, or delete projects.
- The
folderPathis not exposed for security reasons. Use the Project Filesystem API to access project files.