Skip to main content

Overview

Teak supports 8 card types: text, link, image, video, audio, document, palette, and quote. You can either specify the type explicitly or let Teak automatically detect it.

Card Types

Basic text notes and ideas.
{
  content: "My brilliant idea",
  type: "text"
}

Auto-Detection

When you omit the type parameter, Teak uses intelligent classification:
1

URL Extraction

If the content contains a URL, it’s extracted and cleaned:
// Input
{ content: "Check out https://example.com - really cool!" }

// Processed
{
  content: "Check out - really cool!",
  url: "https://example.com",
  type: "link" // auto-detected
}
2

Quote Detection

Text wrapped in quotation marks becomes a quote:
// Input
{ content: '"To be or not to be"' }

// Processed
{
  content: "To be or not to be",
  type: "quote" // auto-detected
}
3

File Type Detection

When a fileId is provided, MIME type determines the card type:
MIME TypeCard Type
image/*image
video/*video
audio/*audio
application/pdfdocument
4

AI Classification

For ambiguous cases, an AI classifier analyzes the content and assigns the most appropriate type with a confidence score.

Creating Cards

From Code

import { api } from "@teak/convex";
import { useMutation } from "convex/react";

function MyComponent() {
  const createCard = useMutation(api.card.createCard.createCard);

  const handleCreate = async () => {
    await createCard({
      content: "My new card",
      type: "text",
      tags: ["ideas", "todo"],
      notes: "Additional context here"
    });
  };
}

With Files

1

Upload to Storage

const fileId = await storage.upload(file);
2

Create Card with File Reference

await createCard({
  content: "My uploaded file",
  fileId: fileId,
  type: "image", // or let auto-detection handle it
  metadata: {
    fileName: file.name,
    fileSize: file.size,
    mimeType: file.type
  }
});

Metadata Fields

All cards support these optional fields:
FieldTypeDescriptionExample
contentstringMain text content"My idea"
typeCardTypeCard type (optional)"text"
urlstringAssociated URL"https://..."
fileIdId<“_storage”>Convex storage IDk1abc...
thumbnailIdId<“_storage”>Custom thumbnailk2def...
tagsstring[]User tags["work", "urgent"]
notesstringAdditional notes"Follow up next week"
metadataobjectCustom metadata{ source: "email" }
colorsColor[]Palette colors[{ hex: "#FF0000" }]

Processing Pipeline

After creation, cards enter an automated processing workflow:
All processing happens asynchronously. You can query processingStatus to track progress.

Rate Limits

Teak enforces creation limits to ensure quality:
  • Free tier: 200 cards maximum
  • Rate limiting: Prevents spam creation
// Rate limit error example
try {
  await createCard({ content: "Card" });
} catch (error) {
  if (error.code === "CARD_LIMIT_REACHED") {
    // Show upgrade prompt
  } else if (error.code === "RATE_LIMITED") {
    // Show "slow down" message
  }
}

Best Practices

Let auto-detection work for you: Omit type for simpler code and smarter classification.
Include context in notes: The notes field helps AI generate better tags and summaries.
File size limit: Maximum 20MB per file. Check MAX_FILE_SIZE constant.
Batch uploads: Use MAX_FILES_PER_UPLOAD (5 files) to create multiple cards efficiently.

Source Reference

The card creation logic is in:
  • packages/convex/card/createCard.ts:61-189 - Main handler
  • packages/convex/workflows/cardProcessing.ts:43-298 - Processing workflow

Build docs developers (and LLMs) love