Skip to main content

Code and the Arianet repository

Every Arianet BaaS Project has an Arianet repository («مخزن آریانت», a built-in code repository) that is its default code source. You don't need a GitHub or GitLab account, or to know git, to build and publish an app:

  • Your AI assistant (ChatGPT, Claude, …) writes files straight into the Arianet repository through the Arianet MCP server.
  • Every change is a version, and every version deploys like a push: the Site is built and the migrations, config.toml and functions are applied, exactly the same steps as a git deploy.
  • The panel's Code («کد») page lists every version, compares two versions, restores an earlier one in one click and downloads the whole code as a zip.
  • GitHub and GitLab are optional: whenever you like, move the whole history to your own GitHub or GitLab repository and from then on pushes there deploy; and whenever you like, come back to the Arianet repository.

The Arianet repository​

  • The Arianet repository is created automatically the first time you open the Code page, or the first time your assistant writes. Its first version is the Arianet template (the version "Arianet template" on branch main), so the right Project layout is in the repository from the start.
  • Creating the repository deploys nothing; the first change you or your assistant writes makes the first deploy.
  • The layout is the usual repository layout: the Site with package.json (or static files such as index.html), migrations in arianet/migrations, functions in arianet/functions and settings in arianet/config.toml.
  • The repository is kept in the Project's region and is a real git repository, which is why its full history can move to GitHub or GitLab.
  • The production branch of the Arianet repository is always main.

The Code page​

Open Code («کد») in the Project's menu (/baas/projects/<id>/code in the panel). At the top you see:

  • Code source: the Arianet repository, or the GitHub or GitLab repository deploys come from now.
  • The repository size against the plan's limit and the number of versions kept.

Versions​

Versions are listed newest first. For each version:

