Backend Secrets manager UI for API keys
Secrets manager

Appifio Creator · Lesson K07 · Technical

Secrets &
Backend Function - keep keys out of the browser

Technical view for people who know F04: store API keys in Secrets manager, run server logic via executeBackendFunction, and stop AI from hardcoding secrets into HTML.

Learning goals: Use Secrets manager UI correctly, know the client/server boundary, and know when Diff should reject a secret-leaking patch.

Reading time: about 14 minutes

Prerequisites: F04 (basic Secrets), T06 (Backend API key), K02 (Diff before Save).

Previous → next: K06 → K07 → K08

Main UI labels: Secrets manager · Add secret · Edit secret · Delete secret · Key name · Secret value · Description (optional)

1. Secret flow

Backend tab → Secrets manager → Add secret
→ Key name (ASCII) + Secret value → Secret saved successfully
Admin page (logged in)
appifio_client.appifio_executeBackendFunction('sendMail', params)
Node sandbox - backend/functions/*.js
await appifio.secrets.get('SMTP_KEY') → call external service → return result (secret never shown in full on screen)
❌ Guest: executeBackendFunction blocked · ❌ Client: readFsFile backend/secrets/…

2. Glossary

TermMeaning
Secrets managerSensitive-key area on the Backend tab - admin+ roles only
Key nameSecret id (e.g. STRIPE_API_KEY) - letters, numbers, underscore; no accented characters
executeBackendFunctionCall a Node handler in backend/functions/ from a page - guests usually blocked
appifio.secrets.getAsync read of a secret - only valid inside backend/functions, never on the frontend
Masked secret on screenFull secret value is not returned to the client - only masked form

3. UI steps

  1. Open BackendSecrets managerAdd secret.
  2. Fill Key name, Secret value, optional Description (optional) → save. See Secret saved successfully.
  3. If the key has accented characters, UI reports invalid key - use ASCII (e.g. MAIL_API_KEY).
  4. Ask AI to write backend/functions/myHandler.js using appifio.secrets.get('KEY_NAME') inside the handler.
  5. From an admin page, call executeBackendFunction to test - don’t print the secret to HTML or console.log.
  6. Change a value: Edit secret. Remove entirely: Delete secret + confirm - not undoable.

4. Backend Function explained

Client sends params, server holds the secret: The page only passes public data (recipient email, amount…). The backend handler reads the key from Secrets manager, then calls Stripe, SMTP, webhooks…

Diff protection: If AI proposes hardcoding a secret into HTML/JS or readFsFile('backend/secrets/…'), Diff reject (✗) - fix the prompt or move logic into backend/functions.

Deeper references: Full concepts in F04; Backend API key setup in T06; rate-limit (“Try again later”) in X06.

5. Compared with other tools

  • Vercel/Netlify env + Functions: same server-side secret model; Appifio is built into the Creator sandbox - no separate deploy.
  • Firebase Functions + Secret Manager: similar separation; different call path via executeBackendFunction.
  • WordPress wp-config.php: often puts keys in a shared config file; Aura keeps backend/secrets/*.secret away from client code.

6. Technical limits

You can

  • Custom Node logic (mail, payment, webhook)
  • CRUD secrets via admin UI
  • Quick tests from a logged-in admin page

Not available

  • Guests calling executeBackendFunction when security enforce is on
  • Reading secrets from the frontend by any method
  • Long-running cron/queue jobs in the sandbox

7. Security

Only backend/functions may use appifio.secrets.get and be targets of executeBackendFunction - don’t paste secrets into comments, README, or AI chat.

Guests blocked: Public forms cannot call sensitive functions - design via an admin page or backend session validation first.

8. Common issues

SituationFix
Invalid key / accented charactersChange Key name to letters/numbers/underscore (e.g. API_KEY_VIET)
Diff ✗ because secret leakedReject the patch; remind AI to use secrets.get only in backend/functions
Function returns 401 from guestCall from an admin page with a validated session; see F03/T06
Rate-limit message when testing rapidlySeparate send limit for executeBackendFunction - wait and retry (X06)

9. Tips

  • Prompt AI: “Call executeBackendFunction; use appifio.secrets.get only in backend/functions; never show the full secret on screen.”
  • Name keys UPPER_SNAKE_CASE - easier to grep, less confusion with normal JS vars.
  • Always review Diff before Save changes (K02) - especially after a new integration.
  • Rotate secrets periodically: Edit secret with the new value, deploy the function, then Delete secret for the old one.
  • One key, one purpose - don’t reuse STRIPE_KEY for both test and production in the same project.

10. Self-check

  1. Can you add a secret and see Secret saved successfully?
  2. Do you understand why guests can’t call executeBackendFunction?
  3. Do you know Diff should reject secrets that land in HTML?

Next lesson

K08 - Soft delete · Hard delete · Restore

Safe file management: soft delete is recoverable; permanent delete is one-way - Clone first.

Appifio Creator · User guide · K07