Docs
Skip to content

Sites

Deploy from Git_

Learn to version and update your Appwrite Sites' code with deployments.

3 min read

Raw

Appwrite Sites allows you to host and deploy websites directly within the Appwrite platform. Each site can have many deployments, which can be thought of as versions of the web application.

With Appwrite Sites, you can seamlessly deploy updates from Git repositories, enabling you to track changes to your web app as part of your development workflow. This versioning approach ensures that your site stays up-to-date and your deployment process is fully integrated with your source control, streamlining collaboration and updates.

Create deployment

The recommended way to manage your Appwrite Sites deployments is to use a version control system like Git. This offers simple versioning and collaboration that will easily fit into the rest of your development workflow.

You can only use Git deployment for Appwrite Sites connected to Git. Create a new site with GitHub or connect your existing site to a GitHub repository in your site’s Settings > Git repository > Connect Git.

Git repository
Git repository

  1. Using Git, checkout to the branch you configured as the production branch when creating the Appwrite Site.
  2. Create a new commit.
  3. Push the commit.
  4. A new deployment will be automatically created, built, and activated.

Commits to the production branch

When you push a commit to the production branch, usually main, a new deployment is created, built, and activated. This means the new deployments immediately replace the current active deployment and can be used on your site’s primary domain.

Commits to other branches

When you push a commit to a branch other than the production branch, a new deployment is created, but it is not activated. A preview link is generated to test this deployment; however, only authorized users, i.e., members of your Appwrite organization, can access this link.

Git configuration

If you need to update your Git configuration, navigate to Sites > your site > Settings > Git repository.

Build triggers

Build triggers control which Git changes create automatic deployments. You can configure branch filters and path filters with glob patterns.

Branch filters match branch names. Add patterns to limit automatic deployments to specific branches.

Plain text
main
staging
preview/**

Path filters match files changed in a commit or pull request. Leave this field empty to create deployments for all file changes, or add patterns to deploy only when specific files change.

Plain text
apps/web/**
packages/ui/**
!docs/**

Use these formats to write glob patterns.

PatternWhat it doesExampleMatches
mainMatches exact textmainmain
*Matches within one path segmentrelease/*release/1.0
**Matches across nested path segmentspreview/**preview/test, preview/team/test
?Matches one character in one path segmentv?.?v1.0, v2.5
[abc]Matches one character from a set[Mm]ainmain, Main
[a-z]Matches one character in a rangerelease/[0-9]*release/1.0
\Escapes a special characterfile\?.txtfile?.txt
!Excludes matching branches or paths!docs/**Excludes changes under docs/

Install command

The install command of your site allow you to install your site’s dependencies. You can specify custom install scripts such as ones that let you configure your npm command with options or use an alternative package manager such as pnpm or yarn.

Build command

The build command of your site allow you to create a build of the site ready for output. You can specify custom build scripts, customize your npm command options, or use alternative package managers.

Output directory

The output directory will contain the files generated by your site's build command. The contents of this directory will be available to view on your site's public URL.

Debugging

  • If you updated your site's configuration but the deployment is not working as expected, you may need to first redeploy your site before the changes take effect.
  • If you're missing some code files at build time, verify your build command and ensure that the build output is included in the Git configuration's output directory. Only files in the output directory folder will be available after deployment.
  • If you're self-hosting Appwrite, you will need to configure some environment variables to enable Git deployments.

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.