Appwrite.Services.Sites (appwrite v1.0.0)

View Source

The Sites service allows you to deploy and manage static or server-rendered web applications hosted on Appwrite Cloud.

This is an entirely new Appwrite Cloud service added in v1.0.0.

Concepts

  • Site – a deployable web application (think Vercel/Netlify projects)
  • Deployment – a specific build/version of a Site (each push creates one)
  • Variable – environment variable scoped to a Site (separate from Functions)
  • Log – a build or runtime log entry for a Deployment

Summary

Functions

Create a new Deployment for a Site (upload source code as a tarball).

Create an environment Variable for a Site.

Delete a Deployment by its unique ID.

Delete a specific Log entry.

Delete a Site by its unique ID.

Delete a Variable by its unique ID.

Get a Deployment by its unique ID.

Download a Deployment's source archive.

Get a specific Log entry.

Get a Site by its unique ID.

Get a Variable by its unique ID.

List build/runtime Logs for a Site.

List all Sites in the project.

List Variables for a Site.

Update a Deployment — activate it (make it live).

Update a Site's configuration.

Functions

create_deployment(site_id, code, activate, entry_point \\ nil)

@spec create_deployment(String.t(), binary(), boolean(), String.t() | nil) ::
  {:ok, map()} | {:error, any()}

Create a new Deployment for a Site (upload source code as a tarball).

Parameters

  • site_id (required)
  • code (required) – gzip-compressed tar archive of the site source
  • activate (required) – when true, automatically activates the deployment
  • entry_point (optional) – path to the server entry file (SSR only)

create_site(site_id, name, framework \\ nil, opts \\ [])

@spec create_site(String.t(), String.t(), String.t() | nil, keyword()) ::
  {:ok, map()} | {:error, any()}

Create a new Site.

Parameters

  • site_id (required) – unique identifier; use "unique()" to auto-generate
  • name (required) – display name
  • framework (optional) – framework hint: "nextjs", "nuxt", "sveltekit", "astro", "remix", "other", etc.
  • opts keyword list:
    • :build_command – shell command to build the site
    • :output_directory – directory of the build output (e.g. "dist")
    • :install_command – shell command to install dependencies
    • :root_directory – monorepo sub-path
    • :specification – compute specification for SSR (e.g. "s-1vcpu-512mb")
    • :timeout – max execution time for SSR in seconds
    • :enabled – boolean (default true)
    • :logging – boolean — enable/disable access logs (default true)

create_variable(site_id, key, value)

@spec create_variable(String.t(), String.t(), String.t()) ::
  {:ok, map()} | {:error, any()}

Create an environment Variable for a Site.

Parameters

  • site_id (required)
  • key (required) – variable name (e.g. "API_KEY")
  • value (required) – variable value

delete_deployment(site_id, deployment_id)

@spec delete_deployment(String.t(), String.t()) :: {:ok, map()} | {:error, any()}

Delete a Deployment by its unique ID.

Parameters

  • site_id (required)
  • deployment_id (required)

delete_log(site_id, log_id)

@spec delete_log(String.t(), String.t()) :: {:ok, map()} | {:error, any()}

Delete a specific Log entry.

Parameters

  • site_id (required)
  • log_id (required)

delete_site(site_id)

@spec delete_site(String.t()) :: {:ok, map()} | {:error, any()}

Delete a Site by its unique ID.

Parameters

  • site_id (required)

delete_variable(site_id, variable_id)

@spec delete_variable(String.t(), String.t()) :: {:ok, map()} | {:error, any()}

Delete a Variable by its unique ID.

Parameters

  • site_id (required)
  • variable_id (required)

get_deployment(site_id, deployment_id)

@spec get_deployment(String.t(), String.t()) :: {:ok, map()} | {:error, any()}

Get a Deployment by its unique ID.

Parameters

  • site_id (required)
  • deployment_id (required)

get_deployment_download(site_id, deployment_id)

@spec get_deployment_download(String.t(), String.t()) ::
  {:ok, String.t()} | {:error, any()}

Download a Deployment's source archive.

Parameters

  • site_id (required)
  • deployment_id (required)

Returns the download URL as a string.

get_log(site_id, log_id)

@spec get_log(String.t(), String.t()) :: {:ok, map()} | {:error, any()}

Get a specific Log entry.

Parameters

  • site_id (required)
  • log_id (required)

get_site(site_id)

@spec get_site(String.t()) :: {:ok, map()} | {:error, any()}

Get a Site by its unique ID.

Parameters

  • site_id (required)

get_variable(site_id, variable_id)

@spec get_variable(String.t(), String.t()) :: {:ok, map()} | {:error, any()}

Get a Variable by its unique ID.

Parameters

  • site_id (required)
  • variable_id (required)

list_deployments(site_id, queries \\ nil, search \\ nil)

@spec list_deployments(String.t(), [String.t()] | nil, String.t() | nil) ::
  {:ok, map()} | {:error, any()}

List Deployments for a Site.

Parameters

  • site_id (required)
  • queries (optional)
  • search (optional)

list_logs(site_id, queries \\ nil)

@spec list_logs(String.t(), [String.t()] | nil) :: {:ok, map()} | {:error, any()}

List build/runtime Logs for a Site.

Parameters

  • site_id (required)
  • queries (optional)

list_sites(queries \\ nil, search \\ nil)

@spec list_sites([String.t()] | nil, String.t() | nil) ::
  {:ok, map()} | {:error, any()}

List all Sites in the project.

Parameters

  • queries (optional)
  • search (optional)

list_variables(site_id)

@spec list_variables(String.t()) :: {:ok, map()} | {:error, any()}

List Variables for a Site.

Parameters

  • site_id (required)

update_deployment_status(site_id, deployment_id)

@spec update_deployment_status(String.t(), String.t()) ::
  {:ok, map()} | {:error, any()}

Update a Deployment — activate it (make it live).

Parameters

  • site_id (required)
  • deployment_id (required)

update_site(site_id, name, opts \\ [])

@spec update_site(String.t(), String.t(), keyword()) :: {:ok, map()} | {:error, any()}

Update a Site's configuration.

Parameters

  • site_id (required)
  • name (required) – new display name
  • opts – same keyword list as create_site/4 minus site_id

update_variable(site_id, variable_id, key, value \\ nil)

@spec update_variable(String.t(), String.t(), String.t(), String.t() | nil) ::
  {:ok, map()} | {:error, any()}

Update a Variable.

Parameters

  • site_id (required)
  • variable_id (required)
  • key (required)
  • value (optional)