{
 "schema_version": 1,
 "generated": "2026-10-26",
 "id": "margelo-ai-chat-demo--plan-relay-server-before-shipping",
 "repo": "margelo/ai-chat-demo",
 "repo_url": "https://github.com/margelo/ai-chat-demo",
 "repo_slug": "margelo-ai-chat-demo",
 "title": "Plan a relay server that keeps the API keys off the device",
 "page_title": "How to plan a relay server that keeps the API keys off the device with AI Chat Demo",
 "summary": "Map each key-using call in the app to a server endpoint before any production release.",
 "who": "A team lead or developer preparing to ship a version of this chat app to real users who must keep OpenAI and Pinecone keys private.",
 "problem": "The README warns that keys in the app bundle can be extracted by anyone, so a shipped build would expose the accounts.",
 "outcome": "A written list of which app calls move behind a server, so the keys stay server-side.",
 "steps": [
  "Read the README note that says to put a relay server in front and keep the keys server-side.",
  "List every place in `app/src/openai/` and `app/src/rag/` that uses a key from `src/config.ts`.",
  "Design a relay server with one endpoint for the model connection and one for the knowledge base search, and note which request fields the app would send to each. (inferred, check the README)",
  "Update the app config so it points to the relay URL instead of holding keys, then test with `npm run ios` or `npm run android`. (inferred, check the README)"
 ],
 "agent_prompt": "For the margelo/ai-chat-demo repo, list each file that reads an API key from src/config.ts and propose a relay server design that holds those keys server-side. Output the endpoint list and one verification step that confirms no key remains in the app bundle.",
 "agents": [
  "any"
 ],
 "difficulty": "Advanced",
 "time": "3 hours",
 "basis": "readme",
 "caveat": "The repo does not include a relay server, so the server side is new work the team must build and secure.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "typescript",
 "requirements": [
  "Xcode and CocoaPods for iOS, or the Android setup from the React Native environment guide",
  "Node 22.11 or newer",
  "An OpenAI API key",
  "A Pinecone API key, a populated Pinecone index, and its index host"
 ],
 "risk": "sensitive",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "credentials",
   "notice": "Until a relay exists, any build of this app exposes the OpenAI and Pinecone keys to anyone who extracts them from the bundle."
  }
 ],
 "best": false,
 "score": 0.7,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/margelo-ai-chat-demo/plan-relay-server-before-shipping/",
 "md": "https://dedupedai.com/use-cases/margelo-ai-chat-demo/plan-relay-server-before-shipping/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/margelo-ai-chat-demo--plan-relay-server-before-shipping.json",
 "api_version": "v1"
}
