跳到正文
Skillpedia
数据库48k · #5283

neon-object-storage

它能做什么

这项服务让你存储图片、文档等文件,并让这些文件与 Neon 项目的数据库保持同步。你项目的每个分支都会拥有自己独立的存储空间。

适用场景

  • ✓当你已经在使用 Neon 作为数据库,并希望数据和文件统一放在一个地方时。
  • ✓当文件与数据库数据必须在项目的不同版本之间始终保持同步时。
  • ✓当你想测试与文件相关的改动,又不想冒着损坏重要数据的风险时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/neon-object-storage/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/neon-object-storage/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我该如何设置文件存储,让它跟随 Neon 数据库的分支一起变化?”

每周 5 个新技能,1 分钟读完。

工作原理

你需要在 Neon 项目的配置文件(`neon.ts`)中定义想要的存储“桶”(buckets)。然后运行一条简单的命令即可创建它们,之后 Neon 会负责让这些存储与数据库分支保持同步。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Neon Object Storage

This is a preview 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 Neon 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 modes — private 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.

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.

…

常见问题

“S3 兼容”是什么意思?

意思是它采用了一套非常通用的文件存储通信标准(API),也就是 Amazon S3 等服务所使用的同一标准。因此你可以用熟悉的工具和库与它交互。

这里的“分支”是什么?

它们就像项目的副本,你可以用来测试新功能或做改动,而不影响主版本。这项服务会确保每个分支都有自己的文件,并与该分支的数据保持同步。

我可以把文件设为公开或私有吗?

可以。你可以把存储“桶”设置为私有(访问需要登录),也可以设置为公开读取(任何人都能查看,但只有你能添加或修改)。

详情

作者的原始描述

S3-compatible object storage that branches with your Neon project, so files and the database stay in sync across every branch.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5283
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能