Build your apps with GitHub.
You can run a GitHub repository as an app. Build and test on your own machine, and it goes live when you push to the branch you chose. Writing the plan and design doc first works the same way as in How to Build Apps.
What changes when you connect GitHub
- The app runs on the code in the connected branch.
- Push to that branch, and the change is taken in automatically and goes live in the app people use. Work on other branches doesn’t go live.
- While it’s connected, the app’s folder in Storage is read-only. Make your changes in GitHub.
- Change it on your machine
- Push to the connected branch
- Ask “@INARY Fix …” in a conversation
- Approve it
- The AI opens a pull request
- Merge it
- The connected branch
- INARY takes it in automatically
- The app is updated
How to connect
- 01
Connect the GitHub connector
An admin of your organization connects it. You choose which repositories INARY can see in GitHub’s settings.
- 02
Press “Run as an app”
Open the repository on INARY’s GitHub screen and press “Run as an app.”
- 03
Choose a branch and how to set it up
Choose a branch, then “Build a new app” or “Connect an existing app.” For a new one, choose its name and how it opens (Inside INARY or In the browser). If you connect an existing one, its files are replaced with the branch’s contents.
Rules for running in INARY
Follow these rules when you build on your own machine, and it runs in INARY as is.
- BuildPut a
Dockerfileat the top of the repository. Without one, it’s built automatically frompackage.json,requirements.txt,go.modand so on. - ListeningListen for HTTP on
0.0.0.0, on the port in thePORTenvironment variable. - DatabasePut
inary.jsonat the top with{"database": "postgres"}, and the app gets its own PostgreSQL database, with the connection string passed in theDATABASE_URLenvironment variable. The app creates its own tables. - FilesFiles in the folder at the
DATA_DIRenvironment variable survive rebuilds. If two writes hit the same file at once, the later one wins, so don’t use files in place of a database. - API keys and similar valuesPut them in “Environment variables” in the app’s folder in INARY’s Storage, and read them from environment variables in the app. Never write the values into code or files.
- An API for AI to read and operate the appReturn a list of what AI can read and do at
GET /inary/capabilities, and run one of them atPOST /inary/call. - Apps that open inside INARYINARY tells the app who’s opening it in headers (
X-Inary-Account-Id,X-Inary-Display-Name(URI-encoded),X-Inary-Is-Administrator). These headers aren’t added on your own machine, so add them yourself when you test. Declare the paths that receive notifications from other services (webhooks) ininary.json, like{"public": ["/webhooks"]}. - Apps that open in the browserThe app itself provides sign-in that lets in only your organization’s members, and a way to turn away bots.
Changing it from INARY
You can also change a connected app’s code by asking AI. Send “@INARY Fix …” and, with the default setting (“Ask before running”), you’re asked to approve it first. Once you approve, the AI changes the code and opens a pull request to the connected branch. It never writes to the branch directly or merges on its own. When you merge, the change is taken in and goes live automatically.
Keep the design doc in the repository, and when you ask, add “Read the design doc first.”
If something fails, or to disconnect
- If taking in a change or starting the app fails, the previous version keeps running. Fix the code in GitHub and push, and it’s taken in again automatically. The result of a rebuild from a push shows up in the app’s folder in Storage.
- To disconnect, use “Disconnect” on INARY’s GitHub screen. The app and its files stay, and pushes are no longer taken in. You can then change it in Storage.
