llms.txt
Compare with other sites' llms.txt files →# Stack0
> Application products for building, deploying, staffing, and understanding software. Includes the Pylon framework, Stack0 Build, Stack0 Cloud, Stack0 Agents, Stack0 Analytics, Stack0 SEO, Stack0 Feedback, Stack0 Studio, and managed Stack0 APIs.
## Machine-readable resources
Every entry point an agent needs, at a stable URL.
| Resource | URL | Format |
| --- | --- | --- |
| This file | https://www.stack0.dev/llms.txt | Markdown |
| OpenAPI specification | https://www.stack0.dev/openapi.json | OpenAPI 3.1 (JSON) |
| OpenAPI specification (API host) | https://api.stack0.dev/openapi.json | OpenAPI 3.1 (JSON) |
| MCP endpoint (APIs) | https://api.stack0.dev/mcp | MCP, Streamable HTTP, API key |
| MCP endpoint (products) | https://cloud.stack0.dev/mcp | MCP, Streamable HTTP, OAuth |
| MCP server card | https://www.stack0.dev/.well-known/mcp.json | SEP-1649 (JSON) |
| MCP manifest | https://www.stack0.dev/.well-known/mcp | SEP-1960 (JSON) |
| MCP manifest (IETF) | https://www.stack0.dev/.well-known/mcp-server | draft-serra (JSON) |
| Sitemap | https://www.stack0.dev/sitemap.xml | XML |
| Documentation | https://www.stack0.dev/docs | HTML and Markdown |
| MCP server guide | https://www.stack0.dev/docs/mcp | HTML and Markdown |
| CLI guide | https://www.stack0.dev/docs/cli | HTML and Markdown |
| Authentication | https://www.stack0.dev/docs/authentication | HTML and Markdown |
| Rate limits | https://www.stack0.dev/docs/rate-limits | HTML and Markdown |
| Versioning and deprecation | https://www.stack0.dev/docs/versioning | HTML and Markdown |
| Error reference | https://www.stack0.dev/docs/errors | HTML and Markdown |
| Webhooks | https://www.stack0.dev/docs/api-reference | HTML and Markdown |
| Service status | https://www.stack0.dev/status | HTML and Markdown |
| About | https://www.stack0.dev/about | HTML and Markdown |
| Contact | https://www.stack0.dev/contact | HTML and Markdown |
### Markdown content negotiation
Every page on www.stack0.dev serves a Markdown representation from the same URL.
Send `Accept: text/markdown`, or append `.md` to any path. Responses carry
`Content-Type: text/markdown; charset=utf-8` and `Vary: Accept`.
```bash
curl -H "Accept: text/markdown" https://www.stack0.dev/docs/quickstart
curl https://www.stack0.dev/docs/quickstart.md
```
### Packages
Published on npm:
| Package | Install | What it is |
| --- | --- | --- |
| `@stack0/sdk` | `npm install @stack0/sdk` | TypeScript SDK for every product |
| `@stack0/cli` | `npm install -g @stack0/cli` | Command-line tool, installs the `stack0` binary |
| `@stack0/elements` | `npm install @stack0/elements` | React components for uploads, avatars, and galleries |
The Python, Ruby, Go, and PHP SDKs are open source but are not yet on PyPI,
RubyGems, pkg.go.dev, or Packagist. Install them from source:
| Language | Repository |
| --- | --- |
| Python | https://github.com/stack0dev/sdk-python |
| Ruby | https://github.com/stack0dev/sdk-ruby |
| Go | https://github.com/stack0dev/sdk-go |
| PHP | https://github.com/stack0dev/sdk-php |
## What is Stack0?
Stack0 is one platform of six products for building, deploying, staffing, and understanding web applications. One account and one subscription ($20/month, including $10 of monthly usage credits) cover every product; usage beyond the credits is metered per service. Pylon is free and MIT licensed to self-host.
Naming notes: Mast (mastagents.com) is now Stack0 Agents. Revtrail is now Stack0 Analytics. Pylon Cloud is now Stack0 Cloud. Apps deployed through Stack0 Cloud run at `<slug>.stack0.app`.
## Products
| Product | Overview | Purpose |
| --- | --- | --- |
| Pylon | https://www.stack0.dev/products/pylon | Open-source realtime full-stack TypeScript framework with a Rust core. It includes a database, authentication, row-level policies, APIs, and live queries. |
| Stack0 Build | https://www.stack0.dev/products/build | Application builder that turns a plain-language description into a normal Pylon project. You can edit, export, or deploy the source. |
| Stack0 Cloud | https://www.stack0.dev/products/cloud | Managed hosting and operations for Pylon applications. Deployed apps run at `<slug>.stack0.app`. |
| Stack0 Agents | https://www.stack0.dev/products/agents | A team of agents that works in Google (Gmail, Calendar, Drive, Sheets), runs routines on a schedule, and waits for approval past the limits you write. Runs at agents.stack0.dev. Formerly Mast (mastagents.com). |
| Stack0 Analytics | https://www.stack0.dev/products/analytics | Product and revenue analytics with cookieless tracking by default. |
| Stack0 SEO | https://www.stack0.dev/products/seo | Google Search Console reports with a label on every search, keyword volume and difficulty (DataForSEO, billed as usage at cost plus 50%), index tracking for sitemap pages, and a weekly site audit. Runs at seo.stack0.dev. MCP tools: seo_list_sites, seo_get_search_report, seo_get_index_report, seo_get_audit, seo_start_crawl. |
| Stack0 Feedback | https://www.stack0.dev/products/feedback | Public feedback boards, voting, roadmaps, and changelogs. Runs at feedback.stack0.app. |
| Stack0 Studio | https://www.stack0.dev/products/studio | Short videos for a brand, written from its website, photos, and footage, with a voiceover and music. Runs at studio.stack0.dev. Videos are bought in packs. |
| Stack0 Launch | https://www.stack0.dev/launch | Done-for-you website service for small businesses. Stack0 rebuilds an existing website on Pylon, hosts it on Stack0 Cloud, and makes changes on request. $200/month including $25 of usage. Start at https://launch.stack0.dev/start; the customer pays after a price is sent. |
| Stack0 APIs | https://www.stack0.dev/products/apis | Managed APIs for email, files, video, screenshots, extraction, workflows, and integrations. |
API detail pages remain under `https://www.stack0.dev/apis/{product}`.
## Stack0 APIs
Stack0 APIs provide managed infrastructure services for web applications:
- **Email Service**: Send transactional and marketing emails with templates, tracking, and analytics
- **CDN**: Asset storage and delivery with on-the-fly image transformations
- **Integrations**: Unified API to connect your users' third-party apps (CRM, storage, communication, productivity)
- **Webdata**: Screenshots, AI extraction, recursive **crawl**, URL **map**, PDF/DOCX **documents** parsing, **actions** (click/type/scroll), **stealth** mode
- **Workflows**: Multi-step AI pipelines with sequential/parallel execution and variable passing
- **Domain Management**: Custom domain verification and DNS management
The $20/month subscription covers every product and includes $10 of monthly usage credits; usage beyond the credits is metered per service.
## Quick Start
### 1. Create an Account
Sign up at https://app.stack0.dev and create your first organization.
### 2. Get Your API Key
Navigate to Settings → API Keys in your dashboard and generate a new API key.
### 3. Install the SDK
```bash
npm install @stack0/sdk
# or
bun add @stack0/sdk
```
### 4. Install Elements (Optional)
Pre-built React components for file uploads, avatars, and image galleries:
```bash
# Install the package
npm install @stack0/elements
# Or with shadcn CLI (recommended)
npx shadcn@latest add https://www.stack0.dev/r/file-upload
npx shadcn@latest add https://www.stack0.dev/r/avatar-upload
npx shadcn@latest add https://www.stack0.dev/r/logo-upload
npx shadcn@latest add https://www.stack0.dev/r/image-gallery
npx shadcn@latest add https://www.stack0.dev/r/image
```
### 5. Send Your First Email
```typescript
import { Stack0 } from '@stack0/sdk';
const stack0 = new Stack0({
apiKey: process.env.STACK0_API_KEY,
});
await stack0.mail.send({
from: 'hello@yourdomain.com',
to: 'user@example.com',
subject: 'Welcome to our app!',
html: '<h1>Thanks for signing up!</h1>',
});
```
### 6. Upload Your First Asset
```typescript
const asset = await stack0.cdn.upload({
projectSlug: 'my-project',
file: imageBuffer,
filename: 'hero.jpg',
mimeType: 'image/jpeg',
});
console.log(asset.cdnUrl); // https://cdn.stack0.dev/...
```
### 7. Capture Your First Screenshot
```typescript
const screenshot = await stack0.screenshots.captureAndWait({
url: 'https://example.com',
format: 'png',
fullPage: true,
blockAds: true,
});
console.log(screenshot.imageUrl); // https://cdn.stack0.dev/screenshots/...
```
### 8. Extract Data with AI
```typescript
const extraction = await stack0.extraction.extractAndWait({
url: 'https://example.com/product',
mode: 'schema',
schema: {
type: 'object',
properties: {
title: { type: 'string' },
price: { type: 'number' },
},
},
});
console.log(extraction.extractedData); // { title: '...', price: 29.99 }
```
### 9. Connect Your Users' Apps (Integrations)
```typescript
// List contacts from any connected CRM (HubSpot, Salesforce, Pipedrive)
const contacts = await stack0.integrations.crm.listContacts({
connectionId: 'conn_abc123', // User's connection ID
});
// Upload a file to user's Google Drive, Dropbox, or OneDrive
await stack0.integrations.storage.uploadFile({
connectionId: 'conn_def456',
name: 'report.pdf',
content: fileBuffer,
folderId: 'folder_123',
});
// Send a message to user's Slack channel
await stack0.integrations.communication.sendMessage({
connectionId: 'conn_ghi789',
channelId: 'C1234567890',
text: 'Hello from your app!',
});
```
### 10. Run an AI Workflow
```typescript
// Run a multi-step AI pipeline
const result = await stack0.workflows.runAndWait({
projectSlug: 'my-project',
workflowId: 'content-pipeline',
variables: {
topic: 'AI in Healthcare',
},
});
console.log(result.output); // Generated content from all steps
```
## Elements - React Components
`@stack0/elements` provides pre-built React components for common file handling patterns when working with Stack0 CDN.
### Installation
```bash
# Using npm
npm install @stack0/elements
# Using pnpm
pnpm add @stack0/elements
# Using bun
bun add @stack0/elements
# Using shadcn CLI (recommended - copies components to your project)
npx shadcn@latest add https://www.stack0.dev/r/file-upload
npx shadcn@latest add https://www.stack0.dev/r/avatar-upload
npx shadcn@latest add https://www.stack0.dev/r/logo-upload
npx shadcn@latest add https://www.stack0.dev/r/image-gallery
npx shadcn@latest add https://www.stack0.dev/r/image
```
Required peer dependencies:
```bash
npm install class-variance-authority clsx tailwind-merge lucide-react
```
### Available Components
- **FileUpload**: Drag-and-drop file upload with progress tracking and multi-file support
- **AvatarUpload**: Circular avatar upload with preview, fallback initials, and remove functionality
- **LogoUpload**: Rectangular logo upload with multiple aspect ratios and SVG support
- **ImageGallery**: Responsive image grid with lightbox, selection, and action support
- **Image**: next/image wrapper optimized for Stack0 CDN with built-in transforms
### Upload Handler Pattern
Elements use a handler pattern that works with any backend. Your server handles authentication and returns presigned URLs:
```typescript
// Client-side usage
import { FileUpload, createStack0Handler } from '@stack0/elements'
const handler = createStack0Handler({
endpoint: '/api/upload', // Your API endpoint
})
<FileUpload handler={handler} />
```
```typescript
// Server-side API route (Next.js App Router)
// app/api/upload/route.ts
import { stack0 } from '@stack0/sdk'
export async function POST(request: Request) {
const { filename, mimeType, size, folder } = await request.json()
const result = await stack0.cdn.createUpload({
filename,
mimeType,
size,
folder,
public: true,
})
return Response.json({
uploadUrl: result.uploadUrl,
assetId: result.assetId,
})
}
```
### Custom Upload Handler
Create your own handler for any backend:
```typescript
import { FileUpload, type UploadHandler } from '@stack0/elements'
const customHandler: UploadHandler = {
getUploadUrl: async (file) => {
const response = await fetch('/api/upload', {
method: 'POST',
body: JSON.stringify({
filename: file.name,
mimeType: file.type,
size: file.size,
}),
})
const data = await response.json()
return {
uploadUrl: data.uploadUrl,
assetId: data.assetId,
}
},
onUploadComplete: async (assetId, file) => {
await fetch(`/api/upload/${assetId}/confirm`, { method: 'POST' })
return { url: `https://cdn.example.com/${assetId}` }
},
onError: (error, file) => {
console.error(`Upload failed for ${file.name}:`, error)
},
}
<FileUpload handler={customHandler} />
```
### Component Examples
#### FileUpload
```tsx
import { FileUpload, createStack0Handler } from '@stack0/elements'
const handler = createStack0Handler({ endpoint: '/api/upload' })
<FileUpload
handler={handler}
accept={{ 'image/*': ['.jpg', '.png', '.gif'] }}
maxFiles={5}
maxSize={10 * 1024 * 1024} // 10MB
onFilesChange={(files) => console.log(files)}
/>
```
#### AvatarUpload
```tsx
import { AvatarUpload, createStack0Handler } from '@stack0/elements'
const handler = createStack0Handler({ endpoint: '/api/upload', folder: '/avatars' })
<AvatarUpload
handler={handler}
value={user.avatarUrl}
onChange={(url) => updateUser({ avatarUrl: url })}
fallback={user.initials}
size="lg"
/>
```
#### Image (CDN-optimized)
```tsx
import { Image } from '@stack0/elements'
<Image
src="https://cdn.stack0.dev/assets/photo.jpg"
alt="Photo"
width={800}
height={600}
quality={85}
format="webp"
/>
```
## CDN API Reference
The CDN API enables you to upload, manage, and transform assets. All CDN operations are project-scoped using `projectSlug`.
### Upload File
Upload files directly with the high-level `upload` method:
```typescript
const asset = await stack0.cdn.upload({
projectSlug: 'my-project',
file: fileBuffer, // Blob, Buffer, or ArrayBuffer
filename: 'photo.jpg',
mimeType: 'image/jpeg',
folder: '/images/avatars', // Optional folder path
metadata: { userId: 'user_123' }, // Optional custom metadata
});
// Response
{
id: 'asset_abc123',
filename: 'photo.jpg',
originalFilename: 'photo.jpg',
mimeType: 'image/jpeg',
size: 102400,
type: 'image',
cdnUrl: 'https://cdn.stack0.dev/...',
width: 1920,
height: 1080,
status: 'ready',
folder: '/images/avatars',
createdAt: Date
}
```
Note: after upload, the file's bytes are verified against the declared `mimeType`. If they contradict it (e.g. a JPEG uploaded as `video/mp4`), the asset's `type` and `mimeType` are corrected automatically. Files declared as video or audio that cannot be decoded are marked `status: 'failed'`.
### Upload with Watermark
Automatically apply a watermark to images during upload:
```typescript
const asset = await stack0.cdn.upload({
projectSlug: 'my-project',
file: photoBuffer,
filename: 'branded-photo.jpg',
mimeType: 'image/jpeg',
watermark: {
assetId: 'logo-asset-id', // Reference another CDN asset
// Or use url: 'https://example.com/logo.png' for external images
position: 'bottom-right', // 9 position options
opacity: 50, // 0-100
sizingMode: 'relative', // 'relative' or 'absolute'
width: 15, // 15% of image width (relative mode)
offsetX: 20, // 20px from edge
offsetY: 20,
},
});
```
#### Watermark Options
- `assetId`: Reference to another CDN asset (your logo, etc.)
- `url`: Direct URL to watermark image (alternative to assetId)
- `position`: Placement on image
- `top-left`, `top-center`, `top-right`
- `center-left`, `center`, `center-right`
- `bottom-left`, `bottom-center`, `bottom-right`
- `offsetX`, `offsetY`: Pixel offset from position (default: 0)
- `sizingMode`: How to interpret width/height
- `absolute`: Width/height in exact pixels
- `relative`: Width/height as percentage of main image (1-100)
- `width`, `height`: Size of watermark (based on sizingMode)
- `opacity`: Transparency 0-100 (default: 100 = fully opaque)
- `rotation`: Rotation angle -360 to 360 degrees (default: 0)
- `tile`: Repeat watermark across image (default: false)
- `tileSpacing`: Spacing between tiles in pixels (default: 100)
- `borderRadius`: Corner radius in pixels (default: 0)
#### Manual Upload Flow
For more control, use the presigned URL flow:
```typescript
// 1. Get presigned upload URL
const { uploadUrl, assetId, expiresAt } = await stack0.cdn.getUploadUrl({
projectSlug: 'my-project',
filename: 'document.pdf',
mimeType: 'application/pdf',
size: 1048576, // File size in bytes
folder: '/documents',
});
// 2. Upload directly to S3
await fetch(uploadUrl, {
method: 'PUT',
body: file,
headers: { 'Content-Type': 'application/pdf' },
});
// 3. Confirm upload completed
const asset = await stack0.cdn.confirmUpload(assetId);
```
### Upload from URL (Server-Side)
Upload a file by providing a source URL. The server fetches and stores the file directly, so the client never downloads the bytes. Ideal for serverless environments with tight memory limits.
```typescript
const asset = await stack0.cdn.uploadFromUrl({
projectSlug: 'my-project',
sourceUrl: 'https://replicate.delivery/output/video.mp4',
filename: 'video.mp4',
mimeType: 'video/mp4',
folder: '/ai-generated',
metadata: { source: 'replicate' },
});
console.log(asset.cdnUrl); // https://cdn.stack0.dev/...
```
### List Assets
Query assets with filters and pagination:
```typescript
const { assets, total, hasMore } = await stack0.cdn.list({
projectSlug: 'my-project',
type: 'image', // 'image' | 'video' | 'audio' | 'document' | 'other'
status: 'ready', // 'pending' | 'processing' | 'ready' | 'failed'
folder: '/images',
search: 'avatar', // Search in filename
tags: ['profile', 'user'],
sortBy: 'createdAt', // 'createdAt' | 'filename' | 'size' | 'type'
sortOrder: 'desc', // 'asc' | 'desc'
limit: 20,
offset: 0,
});
```
### Get Asset
Retrieve a single asset by ID:
```typescript
const asset = await stack0.cdn.get('asset_abc123');
console.log(asset.filename);
console.log(asset.cdnUrl);
console.log(asset.width, asset.height); // For images/videos
console.log(asset.duration); // For videos/audio (seconds)
```
### Update Asset
Update asset metadata:
```typescript
const asset = await stack0.cdn.update({
id: 'asset_abc123',
filename: 'renamed-photo.jpg',
folder: '/images/archived',
tags: ['nature', 'sunset'],
alt: 'A beautiful sunset over the ocean',
metadata: { category: 'landscape' },
});
```
### Delete Assets
```typescript
// Delete single asset
await stack0.cdn.delete('asset_abc123');
// Delete multiple assets
const { deletedCount } = await stack0.cdn.deleteMany([
'asset_abc123',
'asset_def456',
'asset_ghi789',
]);
```
### Move Assets
Move assets to a different folder:
```typescript
await stack0.cdn.move({
assetIds: ['asset_abc123', 'asset_def456'],
folder: '/images/archive', // Use null for root folder
});
```
### Image Transformations
Generate optimized and transformed image URLs client-side (no API call required):
```typescript
// Using asset's cdnUrl directly (recommended)
const url = stack0.cdn.getTransformUrl(asset.cdnUrl, {
width: 800,
height: 600,
fit: 'cover', // 'cover' | 'contain' | 'fill' | 'inside' | 'outside'
format: 'webp', // 'webp' | 'jpeg' | 'png' | 'avif' | 'auto'
quality: 80, // 1-100
});
// Or using s3Key when cdnUrl is configured in Stack0 options
const stack0 = new Stack0({
apiKey: process.env.STACK0_API_KEY,
cdnUrl: 'https://cdn.yourproject.stack0.dev',
});
const url = stack0.cdn.getTransformUrl(asset.s3Key, { width: 400 });
// Use transformed URL
// <img src={url} alt="Optimized image" />
```
#### Transformation Options
- `width`: Target width in pixels (snapped to optimal sizes for caching)
- `height`: Target height in pixels
- `fit`: How to fit the image
- `cover`: Crop to fill dimen