environment-setup-guide
Guide developers through setting up development environments with proper tools, dependencies, and configurations
documenso-cost-tuning
Optimize Documenso usage costs and manage subscription efficiency. Use when analyzing costs, optimizing document usage, or managing Documenso subscription tiers. Trigger with phrases like "documenso costs", "documenso pricing", "optimize documenso spending", "documenso usage".
Full skill instructions
Optimize Documenso costs through efficient usage patterns, template reuse, and monitoring.
Documenso offers multiple plans:
| Plan | Best For | Key Limits |
|---|---|---|
| Free | Testing/Personal | Limited documents |
| Individual | Freelancers | Higher document limits |
| Teams | Small teams | Team collaboration |
| Enterprise | Large organizations | Custom limits |
// EXPENSIVE: Creating from scratch each time
async function createContractExpensive(data: ContractData) {
const doc = await client.documents.createV0({
title: data.title,
file: await generatePdf(data), // PDF generation cost
});
// Add recipients each time
await client.documentsRecipients.createV0({
documentId: doc.documentId!,
email: data.signerEmail,
name: data.signerName,
role: "SIGNER",
});
// Add fields each time
await client.documentsFields.createV0({
documentId: doc.documentId!,
recipientId: "...",
type: "SIGNATURE",
page: 1,
positionX: 100,
positionY: 600,
width: 200,
height: 60,
});
return doc;
}
// EFFICIENT: Use templates
async function createContractEfficient(data: ContractData) {
// Template already has fields and recipient placeholders
const envelope = await client.envelopes.useV0({
templateId: STANDARD_CONTRACT_TEMPLATE,
title: data.title,
recipients: [
{
email: data.signerEmail,
name: data.signerName,
signerIndex: 0,
},
],
});
return envelope;
}
// EXPENSIVE: Multiple documents for one transaction
// Creates 3 documents = 3x cost
async function handleDealExpensive(deal: Deal) {
await createDocument("NDA", deal);
await createDocument("MSA", deal);
await createDocument("SOW", deal);
}
// EFFICIENT: Combine into one document package
// Creates 1 document = 1x cost
async function handleDealEfficient(deal: Deal) {
// Combine PDFs into single document
const combinedPdf = await combinePdfs([
"./templates/nda.pdf",
"./templates/msa.pdf",
"./templates/sow.pdf",
]);
await createDocument("Deal Package", deal, combinedPdf);
}
// Clean up abandoned drafts to avoid confusion and track true usage
async function cleanupOldDrafts(daysOld = 30): Promise<number> {
const cutoffDate = new Date();
cutoffDate.setDate(cutoffDate.getDate() - daysOld);
const docs = await client.documents.findV0({});
const oldDrafts = docs.documents?.filter(
(d) =>
d.status === "DRAFT" &&
new Date(d.createdAt!) < cutoffDate
) ?? [];
let deleted = 0;
for (const draft of oldDrafts) {
try {
await client.documents.deleteV0({ documentId: draft.id! });
deleted++;
} catch (error) {
console.warn(`Failed to delete draft ${draft.id}`);
}
}
console.log(`Deleted ${deleted} old drafts`);
return deleted;
}
// Schedule weekly cleanup
// cron: "0 0 * * 0" (Sunday midnight)
interface UsageMetrics {
period: { start: Date; end: Date };
documentsCreated: number;
documentsCompleted: number;
templateUsage: Map<string, number>;
activeRecipients: Set<string>;
}
async function trackUsage(): Promise<UsageMetrics> {
const now = new Date();
const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);
const metrics: UsageMetrics = {
period: { start: startOfMonth, end: now },
documentsCreated: 0,
documentsCompleted: 0,
templateUsage: new Map(),
activeRecipients: new Set(),
};
// Iterate through documents
const docs = await client.documents.findV0({});
for (const doc of docs.documents ?? []) {
const createdAt = new Date(doc.createdAt!);
if (createdAt >= startOfMonth) {
metrics.documentsCreated++;
if (doc.status === "COMPLETED") {
metrics.documentsCompleted++;
}
// Track recipients
for (const recipient of doc.recipients ?? []) {
metrics.activeRecipients.add(recipient.email!);
}
}
}
return metrics;
}
// Alert when approaching limits
async function checkUsageLimits() {
const metrics = await trackUsage();
const MONTHLY_LIMIT = 100; // Your plan's limit
const usagePercent = (metrics.documentsCreated / MONTHLY_LIMIT) * 100;
if (usagePercent > 80) {
console.warn(`Usage at ${usagePercent.toFixed(0)}% of monthly limit!`);
// Send alert
}
}
// Reduce API calls by batching field creation
async function addFieldsEfficiently(
documentId: string,
fields: FieldConfig[]
): Promise<void> {
// Use batch endpoint when available
if (fields.length > 1) {
await client.documentsFields.createManyV0({
documentId,
fields: fields.map((f) => ({
recipientId: f.recipientId,
type: f.type as any,
page: f.page,
positionX: f.x,
positionY: f.y,
width: f.width ?? 200,
height: f.height ?? 60,
})),
});
} else if (fields.length === 1) {
const f = fields[0];
await client.documentsFields.createV0({
documentId,
recipientId: f.recipientId,
type: f.type as any,
page: f.page,
positionX: f.x,
positionY: f.y,
width: f.width ?? 200,
height: f.height ?? 60,
});
}
}
For high-volume use cases, self-hosting may be more cost-effective:
# docker-compose.yml for self-hosted Documenso
version: '3.8'
services:
documenso:
image: documenso/documenso:latest
ports:
- "3000:3000"
environment:
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
- NEXT_PRIVATE_DATABASE_URL=${DATABASE_URL}
- NEXT_PRIVATE_SMTP_HOST=${SMTP_HOST}
volumes:
- ./cert.p12:/opt/documenso/cert.p12:ro
postgres:
image: postgres:15
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:
Cost comparison (example):
// Generate monthly cost report
async function generateCostReport(month: Date): Promise<CostReport> {
const metrics = await trackUsage();
// Calculate costs (example rates)
const perDocumentCost = 0.5; // Example: $0.50 per document
const estimatedCost = metrics.documentsCreated * perDocumentCost;
const report = {
period: `${month.getFullYear()}-${String(month.getMonth() + 1).padStart(2, "0")}`,
metrics: {
documentsCreated: metrics.documentsCreated,
documentsCompleted: metrics.documentsCompleted,
completionRate:
(metrics.documentsCompleted / metrics.documentsCreated) * 100,
uniqueRecipients: metrics.activeRecipients.size,
},
costs: {
estimated: estimatedCost,
perDocument: perDocumentCost,
},
recommendations: [] as string[],
};
// Add recommendations
if (report.metrics.completionRate < 50) {
report.recommendations.push(
"Low completion rate - consider simplifying signing process"
);
}
if (metrics.documentsCreated > 500) {
report.recommendations.push(
"High volume - consider Enterprise plan or self-hosting"
);
}
return report;
}
| Cost Issue | Indicator | Solution |
|---|---|---|
| Overage charges | Exceeding limits | Upgrade plan or optimize |
| Unused features | Low completion rate | Simplify workflow |
| Duplicate documents | High creation rate | Use templates |
| Abandoned drafts | Many DRAFT status | Implement cleanup |
For architecture patterns, see documenso-reference-architecture.
Guide developers through setting up development environments with proper tools, dependencies, and configurations
Implement Exa lint rules, policy enforcement, and automated guardrails. Use when setting up code quality rules for Exa integrations, implementing pre-commit hooks, or configuring CI policy checks for Exa best practices. Trigger with phrases like "exa policy", "exa lint", "exa guardrails", "exa be...
Configure CI/CD pipelines for Documenso integrations. Use when setting up automated testing, deployment pipelines, or continuous integration for Documenso projects. Trigger with phrases like "documenso CI", "documenso GitHub Actions", "documenso pipeline", "documenso automated testing".
Build check model availability and implement fallback chains. Use when building resilient systems or handling model outages. Trigger with phrases like 'openrouter availability', 'openrouter fallback', 'openrouter model down', 'openrouter health check'.
Configure Langfuse enterprise organization management and access control. Use when implementing team access controls, configuring organization settings, or setting up role-based permissions for Langfuse projects. Trigger with phrases like "langfuse RBAC", "langfuse teams", "langfuse organization"...
Execute compliance and security auditing for Cursor usage. Triggers on "cursor compliance", "cursor audit", "cursor security review", "cursor soc2", "cursor gdpr". Use when analyzing or auditing cursor compliance audit. Trigger with phrases like "cursor compliance audit", "cursor audit", "cursor".
Configure Apollo.io CI/CD integration. Use when setting up automated testing, continuous integration, or deployment pipelines for Apollo integrations. Trigger with phrases like "apollo ci", "apollo github actions", "apollo pipeline", "apollo ci/cd", "apollo automated tests".
Create robust Python automation with full logging and safety checks. Use when tasks need complex data processing, authenticated API work, conditional file operations, or error handling beyond simple shell commands.
Configure PostHog across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific PostHog configurations. Trigger with phrases like "posthog environments", "posthog staging", "po...
Expert in designing and building autonomous AI agents. Masters tool use, memory systems, planning strategies, and multi-agent orchestration. Use when: build agent, AI agent, autonomous agent, tool use, function calling.
Validate insecure deserialization checker operations. Auto-activating skill for Security Fundamentals. Triggers on: insecure deserialization checker, insecure deserialization checker Part of the Security Fundamentals skill category. Use when working with insecure deserialization checker functiona...
Manage path traversal finder operations. Auto-activating skill for Security Fundamentals. Triggers on: path traversal finder, path traversal finder Part of the Security Fundamentals skill category. Use when working with path traversal finder functionality. Trigger with phrases like "path traversa...
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience