SyncNode logo
Bolt Security Guide

How to keep your API keys safe in Bolt.new

Bolt can take you from an idea to a published app very quickly, and it even runs a security audit when you publish. An audit is a great safety net, but it isn't a plan. Here's how to set up your keys so you rarely need one.

Updated November 2, 2026 · 6 min read · $5 free credit, no subscription

The short answer

  1. Run AI calls in server functions, never in browser code.
  2. Store keys in the Secrets panel, under the database icon.
  3. Use the publish security audit, but treat it as a first pass.
  4. Replace any key that was ever exposed. Removing it from your code isn't enough.
  5. Use SyncNode so your project holds one key instead of one per provider.

Where keys go wrong in Bolt

Keys in client code

If an AI call runs in the browser, its key goes to every visitor. Bolt's server functions exist so that sensitive work stays on the server.

Trusting the audit alone

Bolt's publish audit looks for exposed secrets and other problems, but Bolt itself calls it a first pass. Taking a key out of your code also doesn't help if someone already copied it.

Open server functions

A function can hide a key and still be open to anyone who finds its URL. If it spends money, it needs a sign-in check and a limit per user.

How to store keys safely in Bolt

  1. Put AI calls in a server function

    Bolt says its server functions can work with any provider that has an HTTP API. Ask Bolt to build the feature that way, and keep the browser talking only to your function.

  2. Add the key in the Secrets panel

    Click the database icon at the top of the screen, choose Secrets, then add a name and value. Names are case-sensitive, so they must match your code exactly.

  3. Check who can see your project

    Bolt's sharing rules keep environment variables from Viewers, but people with higher access can see them. Only give edit access to people you trust with your keys.

  4. Run the security audit before you publish

    It's a quick extra check. Review anything it flags for you, since Bolt says it leaves architectural fixes for you to review.

  5. Replace anything that was exposed

    If the audit finds a key in your code, create a new one at the provider, then delete the old one. Treat it as already copied.

Why SyncNode is great for Bolt

Bolt helps you find a key that ended up in the wrong place. SyncNode means most of your keys were never in the project to begin with.

One entry in the Secrets panel

Keep your provider keys in the SyncNode dashboard and add a single entry to Bolt's Secrets panel: SYNCNODE_API_KEY. Bolt's secret names are case-sensitive, so fewer names means fewer mistakes.

A natural fit for server functions

SyncNode is plain HTTPS, which is exactly what Bolt's server functions are built to call. There's no SDK to install and no build settings to fight.

Fixing a leak takes one step

Instead of replacing keys at several providers, rotate your SyncNode key and update one secret. The old key stops working within 30 seconds.

Safer sharing

Anyone who can see your Bolt secrets sees one key that can be rotated, not your provider keys. When a collaborator leaves, you have one key to change.

Screen content on launch day

Bolt apps can go live the day they're built, so user content can arrive just as fast. One extra request in your server function screens text and images before they reach a model.

Files that last

Connect a storage host and SyncNode copies generated images and video there, so your app isn't relying on a provider's temporary link.

Paste this into Bolt

First add your OpenRouter key on the SyncNode API Keys page and create a sn_live_ key. Add it in Bolt's Secrets panel as SYNCNODE_API_KEY. Then paste this:

Prompt
Add an AI feature that goes through SyncNode.

Create a server function called ask-ai. It must require a signed-in user and limit each user to 20 requests per hour.

It reads the API key from the secret named SYNCNODE_API_KEY. Never put the key in code or in client-side variables.

1. POST the user's text to https://moderate.syncnode.ai with { apiKey, text }. Stop if overall_moderation.safe isn't 1.
2. POST to https://run.syncnode.ai/chat-completion with { apiKey, model: "openai/gpt-4o-mini", messages }.

The browser only ever calls this server function. API reference: https://syncnode.ai/llms.txt

Bolt writes the function itself, but these are the two calls it should make. Change the limit of 20 requests to suit your app.

The calls your server function makes
// SYNCNODE_API_KEY comes from Bolt's Secrets panel.
// Runs on the server, never in the browser.

// 1. Check what the user sent.
const mod = await fetch("https://moderate.syncnode.ai", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ apiKey: SYNCNODE_API_KEY, text })
}).then(r => r.json());
if (mod.overall_moderation?.safe !== 1) return { blocked: true };

// 2. Only safe input reaches the model.
const res = await fetch("https://run.syncnode.ai/chat-completion", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    apiKey: SYNCNODE_API_KEY,
    model: "openai/gpt-4o-mini",
    messages: [{ role: "user", content: text }]
  })
});

What SyncNode doesn't fix

No tool removes all the risk, so here's the honest list.

  • It doesn't replace the audit. SyncNode protects your AI keys. Sign-in, database rules and the rest of your app still need checking, so keep running Bolt's audit.
  • Treat SYNCNODE_API_KEY like any secret. Anyone holding it can run tasks. If it ever lands in client code, rotate it, even if the audit removed it.
  • Your provider keys sit with SyncNode. That's the point, but it means trusting us with them, so keep a spending limit at each provider too.
  • There's a small per-call fee. It's $0.02 per AI call and $0.005 per moderation check, and your provider still bills you for usage.
Pricing: $0.02 per AI call and $0.005 per moderation check, with no subscription and $5 of free credit to start. See full pricing.

Common questions

It helps. Bolt says it scans for exposed secrets and removes them from client code. Bolt also calls the audit a first pass, and removing a key from your code doesn't help if someone already copied it, so replace any key that was exposed.

In the Secrets panel: click the database icon at the top of the screen, then choose Secrets. Names are case-sensitive.

Your code uses a secret name that hasn't been added yet, or the name doesn't match exactly. Add it in the Secrets panel with the same spelling and capitalization.

Yes. A Bolt server function can call SyncNode with a normal HTTPS request, and there's no SDK to install.

Guides for your other tools

Details about Bolt come from its official docs, checked on November 2, 2026. Products change, so check them for the latest:

Bolt is a trademark of its owner. SyncNode isn't affiliated with or endorsed by Bolt. This guide is general information, not legal or security advice for your specific app.

Ship fast. Stay protected.

Join the builders behind 9M+ AI runs on SyncNode. Lock away your keys and moderate your users in one afternoon, with $5 free to start.

Start free
SyncNode dashboard showing tasks, costs and results