notion-deploy-integration
Deploy Node.js applications that use the Notion API to production on Vercel, Railway, or Fly.io. Use when deploying Notion-powered backends, setting up NOTION_TOKEN in production secrets, configuring serverless singleton patterns, or adding health checks that verify Notion connectivity. Trigger: "deploy notion app", "notion production", "notion vercel deploy", "notion railway", "notion fly.io".
What this skill does
# Deploy Notion-Integrated Applications
Ship Node.js apps that talk to the Notion API to Vercel, Railway, or Fly.io. This skill covers environment variable management, the Notion client singleton pattern for serverless, rate limit handling at 3 req/sec, health check endpoints that verify Notion connectivity, and caching strategies to reduce API calls.
## Prerequisites
- Node.js >= 18 project with `@notionhq/client` installed (`npm i @notionhq/client`)
- Working Notion integration tested locally with a valid `NOTION_TOKEN` (starts with `ntn_`)
- Platform CLI installed for your target: `vercel`, `railway`, or `fly`
- Database or page IDs your integration needs access to
## Instructions
### Step 1 — Prepare the Application for Production
Build a production-ready entry point with a Notion client singleton, rate limit handling, response caching, and a health check endpoint.
**Notion client singleton (critical for serverless):**
Serverless functions recycle containers unpredictably. Creating a new `Client` on every invocation wastes cold-start time and risks hitting rate limits. A module-level singleton reuses the client across warm invocations.
```typescript
// src/notion-client.ts — singleton for serverless environments
import { Client, LogLevel, isNotionClientError, APIErrorCode } from '@notionhq/client';
let client: Client | null = null;
export function getNotionClient(): Client {
if (!client) {
if (!process.env.NOTION_TOKEN) {
throw new Error('NOTION_TOKEN environment variable is not set');
}
client = new Client({
auth: process.env.NOTION_TOKEN,
logLevel: process.env.NODE_ENV === 'production' ? LogLevel.WARN : LogLevel.DEBUG,
timeoutMs: 30_000,
});
}
return client;
}
```
**Rate limit handler (Notion enforces 3 requests/second):**
Notion returns HTTP 429 with a `Retry-After` header when you exceed the rate limit. The SDK retries automatically, but production apps should add queuing to avoid cascading failures under load.
```typescript
// src/rate-limiter.ts — token bucket for 3 req/sec
export class NotionRateLimiter {
private queue: Array<{ resolve: () => void }> = [];
private activeRequests = 0;
private readonly maxPerSecond = 3;
async acquire(): Promise<void> {
if (this.activeRequests < this.maxPerSecond) {
this.activeRequests++;
return;
}
return new Promise((resolve) => {
this.queue.push({ resolve });
});
}
release(): void {
this.activeRequests--;
if (this.queue.length > 0) {
const next = this.queue.shift()!;
this.activeRequests++;
setTimeout(() => next.resolve(), 1000 / this.maxPerSecond);
}
}
async execute<T>(fn: () => Promise<T>): Promise<T> {
await this.acquire();
try {
return await fn();
} finally {
this.release();
}
}
}
export const rateLimiter = new NotionRateLimiter();
```
**Response cache (reduce API calls in production):**
Notion data that changes infrequently (database schemas, user lists, page metadata) should be cached to stay well under the rate limit.
```typescript
// src/cache.ts — TTL cache for Notion responses
interface CacheEntry<T> {
data: T;
expiresAt: number;
}
export class NotionCache {
private store = new Map<string, CacheEntry<unknown>>();
private readonly defaultTtlMs: number;
constructor(defaultTtlSeconds = 60) {
this.defaultTtlMs = defaultTtlSeconds * 1000;
}
get<T>(key: string): T | null {
const entry = this.store.get(key);
if (!entry || Date.now() > entry.expiresAt) {
this.store.delete(key);
return null;
}
return entry.data as T;
}
set<T>(key: string, data: T, ttlSeconds?: number): void {
const ttlMs = ttlSeconds ? ttlSeconds * 1000 : this.defaultTtlMs;
this.store.set(key, { data, expiresAt: Date.now() + ttlMs });
}
invalidate(pattern: string): void {
for (const key of this.store.keys()) {
if (key.includes(pattern)) this.store.delete(key);
}
}
}
export const notionCache = new NotionCache(60); // 60-second default TTL
```
**Health check endpoint (include in every deployment):**
```typescript
// src/health.ts — verifies Notion API connectivity
import { getNotionClient } from './notion-client';
import { isNotionClientError } from '@notionhq/client';
export async function healthCheck(): Promise<{
status: 'healthy' | 'degraded';
notion: { connected: boolean; latencyMs: number; error?: string };
timestamp: string;
}> {
const timestamp = new Date().toISOString();
const start = Date.now();
try {
const notion = getNotionClient();
await notion.users.me({});
return {
status: 'healthy',
notion: { connected: true, latencyMs: Date.now() - start },
timestamp,
};
} catch (error) {
const errorCode = isNotionClientError(error) ? error.code : 'unknown';
return {
status: 'degraded',
notion: { connected: false, latencyMs: Date.now() - start, error: errorCode },
timestamp,
};
}
}
```
### Step 2 — Deploy to Your Target Platform
Pick one platform and follow its deployment path. All three store `NOTION_TOKEN` as a secret that is injected at runtime, never committed to source.
**Option A: Vercel (serverless functions)**
Best for: Next.js apps, API routes, low-traffic webhooks. Cold starts are ~200ms for Node.js.
```bash
# Store the token as a production secret
vercel env add NOTION_TOKEN production
# Paste ntn_xxx when prompted — Vercel encrypts at rest
# Deploy
vercel --prod
```
Vercel API route using the singleton:
```typescript
// app/api/notion/query/route.ts (Next.js App Router)
import { NextResponse } from 'next/server';
import { getNotionClient } from '@/lib/notion-client';
import { rateLimiter } from '@/lib/rate-limiter';
import { notionCache } from '@/lib/cache';
export async function POST(request: Request) {
const { databaseId, filter } = await request.json();
const cacheKey = `db:${databaseId}:${JSON.stringify(filter)}`;
// Check cache first
const cached = notionCache.get(cacheKey);
if (cached) return NextResponse.json(cached);
try {
const notion = getNotionClient();
const response = await rateLimiter.execute(() =>
notion.databases.query({ database_id: databaseId, filter, page_size: 100 })
);
const result = {
pages: response.results.map((page: any) => ({
id: page.id,
title: page.properties?.Name?.title?.[0]?.plain_text ?? '',
lastEdited: page.last_edited_time,
})),
hasMore: response.has_more,
};
notionCache.set(cacheKey, result, 30); // cache 30 seconds
return NextResponse.json(result);
} catch (error: any) {
return NextResponse.json(
{ error: error.code ?? 'unknown', message: error.message },
{ status: error.status ?? 500 }
);
}
}
```
Add the health route:
```typescript
// app/api/health/route.ts
import { NextResponse } from 'next/server';
import { healthCheck } from '@/lib/health';
export async function GET() {
const result = await healthCheck();
return NextResponse.json(result, { status: result.status === 'healthy' ? 200 : 503 });
}
```
**Option B: Railway (container-based, always-on)**
Best for: Long-running sync services, high-frequency webhooks, apps needing persistent state.
```bash
# Set the secret via CLI
railway variables set NOTION_TOKEN=ntn_xxx
# Deploy from the current directory
railway up
# Verify
railway status
```
Railway uses `Dockerfile` or Nixpacks auto-detection. For Node.js, ensure `package.json` has a `start` script:
```json
{
"scripts": {
"start": "node dist/index.js",
"build": "tsc"
}
}
```
Railway provides persistent volumes and cron jobs, making it ideal for Notion sync services that run on a schedule.
**Option C: Fly.io (edge containers)**
Best for: Global distribution, low-latency API proxies, services needing machines in multiple regions.
```toml
# fly.toml
app = "my-notion-service"
primary_region = "iad"
[env]
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.