ASD

Neon Object Storage

Almacenamiento de objetos compatible con S3 que se ramifica junto a tu proyecto Neon, para que archivos y base de datos se mantengan sincronizados en cada branch.

Oficial

Reemplaza a: AWS S3, Cloudflare R2, Supabase Storage

Estrellas
82

en todo el repo

Actividad
75

0–100, la ruta de este skill

Actualizado
hace 4 días

último commit aquí

Commits
15

últimos 90 días

Contexto
3.1k tok

190 tok en reposo

Paquete
1 archivo

12 KB

Instalar

Funciona con cualquier agente que lea SKILL.md

npx -y skills add neondatabase/agent-skills --skill neon-object-storage --agent claude-code

Se instala solo en este repositorio.

Qué hace

  • Declara buckets S3-compatibles en neon.ts y los provisiona con `neon deploy`/`neon config apply`
  • Inyecta variables de entorno estándar AWS (AWS_ACCESS_KEY_ID, AWS_ENDPOINT_URL_S3, etc.) por branch
  • Configura un cliente S3 (Files SDK o AWS SDK) apuntando al endpoint de Neon con path-style addressing
  • Provee comandos CLI para buckets/objetos (`neon bucket create|list|delete`, `neon bucket object put|get|list|delete`)
  • Consulta logs de storage por branch con `neon logs query --source storage`

Úsalo cuando

  • El usuario quiere object storage, un bucket, blob/file storage o un lugar para subidas, imágenes, documentos o avatares
  • Ya usan (o están configurando) Lakebase Postgres y no quieren añadir un proveedor de storage separado como AWS S3, Cloudflare R2 o Supabase Storage
  • Los archivos deben mantenerse sincronizados con la base de datos entre entornos (dev, preview, staging, producción)
  • Quieren entornos preview/CI descartables donde subir, sobrescribir o borrar archivos sin riesgo para producción

No lo uses cuando

  • El usuario no tiene proyecto Neon, no usa Postgres y solo necesita un almacén de assets independiente respaldado por CDN
  • El proyecto no es nuevo ni está en la región us-east-2 (no se puede habilitar en proyectos existentes)

Qué lo activa

Di cualquiera de estas frases y el agente debería cargar este skill.

  • Necesito un bucket S3 para subir imágenes que se sincronice con mi base de datos Neon
  • ¿Cómo guardo archivos de usuarios en Neon Object Storage?
  • Quiero un flujo de subida y descarga de archivos vinculado a mis branches de Neon
  • Configura un bucket public_read en mi neon.ts
  • Muéstrame los logs de storage de mi branch de producción

SKILL.md

En inglés

FIRST: Use the parent neon skill for a Neon overview, getting started with Neon, Neon development best practices, and more.

If the neon skill is not installed, fetch it from https://neon.com/docs/ai/skills/neon/SKILL.md or install it with:

npx skills add neondatabase/agent-skills --skill neon

Neon Object Storage

This is a public beta feature and only available in us-east-2.

Neon Object Storage is S3-compatible object storage that branches with your projects: every branch gets its own isolated storage state, so files and database rows stay in sync across dev, preview, staging, and production.

Use this skill to help the user store and serve files that branch alongside their database. Deliver a working bucket and upload/download flow, a branch-aware S3 client wired to the injected env vars, or a precise answer from the official Neon docs.

When to Use

Reach for Neon Object Storage when the user needs to store files (images, uploads, generated assets, documents, backups) and any of the following are true:

  • They already use Lakebase Postgres and don't want a second provider. One backend, one bill, one CLI, one set of branches — instead of standing up and wiring a separate AWS S3 / R2 / Supabase Storage account. The same Neon credential that backs the database backs storage.
  • Files must stay in sync with the database across environments. Storage branches together with your Postgres data. Fork a branch and the child instantly inherits the parent's buckets and objects at that point in time — copy-on-write, so no data is duplicated. This is what makes agent, dev, preview, and test environments seamless: a preview branch gets a consistent snapshot of both the rows and the files they reference, and writes on the child never touch the parent.
  • They want safe, throwaway environments. Upload, overwrite, and delete files in a preview/CI branch without any risk to production data, then drop the branch.
  • They want standard S3 tooling. It's built on S3 semantics and speaks the S3 API, so the AWS SDKs, boto3, the AWS CLI, and presigned URLs all work — reliable and familiar, with no proprietary client.

If the user has no Neon project, isn't on Postgres, and just needs a standalone CDN-backed asset store, a dedicated object store may fit better — but the moment branch-consistent files + rows matter, this is the reason to use it.

What It Does

  • S3-compatible — Works with existing S3 SDKs, boto3, the AWS CLI, and presigned URLs. Path-style addressing and SigV4 only.
  • Branches with your database — Every Neon branch gets its own isolated, copy-on-write storage state. Forking copies no data.
  • Two access modesprivate buckets require a credential for every operation; public_read buckets allow anonymous reads with authenticated writes.
  • One credential system — The same Neon credential system used by Functions and the AI Gateway.

Availability