ColumnMeaning
MessageWhat changed in this version, such as "Add checkout page"
AuthorYou or another Project member, an AI assistant (with the app's name, e.g. ChatGPT), system (such as the initial template) or a git push
FilesHow many files were added, changed or deleted
DeployThe deploy status of this version (queued, building, ready, failed) with a link to the deploy page and log
LiveThe version that is live in production now is marked "live"

New versions (from the assistant, the panel or a push) and deploy status changes show in the list without reloading the page.

Changes and comparing​

Open a version to see its files (added, changed or deleted) and each file's difference from the previous version (added and removed lines). You can also compare any two versions.

  • Binary files (such as images) are shown by name only.
  • For very large changes (more than 300 files or about 1 MB of difference) only the first part is shown.

Browsing files​

Browse the files of any version and view a file's text (up to 1 MB).

Building with an AI assistant​

Once the Arianet MCP server is connected to ChatGPT, Claude or another assistant, the assistant works on the Arianet repository with these tools:

ToolWhat it does
write_filesWrites or deletes files in a new version and deploys it (like a push).
list_versionsLists versions with their message, author and deploy status.
get_version_diffShows a version's changes or the difference between two versions.
read_codeReads the file list and a file's text at any version.
rollback_versionRestores an earlier version (with your explicit approval).
export_codeMakes a zip download link for the code (Exporting the code).
  • Every version the assistant writes is recorded with the author AI assistant and the app's name (e.g. ChatGPT or Claude); it is always clear who changed what.
  • After each version the assistant reads the deploy status; if it failed, it reads the log and fixes it in a new version.
  • If the Project has no repository yet, the first write_files creates the Arianet repository.

Example requests:

Add an "About us" page to the site and publish it.
Show me the latest changes; what changed yesterday?
Restore the previous version of the site; checkout broke after the last change.

The whole flow of building an app with an assistant: Build with AI.

Restoring an earlier version​

In the version list, open the version you want and restore it (or ask your assistant). Arianet makes a new version whose content is exactly that old version (Restore version <short id>) and deploys it like a push.

  • Nothing is removed from the history: later versions stay where they are, and you can go back to them if you change your mind.
  • The database is not rolled back: migrations that already ran are not undone by restoring code, and data does not change. To undo a database change, write a new migration.
  • Restoring works only when the code source is the Arianet repository. If deploys come from GitHub or GitLab, revert the change there and push (code_not_arianet).
  • To put only the frontend back to an earlier deploy, without a new code version, there is also the Site rollback.

Exporting the code (zip)​

From the Code page (or with the assistant's export_code tool), download all files of the latest version, or of any other version, as one zip file. The download link is valid for one hour and is made for you only.

Moving to GitHub or GitLab​

Whenever you want the code in your own GitHub or GitLab account (for example to work as a team with pull requests):

  1. If you haven't connected a GitHub or GitLab account yet, connect one on the Git and Deploy page.
  2. On the Code page, choose move to GitHub/GitLab, pick the account and choose an empty repository or create a new one (private by default).
  3. Arianet pushes the whole kept history to that repository and switches the deploy source to it (a webhook is added to the repository).

From then on every push to that repository's production branch deploys, and previews work too. The repository must be empty so that its own history is not lost (repository_not_empty).

Back to the Arianet repository​

When deploys come from GitHub or GitLab, choose back to Arianet repository on the Code page:

  • the history of that repository's production branch is imported into the Arianet repository and the history continues;
  • the deploy source becomes the Arianet repository again and the webhook is removed from the external repository.

Your GitHub or GitLab repository is not deleted or changed; its pushes simply no longer deploy.

Git access for developers​

On plans with git access, a developer can clone the Arianet repository with plain git and push to it, without GitHub or GitLab:

  1. On the Code page, create a git access token with a name and an access level: read (clone and pull only) or write (push too).
  2. The token secret is shown only once; store it somewhere safe right away.
  3. Use the clone address shown on the Code page:
git clone https://arianet:<token>@<host>/git/v1/repos/<ref>.git my-app
cd my-app
# your changes
git commit -am "Add checkout page"
git push origin main # a push to main deploys
  • Every push to main makes a new version with the author "git" and deploys like any other version.
  • The Code page lists the tokens with their creation and last-use times; delete a token you no longer need and it stops working at once.
  • Never put a token in code, a repository or a chat with an assistant.

Plan limits​

FreeStarterGrowthProBusiness
Repository size20 MB50 MB100 MB250 MB500 MB
Versions kept25102050
Export (zip)YesYesYesYesYes
Git access for developers (git clone and push)NoYesYesYesYes
  • Your plan's values are shown on the Code page.
  • When the number of versions goes past the plan's limit, the oldest versions are removed; the list shows only the kept versions, and only those can be restored or moved. The current code is always complete.
  • A version that would make the repository larger than the plan's size limit is refused (code_repo_full). Keep large files (videos, heavy images) in Storage, not in the code.
  • For higher limits, change the plan.

Permissions​

  • Viewing the Code page, versions, differences and files and exporting a zip needs baas:view.
  • Writing, restoring a version, moving to GitHub/GitLab or back to the Arianet repository and creating or deleting git access tokens needs baas:git:manage (Members).
  • Creating the repository, every version, restores, exports, moves, token creation and deletion and every git push are recorded in the account's activity log (never a token secret).

API​

Everything here is also in the BaaS management API (under /projects/{id}):

RequestWhat it doesPermission
GET /codeThe code source, the Arianet repository (branch, head, size, versions kept, clone URL) and the plan limitsbaas:view
GET /code/versions?limit=30&before=<sha>Versions, newest first (paged with next_before)baas:view
GET /code/versions/{sha}One version with its changed filesbaas:view
GET /code/diff?from=<sha>&to=<sha>The difference between two versions (from empty: the parent of to; to empty: the latest version)baas:view
GET /code/tree?ref=<sha|main>&path=<dir>The file listbaas:view
GET /code/file?ref=<sha|main>&path=<file>One file's content (up to 1 MB)baas:view
POST /git/commitsWrites files (files) and deletes (delete) in a new version and deploys itbaas:git:manage
POST /code/versions/{sha}/restoreRestores a version (a new version and a deploy)baas:git:manage
POST /code/exportA one-hour zip link (ref optional)baas:view
POST /code/githubMoves the history to GitHub/GitLab and switches the deploy sourcebaas:git:manage
POST /code/arianetSwitches the deploy source back to the Arianet repositorybaas:git:manage
GET / POST /code/tokens, DELETE /code/tokens/{token}Git access tokensbaas:git:manage

A write:

POST /projects/{id}/git/commits
{
"message": "Add about page",
"files": {
"src/about.html": "<h1>About us</h1>",
"public/logo.png": {"base64": "iVBORw0KGgo..."}
},
"delete": ["src/old.html"]
}

The response returns the new version (version) with its deploy. Every version has an author.kind: user, ai (with the app's name in author.client), system or git.

Errors​

CodeMeaning and fix
code_repo_fullThe repository would be larger than the plan's size limit; move large files to Storage or upgrade the plan.
code_not_arianetDeploys come from GitHub or GitLab; revert there and push, or first go back to the Arianet repository.
code_export_not_in_planZip export is not in your plan.
code_git_access_not_in_planGit access for developers is not in your plan; upgrade the plan.
repository_not_emptyThe target GitHub or GitLab repository is not empty; create a new repository or choose an empty one.
git_account_not_foundThe chosen GitHub or GitLab account was not found; connect it on Git and Deploy.
git_reauth_requiredArianet's access on GitHub or GitLab expired or was revoked; reconnect.

Errors of the deploy itself (such as build_failed or migration_failed) are the same as git deploy errors.