How Rough works

Rough empowers your users to build custom features directly inside your app, just by describing what they need. You control where those features can appear and how they can integrate with your data.

collate-hr.com
collate Search

Lara Curtis

  • Personal Info
  • Job Timeline
  • Time Off

People & Culture Manager

Basic Information

Employee #
1005
First name
Lara
Last name
Curtis
Preferred language
English

Employment

Hire date
May 6, 2019
Department
People & Culture
Employment type
Full-time

Reporting

Manager
Maya Chen
Direct reports
3 employees

Describe what you need, and Rough will build a tool for this profile.

Work Location

Office
Toronto Head Office
Work arrangement
Hybrid
Office days
Tue, Wed

Contact

Work email
[email protected]

Rough

Employee profile

  • Onboarding Checklist
  • Training Progress
  • Review History
  • Certifications
  • Equipment Inventory

Untitled feature

What do you want to build?

Describe what you want to generate ↑
Three steps from an empty Feature slot in Lara Curtis’s Collate profile to an embedded Office Days Feature, which Lara uses to add an office day.

Connecting Rough to your app

Connecting Rough starts with three decisions: how to identify your users, what their Features can do, and where those Features appear in your app.

1 Use your app’s sign-in

Your users sign in to your app as usual. When the SDK needs to tell Rough who’s signed in, it calls an endpoint on your server. That endpoint checks the user’s existing session and returns a token (a JWT) that expires within five minutes. It is signed with a key from Rough’s dashboard that never leaves your server. The SDK exchanges it with Rough, so your server never calls Rough directly.

The token carries two IDs. Its subject (sub) is the user’s ID, and the account ID decides who shares Features. Use a team or workspace ID if teammates should share Features, or the user’s own ID if they shouldn’t. Always take both from the session, never from the request.

Your server
app.post('/api/rough/user-token', async (req, res) => {
  const { user, team } = req.session

  const token = await signRoughToken({
    sub: user.id,
    rough: {
      user: { name: user.name },
      account: { id: team.id },
    },
  })

  res.json({ token })
})

2 Define what Features can do

A Surface is a place in your app where Features can appear. In your frontend, you define each Surface and the capabilities its Features can use. Queries read data, Subscriptions keep data up to date, and Mutations make changes.

Each capability has typed inputs and outputs and sample data. Rough receives the schemas and samples, not your code, and uses them to build Features. Previews in the Builder run on the samples. Live capabilities run in your frontend and call your API as the signed-in user, so your backend still checks permissions on every read and write.

Your frontend
const surface = defineRoughSurface({
  toolList: [
    new Mutation({
      name: 'Update record',
      inputSchema: z.object({
        id: z.string(),
        name: z.string(),
      }),
      outputSchema: RecordSchema,
      outputSample: sampleRecord,
      implementation: (input) => {
        return api.records.update(input)
      },
    }),
  ],
})

3 Choose where Features appear

People create and edit Features in the Builder, which opens inside your app. When someone publishes a Feature, the SDK makes it available on its Surface. Your app controls the layout: Features can appear as cards, in their own tabs, or wherever they fit your interface.

In the React example, usePublishedFeatures and RoughFeature are small wrappers in your code around the SDK’s subscribeToRoughFeatures and mountRoughFeature. Each Feature runs in its own sandboxed iframe and updates automatically when a new version is published.

Your app · React
function CustomFeatures() {
  const features = usePublishedFeatures(surface)

  return features.map((feature) => (
    <RoughFeature
      featureId={feature.id}
      surface={surface}
    />
  ))
}

Behind the scenes

Rough builds the Feature from the user’s request, your capability schemas, and sample data. Users preview it with sample data before deciding whether to publish.

Once published, Rough serves the Feature’s files, but live capability calls go through your app, not Rough’s servers.

Rough
Your frontend
Your backend

User Authentication

Rough API
Rough SDK
Your app
Your API
  1. 1

    Rough SDK, Your frontend

    Start the SDK

    The SDK requests a signed token from your backend.

  2. 2

    Your API, Your backend

    Sign a token

    Your API checks the user’s session and returns a short-lived JWT.

  3. 3

    Rough SDK, Your frontend

    Request published Features

    The SDK uses the signed token to connect to Rough and get Features.

  4. 4

    Rough API, Rough

    Return published Features

    Rough verifies the token and returns published Features for this account.

  5. 5

    Your app, Your frontend

    Display published Features

    Your app shows the Features on this Surface.

Building a Feature