Check this precondition before setting anything up: Neon Object Storage is a public beta feature available only on new projects in the us-east-2 region. Confirm the user's Neon project is a new project in us-east-2 before proceeding; it can't be enabled on existing projects.

Setup

Object storage is part of the neon.ts infrastructure-as-code config (see the neon skill for the branch-first workflow, link/checkout, and neon.ts basics). Declare buckets under preview.buckets, keyed by bucket name:

// neon.ts
import { defineConfig } from "@neon/config/v1";

export default defineConfig({
  preview: {
    buckets: {
      images: {}, // private by default
      "public-assets": { access: "public_read" },
    },
  },
});

Provision the declared buckets on the linked branch:

neon deploy   # alias for `neon config apply`

Neon Infrastructure as Code (neon.ts)

The preview.buckets block above is part of neon.ts, Neon's infrastructure-as-code file — one TypeScript file declares your buckets alongside every other service the branch should have (see the neon skill for the full reference). Reconcile the declaration against a branch the Terraform way:

neon config status   # print the branch's live config (which buckets exist)
neon config plan     # dry-run diff of what apply would change
neon config apply    # create the declared buckets  (neon deploy is an alias)

Buckets are branch-scoped: when a neon.ts is present, neon checkout applies the policy as it creates a branch, so a fresh preview/CI branch comes up with its buckets already provisioned (and copy-on-write objects inherited from the parent). Checking out an existing branch doesn't reconcile it — run neon deploy to apply changes. Provisioning (config apply / deploy), link, and checkout also pull the branch's S3 credentials into your local .env.local, so the same env pull step shown below happens for you on those commands.

Environment Variables

When preview.buckets is declared, Neon injects AWS-standard S3 env vars so the AWS SDKs work from the environment with zero extra config. Inside a deployed Neon Function these are injected automatically; locally, pull them onto disk (or inject them at runtime) via the CLI:

