MainSDK
Search⌘K
How-to

How-to guides

Step-by-step guides by use case - build, store files, add AI, secure and govern, ship and hand over - each ending in a passing mainsdk check.

Updated 2026-10-28

Each guide solves one use case from start to finish: what you need, the steps, how to verify, what to do if it fails, and a prompt for your coding agent. Pick the row that matches what you want to do.

I want to

Use caseGuideInterfaces
Check whether an interface covers my needWhat is coveredall
Build a SaaS, an AI chat, a marketplace or a wallet appStack recipesauth, db, ai, pay, files
Move an app off raw provider SDKsMigrate from raw providersall
Move an app off Supabase, Firebase, Clerk, Auth0, Auth.js, Better Auth or StripeMigrate from Supabase, Firebase, Clerk, Auth0, Auth.js, Better Auth, Stripeauth, db, pay
Start from a tested, production-shaped appSaaS web, API service, Payments checkout, AI agentall
Use MainSDK in a monorepoMonoreposconfig
Translate my appTranslate your appi18n
Let users upload files to S3, Uploadthing, Vercel Blob or getqr.idUpload filesfiles
Share a record, file or screen as a link and QR code, print QR codes, or send invite, deep and sign-in linksShare anythingshare, links
Turn an email or a file into typed data, with a pattern first and a model only when it missesExtract structured dataschema, ai
Add wallet sign-in, token gates or agent paymentsWeb3 and agent paymentsauth, access, pay
Give an app agent a budget and approvalsGovern app agentsai, action
Allow only certain hosts, IPs and rangesRestrict network accessnetwork
Declare the hosts, folders, facts and programs my app usesDeclare what your app usesnetwork, disk, system
See every call, decision and change, in my own toolsSee what your app doeslog, policy
Give enterprise customers SSO, SCIM and an audit logMake your app enterprise readyauth, access, log, privacy
Change a setting or roll out a feature without a deployChange config without a deployconfig, flags
Create a project, add an interface and check my machineStart a projectconfig, log
Give each customer a tenant, API keys, plans and invitesBuild a multi-tenant apptenant, auth, apikeys, entitlements
Decide who can do what, and refuse the restProtect a route with permissionsaccess
Keep policy files in git and explain every decisionKeep policies in gitpolicy
Call a model with limits and auditCall a modelai
Take a payment on a hosted checkoutTake a paymentpay
Expose an action as an endpoint and an MCP toolExpose an action to agentsaction
Give an agent a budget and approvals in a few linesGive an agent a budgetagents
Let an agent remember each customer and forget them on requestGive an app agent memorymemory, ai, agents
Roll a feature out to some usersRoll out with flagsflags
Deploy to VercelDeploy on Vercelconfig, secrets
Use MainSDK from RustUse MainSDK from Rustkv, files, log
Use MainSDK from PythonUse MainSDK from Pythondb, files, log
Use MainSDK from GoUse MainSDK from Godb, files, log
Test offline with fakesTestingtesting
Find out why something failedDebugginglog
Change provider without changing codeSwap a driverall
Leave MainSDK and keep my codeEjectall
Hand a finished app to a clientClient handoverall
Invite a team, sign in with my identity provider and understand the billSet up a team on Teamsall
Call my typed API from React componentsCall your API from Reactapi
Try a policy on a request and see what a change would flipTry a policy in the playgroundpolicy
Publish my actions as a typed API and OpenAPI documentPublish your actions as a typed APIapi
Follow, block and mute, with a home timeline that ends and trending per regionBuild a feed with an endfeeds
Import a customer's spreadsheet, then pull from a partner on a scheduleImport a customer's spreadsheetimports, files
Let an agent act in a customer's Gmail or GitHub, with consentLet an agent act in a customer's accountconnections
Seed demo data and give each git branch a preview databaseSeed demo data and make previewstesting, db
Track product events without identifying peopleTrack product eventsanalytics
Send reminders that bring people back, within limitsSend engagement remindersengagement, notify
Send a receipt, a newsletter with unsubscribe and an order update on the channel a person allowsSend email and notificationsemail, notify
Make, read and convert PDFs and Office documentsMake, read and convert documentsdocuments, pdf, files
Add health probes, SLOs and resource limitsWatch your app's health and resource pressurestatus
Find out about errors before users do, grouped and alertedKnow when your app breakslog, alerts
Page the right person once, with routes, grouping and acknowledgementTell the right person once with alertsalerts
Stop a route, an agent or all writes during an incident, without a deploySwitch things off in an incidentincident
Record consent, export a person's data and erase it with a signed recordHonour consent, export and erasure requestsprivacy
Sign people in from a web pageAdd sign-in to a pageadapters, auth
Run CPU-heavy work off the request threadRun CPU work on workersworkers
Use every core for HTTPRun one instance per corecluster
Limit, meter and gate by planLimits, metering and entitlementslimits, meter, entitlements
Sell my app with signed licence files that switch features on, checked offlineLicense your applicence, entitlements
Issue licences from MainSDK Cloud, with a root, a CA and a second approverIssue licences from the Cloudlicence-cloud
Sign in to the Cloud, send events, read usage and set a billing capUse MainSDK Cloudusage-billing
Add delete with undo, safe edits and non-blocking migrationsChange your database safelydb
Keep a draft or count events with an expiryKeep short-lived valueskv
Make pages fast without sharing one customer's dataCache safelycache
Run work in the background with retriesRun work in the backgroundjobs, events
Verify incoming webhooks and send your ownSend and receive webhookswebhooks, jobs
Sleep, wait and ask for approval in one functionBuild a durable workflowworkflows, events, agents
Show untrusted text safely and send secure headersShow untrusted text safely and protect web responsessanitize, inbound
Protect a file so only the right people open itProtect a file so only the right people open itprotect, share
Share a person's settings or progress between your apps, with consentShare context between your appscontext
Use behaviour norms in your appUse behaviour normsnorms
Check a release's checksums, signatures, provenance and SBOM before you install itVerify a releaserelease
Subscribe to network, access and action events, assert on them in a test, and print them while you debugWatch what your app decidesobserve
Move an existing app onto MainSDK one pull request at a timeAdopt an existing appadopt
Resize uploaded images and transcode video in a background jobProcess uploaded images and videomedia, files
Search your records as the person searchingAdd search to your appsearch
Run a GPU job with a cost limit and keep the result in filesRun a GPU jobcompute, files
Find where your app fails a standard, see owners and deadlines, and keep signed evidenceCheck your app against a standardassure
Take reports, decide with a statement of reasons and export the transparency reportModerate user contentmoderate
Detect brute force and probing and send security events to your SIEMWatch for security eventssecurity
Give a coding agent the docs, types, next action and fixesWork with a coding agentmcp, docs
Rotate a secret without a restartRotate a secretsecrets
Catch made-up, vulnerable and badly licensed packages before they shipCheck your dependenciesdeps
Sign my build, serve its record and check the files at bootSeal your builddeploy, apps
Move my app to a new MainSDK release and learn about security releasesUpgrade MainSDKupgrade
Respond to an attack or CPU pressureRespond to an attack or CPU pressuresignals, playbooks
Link two apps on one machine and ask a neighbour for reliefLink two apps on one machineapps, neighbours
Let a coding agent ask my running app about its state, with every change waiting for meOperate your app with a coding agentops, playbooks
Give my customers API keys with scopes, rotation and instant revokeGive my customers API keys with scopes, rotation and instant revokeapikeys
Block paid features and limits by planBlock paid features and limits by planentitlements
Record and show what each tenant usesRecord and show what each tenant usesmeter
Seal data and erase one person everywhereSeal data and erase one person everywherekeys, crypto
Send a link that opens the right screenSend a link that opens the right screenlinks
Require sign-in on my routesRequire sign-in on my routesauth
Run a user's or an agent's code safelyRun a user's or an agent's code safelysandbox
Read what Fleet pushed and prove it to an auditorRead your Fleet recordsfleet-prove
Emit and react to signals from my appEmit and react to signals from my appsignals
Share a person's settings between your apps, with their consentShare context between your appscontext
Share attack and pressure signals between apps on one machineShare attack and pressure signals between apps on one machineneighbours
Mount MainSDK in Next.js, Hono, Express or WorkersMount MainSDK in Next.js, Hono, Express or Workersadapters
Use tcp and udp sockets in your appUse tcp and udp socketsnet
Enrol my devices, see their health and receive their telemetryEnrol and watch your devicesdevice-identity, device-attest, device-health, device-telemetry
Send commands and policy to my devicesCommand and configure your devicesdevice-commands, device-policy
See every app I run and what is exposedSee every app you runfleet-enrolment, fleet-discover, fleet-observe
Use deploy config and serverless schedules in your appUse deploy config and serverless schedulesdeploy
Use offline-first replication in your appUse offline-first replicationsync
Use realtime updates in your appUse realtime updatesrealtime
Use exfiltration guard and canaries in your appUse exfiltration guard and canariescanary
Use bot defence in your appUse bot defencebots
Use backups and restore drills in your appUse backups and restore drillsbackup
Build a mobile app with ExpoBuild a mobile app with Expotargets, notify
Sign in on a phoneSign in on a phoneauth
Ask for an age or an IDAsk for an age or an IDdigital-ids
Prepare for post-quantum and FIPSPrepare for post-quantum and FIPScrypto
Run on Workers, Deno and BunRun on Workers, Deno and Buntargets
Keep your keys in an HSM or in your customer's own key serviceKeep your keys in an HSM or in your customer's own key servicekeys
Keep personal data in the person's own countryKeep personal data in the person's own countrykeys
Confirm sensitive actions with a signed approvalConfirm sensitive actions with a signed approvalaction
Add an industry pack to your appAdd an industry pack to your appprivacy
Publish a driver to the marketplacePublish a driver to the marketplaceadapters
Send assure results to your GRC, vulnerability and ticket toolsConnect your security and ticket toolsconnectors
Add calendars with recurrence and free/busyUse calendars in your appcalendar
Receive a support inbox and thread repliesReceive and thread emailmail
Generate a video as a durable jobGenerate a videoai, files
Answer phone calls with an AI agentBuild a voice agentai, agents, privacy
Let a model propose a playbook for a person to approvePropose playbooks with the advisoradvisor, playbooks
Use end-to-end encryption in your appUse end-to-end encryptione2e
Use phone, email and identity checks in your appUse phone, email and identity checksverify
Use location in your appUse locationgeo
Use app updates and version blocking in your appUse app updates and version blockingupdates

Interface reference pages say what each call does. Integration pages set up one provider. Architecture pages explain how it works inside. These guides join them into a result.

Was this page helpful?

↑↓ moveEnter openEsc close

Not decided yet