When to use this example
Use this page to understand the full-stack integration model behind the Reference App. Use the SDK repository docs when you are ready to run it locally, configure third-party services, or deploy it. For agreement JSON examples, start with Simple Agreement or Complex Agreement. For focused API workflows, use Deploy an Agreement, Operate a Deployed Agreement, Receive webhooks, Agreement activity webhooks, and Notification webhooks.What the app demonstrates
Architecture at a glance
The app runs independently of internal Shodai services. In local development, the backend defaults to
http://localhost:4199 and the frontend defaults to http://localhost:5184/agreements/.
Agreement lifecycle in the app
The Reference App models the complete customer application path around the Agreements API:- A user signs in through the app’s auth flow.
- The backend mirrors the platform user, contacts, and wallets locally.
- The frontend loads available agreement templates from the backend.
- The backend resolves a selected
templateIdagainst its vendored template catalog. - The user configures draft values, participants, observers, display name, and chain.
- The browser signs an EIP-712 deploy permit with the connected wallet.
- The backend validates the signer and deploys through the Agreements API using
@shodai-network/agreements-api-client. - The deployed agreement view reads agreement details, state, and inputs through the backend.
- When an action is available, the browser signs an input permit.
- The backend submits the input to the Agreements API and refreshes its local mirror.
- Agreement activity webhooks notify the backend about Shodai-side transitions, and the backend reconciles by reading current data from the Agreements API.
- Notification webhooks notify the backend when hosted Shodai notification rules fire, and the backend owns final delivery such as SES email.
App-owned data and Shodai-owned data
The app may cache and mirror deployed agreement data, but Shodai remains the source of truth for deployed agreement state and accepted inputs.
Security boundary
KeepEXTERNAL_API_KEY, SHODAI_WEBHOOK_SECRET, Dynamic server tokens, service tokens, and Mongo credentials on the backend. The frontend should only receive browser-safe configuration such as its own backend URL, Dynamic environment ID, supported chains, and RPC configuration.
Webhook reconciliation in context
The webhook receiver isPOST /shodai/webhooks. For hosted webhook testing against local development, expose backend port 4199 through a public HTTPS tunnel and register the tunnel URL with Shodai.
Webhooks are compact events, not full agreement snapshots. The backend verifies, stores, acknowledges, and processes deliveries. Agreement activity webhooks reconcile the local agreement mirror by reading current agreement data from the Agreements API. Notification webhooks trigger final app-owned delivery, such as sending email through SES.
For the shared receiver pattern, see Receive webhooks. For event-specific behavior, see Agreement activity webhooks and Notification webhooks.
What you can replace
The Reference App is a blueprint, not a required stack.
- keep Shodai credentials server-side
- put a customer-owned backend between the browser and the Agreements API
- let wallets sign deploy and input permits in the browser
- submit signed payloads through a trusted backend
- maintain local product state separately from Shodai-owned canonical agreement state
- reconcile local mirrors from Agreements API reads and webhook deliveries
Run or inspect the app
Use the SDK repository for setup and deployment details:
The app lives at
apps/shodai-reference-app in the SDK repo. The frontend is served at /agreements/. Local development defaults are backend http://localhost:4199 and frontend http://localhost:5184/agreements/. Webhook testing against hosted Shodai requires a public HTTPS tunnel to backend port 4199.
Related pages
- TypeScript client
- Deploy an Agreement
- Operate a Deployed Agreement
- Receive webhooks
- Agreement activity webhooks
- Notification webhooks
- Authentication
- Quickstart with TypeScript SDK
- Run an end-to-end agreement workflow