neon env pull            # writes the branch's vars into .env (or .env.local)
# or, without writing a file, inject at runtime:
neon-env run -- <your dev command>
Variable Meaning
AWS_ACCESS_KEY_ID S3 Access Key ID (the branch credential's token id)
AWS_SECRET_ACCESS_KEY S3 Secret Access Key
AWS_ENDPOINT_URL_S3 Branch S3 endpoint URL
AWS_REGION Region, e.g. us-east-2

Because the names are AWS-standard, the AWS SDK picks up the credentials, endpoint, and region from the environment automatically. Credentials are branch-scoped and valid for that branch and all its descendants.

For typed, validated access to these credentials instead of reading process.env directly, pass the same neon.ts config object to parseEnv from @neon/env — it returns an env.storage namespace (accessKeyId, secretAccessKey, endpoint, region) derived from your config. See the neon skill.

Working with Objects: the Files SDK (Recommended)

The simplest, most portable way to read and write objects is the Files SDK with its neon adapter — a small, unified storage API (upload, download, url, list, exists, copy, delete, signedUploadUrl) over web-standard I/O. It uses the AWS S3 client under the hood, configured appropriately for Neon, and relabels errors as Neon error — so there's nothing to misconfigure. Reach for this first.

Install it alongside the AWS S3 peer dependencies the adapter uses internally:

npm install files-sdk @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigner

The adapter resolves its endpoint, region, and credentials from the same injected AWS_* env vars — pass only the bucket name:

import { Files } from "files-sdk";
import { neon } from "files-sdk/neon";

const files = new Files({ adapter: neon({ bucket: "images" }) });

// Upload — body may be a Buffer, Uint8Array, Blob, File, ReadableStream, or string
await files.upload("generated/cat.jpg", fileBuffer, { contentType: "image/jpeg" });

// Download
const file = await files.download("generated/cat.jpg");
const bytes = new Uint8Array(await file.arrayBuffer());

// Presigned GET — share without exposing credentials (defaults to a 1h expiry)
const url = await files.url("generated/cat.jpg", { expiresIn: 3600 });

// Plus: files.exists(), files.list({ prefix }), files.copy(), files.delete(), files.signedUploadUrl()

Swap the adapter import (files-sdk/s3, files-sdk/r2, files-sdk/gcs, …) and the rest of your code is unchanged.

Working with Objects: the AWS S3 Client (Alternative)

Neon speaks the S3 API directly, so you can drop down to the AWS SDK whenever you prefer the native client or already depend on it. The credentials, endpoint, and region are read from the standard AWS env chain, so the only setting you pass is forcePathStyle: true — Neon requires path-style addressing, so the S3 client must set it:

import { S3Client } from "@aws-sdk/client-s3";

const s3 = new S3Client({
  forcePathStyle: true, // required: Neon uses path-style addressing
});

Then upload, download, and presign with the raw command objects:

import { PutObjectCommand, GetObjectCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";

const BUCKET = "images";

// Upload
await s3.send(
  new PutObjectCommand({
    Bucket: BUCKET,
    Key: "generated/cat.jpg",
    Body: fileBuffer,
    ContentType: "image/jpeg",
  }),
);

// Download
const res = await s3.send(
  new GetObjectCommand({ Bucket: BUCKET, Key: "generated/cat.jpg" }),
);
const bytes = await res.Body?.transformToByteArray();

// Presigned GET — share without exposing credentials
const url = await getSignedUrl(
  s3,
  new GetObjectCommand({ Bucket: BUCKET, Key: "generated/cat.jpg" }),
  { expiresIn: 3600 },
);

Pairing Storage with the Database on a Branch

The canonical pattern: an agent generates an image → PutObject into the images bucket → a row is inserted in Postgres → a presigned URL is returned on read. Store the bucket key (not the bytes) in a Postgres column, and presign on read. Because both the row and the object live on the same branch, they branch together and never drift.

CLI Bucket and Object Commands

neon also has first-class bucket/object commands (neon bucket create|list|delete, neon bucket object put|get|list|delete) for scripting and one-off operations.

Built-in Branch Logs

neon logs query --branch production --source storage --since 1h

Storage is one of the two sources branch logs cover today, alongside Neon Functions. Logs are scoped to a single branch, so pass --branch when the bucket you're debugging isn't on the branch you're checked out on. Everything else about logs — the required CLI version, filters, the SDK, and the Loki-compatible read API — is in the parent neon skill's Observability section.

Neon Documentation

The Neon documentation is the source of truth and Object Storage is evolving rapidly, so always verify against the official docs. Any doc page can be fetched as markdown by appending .md to the URL or by requesting Accept: text/markdown. Find the right page from the docs index (https://neon.com/docs/llms.txt) and the changelog announcements.

Further Reading

Reproducido de neondatabase/agent-skills bajo licencia Apache-2.0. Leer esta página en markdown.

Archivos

1 archivo en el paquete. Solo se lee SKILL.md al activarse — las referencias se cargan si el skill decide que las necesita.

Antes de instalar

Requiere un proyecto Neon nuevo en la región us-east-2 (beta pública, no disponible en proyectos existentes) y la skill `neon` instalada.

Necesita en el PATH:npmnpx

Detalles

Categoría
Bases de datos
Licencia
Apache-2.0
Recursos incluidos
Solo SKILL.md
Código fuente
Ver SKILL.md

Más de neondatabase/agent-skills

Este repo incluye 9 skills. Si instalas uno, normalmente ya tienes los demás.

Funciones HTTP de Node.js long-running y serverless desplegadas en tu rama de Neon, con DATABASE_URL inyectado automáticamente y compute que corre junto a tus datos.

Costo de contexto al activarse
9.6k tok
Tamaño del paquete
6 archivos
Última actualización
hace 4 días
Oficialdevops infraestructura

Visión general de Neon: primitivas de backend en la nube (Lakebase Postgres, Auth, Data API, Object Storage, Functions, AI Gateway), CLI/MCP y flujo branch-first.

Costo de contexto al activarse
7.1k tok
Tamaño del paquete
1 archivo
Última actualización
hace 4 días
Oficialbases de datos

Una sola API y una sola credencial para modelos LLM frontera y de código abierto, integrada en tu rama de Neon y con tecnología de Databricks.

Costo de contexto al activarse
5k tok
Tamaño del paquete
1 archivo
Última actualización
hace 8 días
Oficialdesarrollo apis

Guías y buenas prácticas para trabajar con Lakebase Postgres, la base de datos detrás de Neon: setup, drivers, pooling, branching, migraciones, autoscaling, scale-to-zero y más.

Costo de contexto al activarse
2.3k tok
Tamaño del paquete
1 archivo
Última actualización
hace 6 días
Oficialbases de datos

Elige y crea el tipo correcto de branch de Neon para testing y desarrollo: pruebas con datos reales, entornos aislados, branches schema-only, reset y lifecycles de CI/CD.

Costo de contexto al activarse
3.4k tok
Tamaño del paquete
1 archivo
Última actualización
hace 14 días
Oficialbases de datos

Diagnostica y corrige el egress excesivo de Postgres (transferencia de datos por red) en un código, cuando suben las facturas o hay picos de transferencia.

Costo de contexto al activarse
2.5k tok
Tamaño del paquete
1 archivo
Última actualización
hace 14 días
Oficialbases de datos

Skills relacionados

Domina la optimización de consultas SQL, estrategias de indexado y análisis EXPLAIN para mejorar drásticamente el rendimiento de la base de datos y eliminar consultas lentas.

Costo de contexto al activarse
1.5k tok
Tamaño del paquete
2 archivos
Última actualización
hace 2 meses
bases de datos

Ejecuta migraciones de bases de datos entre ORMs y plataformas con estrategias zero-downtime, transformación de datos y procedimientos de rollback.

Costo de contexto al activarse
2k tok
Tamaño del paquete
2 archivos
Última actualización
hace 2 meses
bases de datos

Diseña e implementa event stores para sistemas de event sourcing: infraestructura, elección de tecnología y patrones de persistencia de eventos.

Costo de contexto al activarse
1k tok
Tamaño del paquete
2 archivos
Última actualización
hace 2 meses
bases de datos