Backend service for the Scaffold Agent homepage project.
This server provides:
- x402-protected premium endpoint(s)
- chat proxy endpoint (
/api/chat) for DeepChat - markdown and HTML API docs endpoints
UI/app configuration fields (like homepageName, descriptionMarkdown, chatApiUrl, etc.) are managed in:
../main/README.mdunder the## Configurationsection
If you want to change what the homepage/chat app displays, edit values there (not in this deno-server/README.md).
- Deno v1.37+
Set environment variables before starting:
# x402 pay-to address (used by premium-content paywall)
export MOVEMENT_PAY_TO="0xYourMovementWalletAddress"
# Required for /api/chat (DashScope API key)
export DASHSCOPE_API_KEY="sk-your-key"
# Optional server port (default: 4403)
export SERVER_PORT=4403
# Optional (reserved for admin auth logic)
export ADMIN_PWD="your_admin_password"cd deno-server
deno run --allow-net --allow-read --allow-env main.tsxDevelopment watch mode:
deno run --allow-net --allow-read --allow-env --watch main.tsxServer default URL: http://localhost:4403
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Basic server text + pay-to address |
| GET | /health |
Health check JSON |
| GET | /docs |
Raw markdown API docs (apidoc.md) |
| GET | /docs/html |
Rendered HTML docs |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/chat |
Proxies chat requests to DashScope (qwen-plus) |
Request body:
{
"messages": [
{ "role": "user", "content": "Hello" }
]
}Success response:
{
"text": "Hello! How can I help you today?"
}| Method | Endpoint | Cost | Description |
|---|---|---|---|
| GET | /api/premium-content |
1 $MOVE (configured max amount) | Premium content endpoint behind x402 middleware |
- Client requests protected endpoint without
X-PAYMENT. - Server returns
402andX-PAYMENT-RESPONSEpayment requirement payload. - Client retries with
X-PAYMENT. - Server currently allows pass-through in test mode.
Note: verification call to facilitator is present but commented in main.tsx. Re-enable it before production.
# Health
curl http://localhost:4403/health
# Docs markdown
curl http://localhost:4403/docs
# Chat
curl -X POST http://localhost:4403/api/chat \
-H "Content-Type: application/json" \
-d '{"messages":[{"role":"user","content":"Write a hello-world HTML page"}]}'
# Premium endpoint (expect 402 without payment)
curl -i http://localhost:4403/api/premium-contentdeno-server/
├── main.tsx
├── apidoc.md
├── README.md
├── deno.json
└── deno.lock
- Restrict CORS origin (do not use
*in production). - Re-enable and enforce facilitator verification for
X-PAYMENT. - Use HTTPS for all deployments.
- Ensure
DASHSCOPE_API_KEYis configured securely.
See ../LICENSE.