Docs
Skip to content

Sites

Server Side Rendering_

Learn how to host SSR web apps on Appwrite Sites.

2 min read

Raw

Server Side Rendering (SSR) apps generate HTML content dynamically on the server for each request and send fully rendered pages to the browser. This approach improves performance for the initial load and enhances SEO since search engines can easily index the content. While SSR can be slightly slower than static apps due to server-side processing, it provides a good balance between performance and interactivity.

Since Appwrite's CDN supports dynamic content delivery, any server-side processing implemented in your site will be executed at your user's nearest edge location. The CDN also uses advanced compression algorithms to reduce data transfer sizes and improve delivery times of your site content. Any data relevant to other Appwrite products that you have integrated in your site, such as Auth, Databases, Storage, Functions, and Messaging, will be served from your project's pre-selected region.

Configuring your Appwrite Site to use SSR

When Appwrite builds your site for the first time, it scans your project's configuration files to determine whether the website should be rendered as static pages or using SSR.

If you need to manually update these settings, here are the steps to do so:

  1. Navigate to your site in the Appwrite Console and head to the Settings tab > Build settings section
  2. Select the Server side rendering checkbox (you may need to update your project codebase depending on your framework option)
  3. Confirm that the appropriate install command, build command, and output directory are set
  4. Click on the Update button and redeploy your site

Rendering strategy
Rendering strategy

Enabling SSR builds on your web app

To enable SSR builds for your web app, you may need to make some additional updates in case of the following frameworks:

Appwrite-specific environment variables

You can access several environment variables pertaining to your Appwrite project in SSR apps.

VariableDescriptionAvailable at Build and/or Run Time
APPWRITE_SITE_API_ENDPOINTThe API endpoint of the running siteBoth
APPWRITE_VERSIONThe Appwrite version used to run the siteBoth
APPWRITE_REGIONThe region where the site will run fromBoth
APPWRITE_DEPLOYMENT_TYPEThe deployment source type, such as manual, cli, or vcsBoth
APPWRITE_SITE_API_KEYThe site API key used for server authenticationBuild time
APPWRITE_SITE_IDThe ID of the running siteBoth
APPWRITE_SITE_NAMEThe name of the running siteBoth
APPWRITE_SITE_DEPLOYMENTThe deployment ID of the running siteBoth
APPWRITE_SITE_PROJECT_IDThe project ID of the running siteBoth
APPWRITE_SITE_RUNTIME_NAMEThe runtime name of the running siteBoth
APPWRITE_SITE_RUNTIME_VERSIONThe runtime version of the running siteBoth
APPWRITE_SITE_CPUSThe CPU (runtime) specification of the running siteBoth
APPWRITE_SITE_MEMORYThe memory (runtime) specification of the running siteBoth
APPWRITE_VCS_REPOSITORY_IDThe provider repository ID for VCS deploymentsBoth
APPWRITE_VCS_REPOSITORY_NAMEThe provider repository name for VCS deploymentsBoth
APPWRITE_VCS_REPOSITORY_OWNERThe owner of the provider repositoryBoth
APPWRITE_VCS_REPOSITORY_URLThe URL of the provider repositoryBoth
APPWRITE_VCS_REPOSITORY_BRANCHThe branch used for the VCS deploymentBoth
APPWRITE_VCS_REPOSITORY_BRANCH_URLThe URL of the branch used for the VCS deploymentBoth
APPWRITE_VCS_COMMIT_HASHThe commit hash used for the VCS deploymentBoth
APPWRITE_VCS_COMMIT_MESSAGEThe commit message used for the VCS deploymentBoth
APPWRITE_VCS_COMMIT_URLThe URL of the commit used for the VCS deploymentBoth
APPWRITE_VCS_COMMIT_AUTHOR_NAMEThe name of the VCS commit authorBoth
APPWRITE_VCS_COMMIT_AUTHOR_URLThe URL of the VCS commit authorBoth
APPWRITE_VCS_ROOT_DIRECTORYThe root directory configured for the VCS deploymentBoth

VCS metadata variables are populated for Git deployments. For manual and CLI deployments, VCS fields may be empty.

Was this page helpful?

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