API Integration

Need to talk to Stripe, Twilio, OpenAI, or your own internal API? Mention it in the chat and you get a typed client back — with env vars, error handling, and a matching frontend shape — not just a raw fetch call.

What the generator sets up

  • An integrations/ folder with one file per service.
  • Environment variables in .env.example for keys and endpoints.
  • Retry-with-backoff for transient errors, so a blip doesn't fail the request.
  • A typed response shape on the frontend, regenerated when you change the model.

Example — Stripe checkout

"Add Stripe Checkout. On success, mark the order as paid and email the customer."

Result: a Checkout-session endpoint, a webhook handler that flips the order status, and an email template wired through your app's email provider.

Integrating your own API

  1. Paste a sample response or an OpenAPI URL into the chat.
  2. Say what you want — "generate a typed client for this and a hook to load orders on the dashboard."
  3. You get the client, the types, and the UI wiring in one pass.

Handling keys and secrets

  • The generator writes placeholders into .env.example; you fill the real values in .env.
  • .env is git-ignored, so keys never reach the repo or the client bundle.
  • Rotate any key you accidentally paste into code — treat committed secrets as public.

Common mistakes to avoid

  • Pasting live secret keys into the chat. Describe the integration; add real keys yourself in .env.
  • Calling a third-party API straight from the frontend. Route it through the backend so the key stays server-side.
  • No error handling. Ask for retries and clear user-facing errors on network failures.

FAQ

Which services are supported?

Common ones are wired by name (Stripe, Twilio, SendGrid, S3, and more) — see Third-Party Services. Anything with a REST API or npm SDK can usually be integrated; give the AI a docs link.

Where do the API keys go?

In .env on the server. The frontend never sees them; calls are proxied through your backend.

What if the external API changes?

Paste the new response or docs and ask the AI to update the client and types.

Was this article helpful?