Rough Build Agent
Rough Feature Hosting
Your app
Rough SDK
Your app
  1. 1

    Your app, Your frontend

    Define capabilities

    One-time setup: define what Features can do, with schemas and sample data.

  2. 2

    Your app, Your frontend

    Open the Feature Builder

    Your app opens the SDK’s Builder for the selected Surface.

  3. 3

    Rough SDK, Your frontend

    Describe the Feature

    The user tells Rough what to build without leaving your app.

  4. 4

    Rough Build Agent, Rough

    Build the Feature

    The agent builds against your capabilities and compiles static files.

  5. 5

    Rough Feature Hosting, Rough

    Host the build

    Rough stores the compiled files and makes them available for preview.

  6. 6

    Rough SDK, Your frontend

    Preview the Feature

    The user tests with sample data. Preview changes aren’t saved.

  7. 7

    Rough SDK, Your frontend

    Publish the Feature

    The user makes this build the live version of the Feature.

  8. 8

    Your app, Your frontend

    Display the Feature

    Your app shows the published version on the Surface.

Running a Feature

Rough Feature Hosting
Rough SDK
Your app
Rough SDK
Your API
  1. 1

    Rough Feature Hosting, Rough

    Serve the published build

    Rough serves the Feature’s HTML, JavaScript and CSS.

  2. 2

    Rough SDK, Your frontend

    Load in an isolated iframe

    The Feature can’t read your app’s page, cookies or storage.

  3. 3

    Your app, Your frontend

    Run your capability code

    Your code takes validated inputs and returns a result to the SDK.

  4. 4

    Your API, Your backend

    Enforce your permissions

    If your code calls your API, your existing access checks still apply.

  5. 5

    Rough SDK, Your frontend

    Deliver the result

    The SDK sends the result back to the Feature in its iframe.

The sandbox protects your app

Each Feature runs behind a security boundary enforced by the browser. Even if its code tries, it can’t read or change your app’s page, read your app’s cookies or browser storage, open pop-ups, or redirect the tab.

You choose which capabilities a Feature can call. Your code handles those calls, and your backend decides what the signed-in user can access or change.

collate-hr.com
collate Search

Lara Curtis

  • Personal Info
  • Job Timeline
  • Time Off

People & Culture Manager

Basic Information

Employee #
1005
First name
Lara
Last name
Curtis
Preferred language
English

Employment

Hire date
May 6, 2019
Department
People & Culture
Employment type
Full-time

Office Days

Remix
  • Mon Home
  • Tue Office
  • Wed Office
  • Thu Home
  • Fri Home
2 days in the office Save

Work Location

Office
Toronto Head Office
Work arrangement
Hybrid
Office days
Tue, Wed

Contact

Work email
[email protected]
Lara Curtis’s Collate profile with an Office Days Feature in a sandbox, and the browser inspector open beside it. Lara adds Thursday as an office day and saves. The Elements panel selects the Feature’s iframe and lists its sandbox: scripts and forms are allowed, but without allow-same-origin its origin is null, so it has no cookies, storage, or access to the page, and it can’t open windows or navigate the app. The Feature asks Rough to call setOfficeDays, and Rough runs the app’s own setOfficeDays code in the page, which sends a PUT to the app’s API with Lara’s session cookie. The saved week returns to the Feature.

Isolated by the browser. Rough uses a sandboxed iframe without allow-same-origin. The browser gives the Feature an opaque origin, and its same-origin policy blocks direct access to your app’s page and storage—even if both are hosted at the same origin. Rough also leaves pop-ups and top-level navigation disabled in the sandbox.

Features request access through the capabilities you expose, with your backend’s permission checks deciding what the signed-in user can access or change.

Your app stays in control

Features run separately from your app

Each Feature runs in a sandboxed iframe, separate from the rest of your app. It cannot directly read your app’s cookies or browser storage, or inspect and change your page. It interacts with your app through the capabilities you choose to expose.

You own the capabilities

When a Rough Feature calls a capability, the call goes through your app, not Rough’s servers. You control access to your backend and can run capabilities as the signed-in user, using your existing server-side permissions.

Your live data stays in your app

Rough receives limited information to build and manage Features. Live capability data doesn’t pass through Rough’s servers. Our build agent works from your capability schemas and samples—it cannot call your live capabilities.

You own the Feature code

You own the code generated for your Features, including those your customers build, subject to our Terms and third-party licences. Rough hosts the published files your app loads.

Our Infrastructure

App servers and database
Oregon, US
Feature files
Cloudflare R2
AI processing
Your choice of OpenAI or Anthropic

Still have questions?

If something here doesn’t answer how Rough would fit your app, your security review, or your data requirements, get in touch. We’re happy to talk it through.

Contact us