- Backend: one token endpoint (the only backend change).
- Frontend: a compose page with
<QirtaasEditor>, a note list driven bylistDocuments(), reopen-to-edit, and delete.
qrt_sk_… API key (see the
Quickstart) and
npm install @qirtaas/react.
1. Backend — add the token endpoint
The editor authenticates every request with a short-lived embed token, and only the secret key holder can mint one. Gate the endpoint with your app’s own auth and pass the authenticated user’s id asexternal_user_id: Qirtaas auto-provisions an identity per distinct id, and
that identity is what scopes each user to their own documents (creation,
listing, and deletion all happen within it).
2. Frontend
Create the client once and share it across your code. The samegetToken
powers the editor and the list/delete operations:
src/qirtaas.ts
3. Frontend — the compose page
Mount<QirtaasEditor> without a documentId: the SDK lazily creates the
document on the first keystroke and hands you the new id via
onDocumentCreated. The editor takes care of persisting any changes.
src/ComposeNote.tsx
onDocumentCreated for navigation concerns (swap /notes/new for
/notes/<id> so a refresh reopens the same note) and onSaveStateChange for
a saved/saving badge.
4. Frontend — Notes Dashboard
listDocuments() returns the identity’s documents:
src/NoteList.tsx
5. Frontend — reopen note
To continue an existing note, pass its id asdocumentId. The component
mounts the editor once, so when the user switches notes, force a remount
with a key:
src/EditNote.tsx
external_user_id, the owner
can reopen and edit any of their documents.
6. Frontend — delete a note
Where you are
Users can author, list, reopen, and delete rich documents, and your backend grew by one endpoint. Next:Document reading
Show these notes read-only with the renderer.
Access control
Let other users read them, gated by your own ACL.
