Skip to content

Sites

Before proceeding

Ensure you install the CLI, log in to your Appwrite account, and initialize your Appwrite project.

The CLI handles the creation, deployment, and execution of Appwrite Sites, as well as the configuration of the variables.

Initialize site

Create a new site using the following command:

Shell
appwrite init sites

Pull site

You can also pull your existing Appwrite Sites from the Appwrite Console using the pull command in the folder containing your appwrite.json file.

Shell
appwrite pull sites

appwrite.json

After initializing your Appwrite project and pulling your existing sites, your appwrite.json file should look similar to the following:

JSON
{
    "projectId": "<PROJECT_ID>",
    "sites": [
        {
            "$id": "<SITE_ID>",
            "name": "Documentation template",
            "enabled": true,
            "logging": true,
            "framework": "astro",
            "timeout": 30,
            "installCommand": "npm install",
            "buildCommand": "npm run build",
            "outputDirectory": "./dist",
            "specification": "s-1vcpu-512mb",
            "buildRuntime": "node-22",
            "adapter": "ssr",
            "fallbackFile": "",
            "path": "sites/documentation-template"
        }
    ]
}

Push site

Use the push command in the folder containing your appwrite.json file to push the changes you made.

Shell
appwrite push sites

Commands

The functions command lets you view, create, and manage your Appwrite Sites. Appwrite Sites CLI commands generally follow the following syntax:

Shell
appwrite sites [COMMAND] [OPTIONS]
CommandDescription
list [options]
Get a list of all the project's sites. You can use the query params to filter your results.
create [options]
Create a new site.
list-frameworks [options]
Get a list of all frameworks that are currently available on the server instance.
list-specifications [options]
List allowed site specifications for this instance.
list-templates [options]
List available site templates. You can use template details in createSite method.
get-template [options]
Get a site template using ID. You can use template details in createSite method.
list-usage [options]
Get usage metrics and statistics for all sites in the project. View statistics including total deployments, builds, logs, storage usage, and compute time. The response includes both current totals and historical data for each metric. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, defaults to 30 days.
get [options]
Get a site by its unique ID.
update [options]
Update site by its unique ID.
delete [options]
Delete a site by its unique ID.
update-site-deployment [options]
Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site.
list-deployments [options]
Get a list of all the site's code deployments. You can use the query params to filter your results.
create-deployment [options]
Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID.
create-duplicate-deployment [options]
Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build.
create-template-deployment [options]
Create a deployment based on a template. Use this endpoint with combination of listTemplates to find the template details.
create-vcs-deployment [options]
Create a deployment when a site is connected to VCS. This endpoint lets you create deployment from a branch, commit, or a tag.
get-deployment [options]
Get a site deployment by its unique ID.
delete-deployment [options]
Delete a site deployment by its unique ID.
get-deployment-download [options]
Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
update-deployment-status [options]
Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details.
list-logs [options]
Get a list of all site logs. You can use the query params to filter your results.
get-log [options]
Get a site request log by its unique ID.
delete-log [options]
Delete a site log by its unique ID.
get-usage [options]
Get usage metrics and statistics for a for a specific site. View statistics including total deployments, builds, executions, storage usage, and compute time. The response includes both current totals and historical data for each metric. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, defaults to 30 days.
list-variables [options]
Get a list of all variables of a specific site.
create-variable [options]
Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables.
get-variable [options]
Get a variable by its unique ID.
update-variable [options]
Update variable by its unique ID.
delete-variable [options]
Delete a variable by its unique ID.