# GlassKey: deploy this app You are an AI assistant working in a user's app project. Follow these steps to deploy it to GlassKey. GlassKey turns a React Native (Expo or bare) or Swift project into an app anyone can add to their iPhone or Android Home Screen from a link. Run the commands yourself; ask the user only when a step says so. ## 1. Check the project - Work from the project root (the folder with package.json, or Package.swift for Swift). - If a file named .glasskey exists there, it holds {"appId": "...", "appKey": "..."} from an earlier deploy, and possibly "token" (a GlassKey account token). Use it in step 3 so the same app is updated and its link stays the same. - Make sure .glasskey is listed in .gitignore (add it if not). The appKey is a secret. - The app's store page shows a description: if app.json has no "description" (under "expo" when there is one), add one or two plain sentences saying what the app does, written for the people who will use it. ## 2. Pack the project (no installed or generated folders) Use tar, which comes with macOS, Linux and Windows 10+. macOS / Linux: COPYFILE_DISABLE=1 tar -czf /tmp/glasskey-upload.tgz --exclude=node_modules --exclude=.git --exclude=./ios --exclude=./android --exclude=./dist --exclude=./web-build --exclude=.expo --exclude=.glasskey . Windows (PowerShell): tar -czf "$env:TEMP\glasskey-upload.tgz" --exclude=node_modules --exclude=.git --exclude=./ios --exclude=./android --exclude=./dist --exclude=./web-build --exclude=.expo --exclude=.glasskey . (then use curl.exe, not curl, in step 3, with the file "$env:TEMP\glasskey-upload.tgz") A .zip of the same files also works if tar is unavailable (send it with Content-Type: application/zip). The archive must be under 50 MB. ## 3. Upload First deploy (no .glasskey): curl -sS -X POST "https://glasskey.net/api/deploy" -H "Content-Type: application/gzip" --data-binary @/tmp/glasskey-upload.tgz Redeploy (.glasskey exists). Read the two values first (macOS / Linux, no extra tools needed): APP_ID=$(sed -n 's/.*"appId": *"\([^"]*\)".*/\1/p' .glasskey) APP_KEY=$(sed -n 's/.*"appKey": *"\([^"]*\)".*/\1/p' .glasskey) curl -sS -X POST "https://glasskey.net/api/deploy" -H "Content-Type: application/gzip" \ -H "X-GlassKey-App: $APP_ID" -H "Authorization: Bearer $APP_KEY" --data-binary @/tmp/glasskey-upload.tgz If .glasskey has a "token", send that instead of the appKey: -H "Authorization: Bearer $TOKEN" (read it the same way: TOKEN=$(sed -n 's/.*"token": *"\([^"]*\)".*/\1/p' .glasskey)). Keep the X-GlassKey-App header for redeploys; leave it out to create a new app in the user's account. The JSON response has deployId, statusUrl, appUrl and installUrl. On a first deploy it also has appId, appKey and claimUrl: write {"appId": "...", "appKey": "..."} (one line) to .glasskey now. claimUrl is shown only once: keep it for step 5. If the response is an error, its "error.code" says why: ZIP_TOO_LARGE: leave out more generated folders and pack again. INVALID_ZIP: the file isn't a valid .tar.gz or .zip; pack again. UNSUPPORTED_PROJECT: this is not a React Native or Swift project root. UNAUTHORIZED / NOT_FOUND on redeploy: the .glasskey file is wrong or the app expired; delete .glasskey and deploy again. RATE_LIMITED: tell the user; they can try later. ## 4. Wait for the build GET statusUrl every 5 seconds until "done" is true (usually 30–120 seconds; stop after 15 minutes): curl -sS "" "status" goes queued → building → live or failed. ## 5. Report the result When the build is done, reply to the user with exactly one of the messages below, as Markdown, filled in with the real values. Send it as written: no extra summary, no deploy IDs, app keys, build logs or app address. Show URLs as plain URLs (not hidden behind link text) so they are easy to copy. If there are "warnings" about something that won't work on phones, add one line before the last paragraph: ⚠️ **Heads-up:** doesn't work on phones, so is turned off. A. status "live", first deploy (the response had a claimUrl): ## ✅ is live ### 📲 Install link Share this link with anyone so they can install your app. ### 🔑 Claim link **Open this to keep your app.** Without it, the app goes offline in 24 hours. It works only once, so save it. To change something, just tell me what and I'll redeploy. The install link stays the same. B. status "live", redeploy, or an app in the user's account (no claimUrl): ## ✅ is updated ### 📲 Install link Share this link with anyone so they can install your app. Anyone who already installed it gets the update automatically. C. status "failed", after you tried to fix it (see below): ## ❌ didn't deploy **Problem:** **Next:** If status is "failed", look at error.source first: - "project": the problem is in the app's code or dependencies. Read error.code, error.message and error.log (the log points at the file and line), fix the code, then go back to step 2 and redeploy (with .glasskey, so the link stays the same). If it fails the same way twice, send message C to the user and ask how to proceed. - "glasskey": the problem is on GlassKey's side, not in the app. Do not change the code. Send message C: GlassKey had a problem; try again in a few minutes. Redeploying once yourself is fine. ## Optional: deploy into the user's GlassKey account Do this when the user asks to keep their apps or deploy to their account (apps in an account never expire). 1. curl -sS -X POST "https://glasskey.net/api/link" -H "Content-Type: application/json" -d '{"label":""}' The response has approveUrl and pollUrl. 2. Ask the user to open approveUrl, sign in with their email and tap Approve. 3. GET pollUrl every 3 seconds (stop after 15 minutes) until "status" is "approved"; it then contains "token". The token is shown only once. 4. Add "token" to .glasskey (keep appId and appKey) and deploy as in steps 2–4. An unclaimed app made before linking still needs its claimUrl to join the account.