---
title: "Neon Functions"
type: skill
id: "neon-skills/neon-postgres/neon-functions"
category: "Engineering"
publisher: "Neon"
license: "Apache-2.0"
source: "https://github.com/neondatabase/agent-skills/tree/ea79164"
canonical: "https://labs.pho.chat/en/skills/neon-skills/neon-postgres/neon-functions"
open_in_pho: "https://pho.chat/customize?item=neon-skills%2Fneon-postgres%2Fneon-functions&utm_source=labs&utm_medium=skill-page&utm_campaign=skills-library"
---

# Neon Functions

Long-running, serverless Node.js HTTP functions deployed onto your Neon branch, with DATABASE_URL injected automatically and compute that runs next to your data. Use when a user wants to host an API, an AI agent with long streaming responses, a WebSocket or server-sent-events (SSE) server, a webhook handler, a Discord bot, an MCP server, or any request/response workload that risks timing out on short, lambda-style serverless functions — and wants it to branch with their database. Also use for Function Triggers: a cron or an object-storage event that POSTs to a function. Triggers include "serverless function", "deploy an API", "long-running function", "streaming agent", "SSE server", "WebSocket server", "webhook handler", "MCP server", "cron", "scheduled function", "object storage trigger", "on upload", "function that won't time out", "function logs", "Neon Functions", "Neon Compute", "DDoS protection", "rate limiting", and "production hardening". For live UIs over database rows, use neon-realtime.

Source: Neon (Apache 2.0), copied at a pinned commit. Free to use. Part of the Phở Skills library (https://labs.pho.chat/en/skills).
Skill set: Neon Postgres (https://labs.pho.chat/en/skills/neon-skills/neon-postgres.md).

## What it covers
- When to Use
- What It Does
- Availability
- Architecture: Where Functions Fit
- Production hardening
- Setup
- Develop Locally and Deploy
  - Native binaries and custom builds
- Neon Infrastructure as Code (neon.ts)
- Environment Variables
- Connecting to Postgres
- Timeouts and Runtime Limits
- Functions as an Agent Backend (Next.js and Similar Frameworks)
- WebSocket Servers
  - Heartbeat (keep the socket alive)
  - Fan-out across isolates (do not skip this)
  - Client must reconnect
- Server-Sent Events (SSE)
- Function Triggers
- MCP Servers

## Other skills in this set
- [Neon](https://labs.pho.chat/en/skills/neon-skills/neon-postgres/neon.md): Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login…
- [Lakebase Postgres](https://labs.pho.chat/en/skills/neon-skills/neon-postgres/neon-postgres.md): Guides and best practices for working with Lakebase Postgres on Neon: connections, pooled vs direct, schema migrations, branching (including schema-only, reset-from-parent, and branch-per-PR…
- [Neon Auth](https://labs.pho.chat/en/skills/neon-skills/neon-postgres/neon-auth.md): Add authentication to a new app. Use for "add auth", "add login", Neon Auth (Managed Better Auth), identity routing, sign-up, sign-in, password reset, email OTP, magic links, organizations, phone…
- [Neon Object Storage](https://labs.pho.chat/en/skills/neon-skills/neon-postgres/neon-object-storage.md): S3-compatible object storage that branches with your database, so each branch gets its own copy of the files and the rows that point at them. Use when a user wants object storage, a bucket…
- [Neon Realtime](https://labs.pho.chat/en/skills/neon-skills/neon-postgres/neon-realtime.md): Neon Realtime makes any SQL query live. Build realtime, reactive apps and agents on Lakebase Postgres with live SQL queries and reactivity primitives. Use when app UI or agent state must update live…

## Use it
- In Phở: open https://pho.chat/customize?item=neon-skills%2Fneon-postgres%2Fneon-functions&utm_source=labs&utm_medium=skill-page&utm_campaign=skills-library and press Try, or add it so Phở loads it whenever a request matches. Phở works with your own API key (OpenAI, Anthropic, Google and others).
- Full instructions (original SKILL.md, unchanged): https://labs.pho.chat/skills/raw/neon-skills/neon-postgres/skills/neon-functions/SKILL.md
- Original files: https://github.com/neondatabase/agent-skills/tree/ea79164 (Apache 2.0).
- Full machine-readable index: https://labs.pho.chat/skills.json
