Skip to content

Conversation

atharvadeosthale
Copy link

@atharvadeosthale atharvadeosthale commented Aug 14, 2025

Note: now also supports one-click deployments for Functions.

This PR adds one-click deployments for Appwrite Sites. It works as follows:

Drawbacks

  • User needs to have release tags on repo for now, I intend to get this sorted by changing Appwrite backend repo at one point.

Parameters accepted

Base URL: /console/deploy

  • repo: the GitHub repository URL to deploy
  • env: environment variable keys, comma separated, example, TEST1,TEST2. User will fill the values.
  • preset: if nothing provided, it will be Next.js, or else user can provide sveltekit, vue, react, astro, vite. Default settings will be automatically applied
  • install: custom installation command, in case repository has custom needs
  • build: custom build command
  • output: custom output directory
  • screenshot: screenshot URL for repo mode

Screenshots

When the link is visited:

image

Regular deployment flow

image

Functions

Just added this features. Following is the base URL

https://[URL]/console/functions/deploy

Drawbacks

Same as sites, need to have a release tag for now

Following are URL search params

  • repo - GitHub repository URL
  • runtime - Runtime ID (e.g., node-18.0, python-3.11, php-8.3, etc.)
  • env - Comma-separated environment variable keys (e.g., API_KEY,DATABASE_URL)
  • name - Function name override
  • entrypoint - Entry file to execute (e.g., index.js, main.py, app.php)
  • install - Install/build command (e.g., npm install, pip install -r requirements.txt)
  • rootDir - Root directory path (default: ./)

Copy link

appwrite bot commented Aug 14, 2025

Console

Project ID: 688b7bf400350cbd60e9

Sites (2)
Site Status Logs Preview QR
 console-qa
688b7cf6003b1842c9dc
Failed Failed Authorize Preview URL QR Code
 console-cloud
688b7c18002b9b871a8f
Failed Failed Authorize Preview URL QR Code

Note

Appwrite has a Discord community with over 16 000 members.

Comment on lines 4 to 5
import { page } from '$app/state';
import { page as pageStore } from '$app/stores';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should only use one and the one from the /state. /stores one is deprecated.

Comment on lines 44 to 45
const urlParams = new URLSearchParams($pageStore.url.search);
const preset = urlParams.get('preset') || 'nextjs';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can directly use page.url.searchParams.

Comment on lines 48 to 57
const presetMap = {
nextjs: Framework.Nextjs,
react: Framework.React,
vue: Framework.Vue,
nuxt: Framework.Nuxt,
sveltekit: Framework.Sveltekit,
astro: Framework.Astro,
vite: Framework.Vite,
other: Framework.Other
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use Object.values(Framework) instead of this manual build up.

Comment on lines 69 to 71
if (data.envKeys.length > 0) {
variables = data.envKeys.map((key) => ({ key, value: '', secret: false }));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets move all the init like logic in onMount.

Comment on lines 74 to 83
const frameworkOptions = [
{ key: Framework.Nextjs, name: 'Next.js', buildRuntime: BuildRuntime.Node210 },
{ key: Framework.React, name: 'React', buildRuntime: BuildRuntime.Node210 },
{ key: Framework.Vue, name: 'Vue', buildRuntime: BuildRuntime.Node210 },
{ key: Framework.Nuxt, name: 'Nuxt', buildRuntime: BuildRuntime.Node210 },
{ key: Framework.Sveltekit, name: 'SvelteKit', buildRuntime: BuildRuntime.Node210 },
{ key: Framework.Astro, name: 'Astro', buildRuntime: BuildRuntime.Node210 },
{ key: Framework.Vite, name: 'Vite', buildRuntime: BuildRuntime.Node210 },
{ key: Framework.Other, name: 'Other', buildRuntime: BuildRuntime.Static1 }
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see if we can use the Object.values and cleanup a bit because all are Node210 except one and 2 name changes.

const promises = variables.map((variable) =>
sdk
.forProject(page.params.region, page.params.project)
.sites.createVariable(site.$id, variable.key, variable.value, variable.secret)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Meldiron we need a batch for this in the future.

Comment on lines 150 to 178
const tagsResponse = await fetch(
`https://api.github.com/repos/${data.repository.owner}/${data.repository.name}/tags`
);
if (tagsResponse.ok) {
const tags = await tagsResponse.json();
if (tags.length > 0) {
latestTag = tags[0].name;
} else {
addNotification({
type: 'error',
message:
'No tags found in repository. Please create a tag before deploying.'
});
return;
}
} else {
addNotification({
type: 'error',
message: 'Failed to fetch tags from GitHub.'
});
return;
}
} catch (error) {
addNotification({
type: 'error',
message: 'Failed to fetch tags from GitHub: ' + error.message
});
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets cleanup by putting the GitHub based tasks in a separate helper function. @Meldiron do we have VCS API method to fetch a specific repo? I don't exactly remember. @atharvadeosthale If we have an SDK, no need for helper and use that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the only way to get a repository which is not VCS linked is by using how templates do it, by passing release tags, this is a workaround until I can get appwrite running locally and can make changes to it

@coolify-appwrite-org
Copy link

coolify-appwrite-org bot commented Aug 22, 2025

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-08-22 21:25:41 CET

@coolify-appwrite-org
Copy link

coolify-appwrite-org bot commented Aug 22, 2025

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-08-22 21:25:42 CET

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants