Example Apps
Complete working examples for the most common Gao Internet dApps. Each example uses @gao/system-sdk and follows Gao design patterns.
Example 1 — Seal Agent (Nail Salon / Restaurant)
AI-powered business assistant for SMBs. Handles booking, reminders, and payments.
Layers used: Intelligence (L8) + Settlement (L4) + Transport (L6)
import { GaoSDK } from '@gao/system-sdk'
const sdk = new GaoSDK({ domain: 'alicenails.gao', apiKey })
// 1. Customer sends booking request via chat
async function handleBookingRequest(customerDomain: string, message: string) {
const cap = await sdk.developer.capability.request('intelligence:agent:run', sdk.domain, 3600)
// Run booking agent
for await (const chunk of sdk.intelligence.runAgentStream('booking-agent', message)) {
if (chunk.type === 'text') streamToChat(chunk.delta)
if (chunk.type === 'artifact') confirmBooking(chunk)
if (chunk.type === 'done') scheduleReminders(customerDomain)
}
}
// 2. Schedule reminder 24h before appointment
async function scheduleReminders(customerDomain: string) {
await sdk.intelligence.scheduler.create({
agent_id: 'reminder-agent',
owner_domain: sdk.domain,
trigger_type: 'cron',
trigger_config: { expression: '0 9 * * *', timezone: 'America/Chicago' },
})
}
// 3. Send confirmation via Meshii
async function sendConfirmation(customerDomain: string, details: BookingDetails) {
await sdk.transport.message.send({
to: customerDomain,
content: `Confirmed: ${details.service} on ${details.date} at ${details.time}`,
type: 'notification',
})
}
// 4. Process payment deposit
async function chargeDeposit(customerDomain: string, amount: string) {
const cap = await sdk.developer.capability.request('settlement:intent:create', sdk.domain, 300)
const intent = await sdk.settlement.createIntent({
amount,
currency: 'USDC',
recipient: sdk.domain,
idempotency_key: crypto.randomUUID(),
capability: cap.token,
})
const valid = await sdk.settlement.validateReceipt(intent.receipt)
if (!valid) throw new Error('Payment receipt invalid')
return intent
}
---
### Example 2 — Payii Checkout
Embedded payment widget for any Gao dApp.
**Layers used:** Settlement (L4) + Identity (L5)
import { GaoSDK } from '@gao/system-sdk'
import { usePayment, useIdentity } from '@gao/system-sdk/react'
// React component
function PayiiCheckout({ amount, recipient, orderId }: CheckoutProps) {
const sdk = useGaoSDK()
const { createIntent, receipt, status, error } = usePayment(sdk)
const { resolve } = useIdentity(sdk)
const handlePay = async () => {
// Verify merchant identity first
const merchant = await resolve(recipient)
if (!merchant) throw new Error('Merchant domain not found')
// Create payment
await createIntent({
amount,
currency: 'USDC',
recipient,
idempotency_key: orderId,
capability: 'settlement:intent:create',
})
}
return (
<div>
{status === 'idle' && <Button onClick={handlePay}>Pay {amount} USDC</Button>}
{status === 'pending' && <Spinner>Processing...</Spinner>}
{status === 'confirmed' && <Success receipt={receipt} />}
{error && <Error message={error.message} />}
</div>
)
}
// Watching finality on server side
async function confirmPayment(intentId: string) {
const finality = await sdk.settlement.watchFinality(intentId)
if (finality.status === 'confirmed') {
await fulfillOrder(intentId)
await sdk.transport.message.send({
to: customerDomain,
content: 'Payment confirmed. Your order is being processed.',
type: 'notification',
})
}
}
Example 3 — Meshii Chat App
Private E2EE messaging application built on Meshii Protocol.
Layers used: Transport (L6) + Identity (L5)
import { GaoSDK, GaoAuth } from '@gao/system-sdk'
// Auth with Passkey
const auth = new GaoAuth()
const assertion = await auth.login()
const { domain, token } = await auth.completeLogin(assertion)
const sdk = new GaoSDK({ domain, token })
// Start a conversation
async function startConversation(recipientDomain: string) {
const recipient = await sdk.identity.resolve(recipientDomain)
if (!recipient) throw new Error('Recipient not found on Gao')
return { domain: recipientDomain, identity: recipient }
}
// Send message
async function sendMessage(to: string, content: string) {
await sdk.transport.message.send({
to,
content,
type: 'text',
encrypted: true,
})
}
// Listen for incoming messages
function subscribeToMessages(onMessage: (msg: IncomingMessage) => void) {
const unsub = sdk.transport.message.subscribe((msg) => {
onMessage(msg)
})
return unsub
}
// React component
function ChatWindow({ contactDomain }: { contactDomain: string }) {
const [messages, setMessages] = useState<Message[]>([])
const sdk = useGaoSDK()
useEffect(() => {
const unsub = sdk.transport.message.subscribe((msg) => {
setMessages(prev => [...prev, msg])
})
return unsub
}, [sdk])
return (
<div>
{messages.map(msg => <MessageBubble key={msg.id} message={msg} />)}
<MessageInput onSend={(content) => sendMessage(contactDomain, content)} />
</div>
)
}
---
### Example 4 — Encrypted File Vault
Secure file storage with GaoStorage (DePIN).
**Layers used:** DePIN (L7) + Identity (L5)
import { GaoSDK } from '@gao/system-sdk'
const sdk = new GaoSDK({ domain: 'myvault.gao', apiKey })
async function uploadFile(file: File) {
const cap = await sdk.developer.capability.request(
'infrastructure:storage:write', sdk.domain, 3600
)
const buffer = await file.arrayBuffer()
const receipt = await sdk.infrastructure.storage.upload(
new Uint8Array(buffer),
{
encrypted: true,
redundancy: 3,
content_type: file.type,
}
)
await saveFileRecord({
cid: receipt.cid,
filename: file.name,
size: file.size,
encrypted: true,
uploaded_at: new Date(),
})
return receipt.cid
}
async function downloadFile(cid: string, filename: string) {
const data = await sdk.infrastructure.storage.download(cid)
const blob = new Blob([data])
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = filename
a.click()
URL.revokeObjectURL(url)
}
async function shareFile(cid: string, recipientDomain: string) {
await sdk.transport.message.send({
to: recipientDomain,
content: JSON.stringify({ type: 'file_share', cid, sender: sdk.domain }),
type: 'notification',
})
}
Example 5 — Daily Report Automation
Scheduled AI agent that generates and sends a daily report.
Layers used: Intelligence (L8) + Transport (L6) + Settlement (L4)
import { GaoSDK } from '@gao/system-sdk'
const sdk = new GaoSDK({ domain: 'reports.gao', apiKey })
const reportAgent = await sdk.intelligence.createAgent({
agent_id: 'daily-sales-report',
name: 'Daily Sales Report Agent',
owner_domain: 'reports.gao',
version: '1.0.0',
description: 'Generates and sends daily sales reports at 9am',
purpose: 'reporting',
risk_tier_default: 'LOW',
allowed_capabilities: [
'intelligence:agent:run',
'intelligence:sandbox:execute',
'transport:message:send',
'developer:connector:gmail:send',
],
status: 'active',
})
const job = await sdk.intelligence.scheduler.create({
agent_id: reportAgent.agent_id,
owner_domain: 'reports.gao',
trigger_type: 'cron',
trigger_config: {
expression: '0 9 * * *',
timezone: 'America/Chicago',
},
priority: 'normal',
retry_policy: { max_retries: 3, backoff: 'exponential' },
})
console.log(`Report scheduled: ${job.job_id}`)
console.log(`Next run: ${job.next_run}`)
---
### Example 6 — DAO Governance Interface
Domain-verified voting and proposal system.
**Layers used:** Identity (L5) + Transport (L6) + Intelligence (L8)
import { GaoSDK } from '@gao/system-sdk'
const sdk = new GaoSDK({ domain: 'gov.gao', apiKey })
async function verifyMember(voterDomain: string, walletAddress: string): Promise`<boolean>` {
const record = await sdk.identity.resolve(voterDomain)
if (!record) return false
return sdk.identity.isOwner(voterDomain, walletAddress)
}
async function submitVote(
proposalId: string,
vote: 'yes' | 'no' | 'abstain',
voterDomain: string,
signature: string
) {
const message = `vote:${proposalId}:${vote}:${Date.now()}`
const valid = await sdk.identity.verifySignature(voterDomain, message, signature)
if (!valid) throw new Error('Invalid vote signature')
await saveVote({ proposalId, voterDomain, vote, signature })
await sdk.transport.message.send({
to: proposalAuthorDomain,
content: `New vote on GIP-${proposalId}: ${vote} from ${voterDomain}`,
type: 'notification',
})
}
async function summarizeProposal(proposalText: string): Promise`<string>` {
const session = await sdk.intelligence.runAgent(
'summary-agent',
`Summarize this governance proposal in 3 bullet points: ${proposalText}`
)
const result = await sdk.intelligence.getSession(session.session_id)
return result.context.output as string
}
Example 7 — Domain Explorer
Public lookup tool for .gao domains.
Layers used: Identity (L5) only
import { GaoSDK } from '@gao/system-sdk'
const sdk = new GaoSDK({ environment: 'production' })
async function lookupDomain(domain: string) {
const record = await sdk.identity.resolve(domain)
if (!record) {
return { found: false }
}
return {
found: true,
domain: record.domain,
owner: record.owner_address,
publicKey: record.public_key,
records: record.records,
lastUpdated: new Date(record.updated_at * 1000),
}
}
---
### Starter Templates
AI agent app (Seal-style)
npx create-gao-app --template seal-agent
Payment checkout
npx create-gao-app --template payii-checkout
Messaging app
npx create-gao-app --template meshii-chat
Full dApp (all layers)
npx create-gao-app --template full-dapp
Each template includes:
- `@gao/system-sdk` configured
- Passkey auth flow
- shadcn/ui + Tailwind design system
- TypeScript strict mode
- Vercel deploy config
- Example `.env.local`
---
### Next Steps
- https://studio.gao — build and deploy agents visually without code