diff --git a/app/config/collections.php b/app/config/collections.php
index c7bbe25670..e974283c63 100644
--- a/app/config/collections.php
+++ b/app/config/collections.php
@@ -3413,17 +3413,6 @@ $projectCollections = array_merge([
'default' => APP_FUNCTION_SPECIFICATION_DEFAULT,
'filters' => [],
],
- [
- '$id' => ID::custom('fallbackRedirect'),
- 'type' => Database::VAR_STRING,
- 'format' => '',
- 'size' => 2048,
- 'signed' => true,
- 'required' => false,
- 'default' => null,
- 'array' => false,
- 'filters' => [],
- ],
[
'$id' => ID::custom('serveRuntime'),
'type' => Database::VAR_STRING,
diff --git a/app/config/frameworks.php b/app/config/frameworks.php
index b4f3998851..4aeebd14e5 100644
--- a/app/config/frameworks.php
+++ b/app/config/frameworks.php
@@ -4,40 +4,9 @@
* List of Appwrite Sites supported frameworks
*/
-const TEMPLATE_RUNTIMES = [
- 'NODE' => [
- 'name' => 'node',
- 'versions' => ['22', '21.0', '20.0', '19.0', '18.0', '16.0', '14.5']
- ],
- 'PYTHON' => [
- 'name' => 'python',
- 'versions' => ['3.12', '3.11', '3.10', '3.9', '3.8']
- ],
- 'DART' => [
- 'name' => 'dart',
- 'versions' => ['3.5', '3.3', '3.1', '3.0', '2.19', '2.18', '2.17', '2.16', '2.16']
- ],
- 'GO' => [
- 'name' => 'go',
- 'versions' => ['1.23']
- ],
- 'PHP' => [
- 'name' => 'php',
- 'versions' => ['8.3', '8.2', '8.1', '8.0']
- ],
- 'DENO' => [
- 'name' => 'deno',
- 'versions' => ['2.0', '1.46', '1.40', '1.35', '1.24', '1.21']
- ],
- 'BUN' => [
- 'name' => 'bun',
- 'versions' => ['1.1', '1.0']
- ],
- 'RUBY' => [
- 'name' => 'ruby',
- 'versions' => ['3.3', '3.2', '3.1', '3.0']
- ],
-];
+use Utopia\Config\Config;
+
+$templateRuntimes = Config::getParam('template-runtimes');
function getVersions(array $versions, string $prefix)
{
@@ -52,18 +21,18 @@ return [
'name' => 'SvelteKit',
'logo' => 'sveltekit.png',
'defaultServeRuntime' => 'node-22',
- 'serveRuntimes' => getVersions(TEMPLATE_RUNTIMES['NODE']['versions'], 'node'),
+ 'serveRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'defaultBuildRuntime' => 'node-22',
- 'buildRuntimes' => getVersions(TEMPLATE_RUNTIMES['NODE']['versions'], 'node')
+ 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node')
],
'nextjs' => [
'key' => 'nextjs',
'name' => 'Next.js',
'logo' => 'nextjs.png',
'defaultServeRuntime' => 'node-22',
- 'serveRuntimes' => getVersions(TEMPLATE_RUNTIMES['NODE']['versions'], 'node'),
+ 'serveRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'),
'defaultBuildRuntime' => 'node-22',
- 'buildRuntimes' => getVersions(TEMPLATE_RUNTIMES['NODE']['versions'], 'node')
+ 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node')
],
'static' => [
'key' => 'static',
@@ -74,6 +43,6 @@ return [
'static-1'
],
'defaultBuildRuntime' => 'node-22',
- 'buildRuntimes' => getVersions(TEMPLATE_RUNTIMES['NODE']['versions'], 'node')
+ 'buildRuntimes' => getVersions($templateRuntimes['NODE']['versions'], 'node')
]
];
diff --git a/app/config/function-templates.php b/app/config/function-templates.php
index 762c33dd9a..4de21f20c9 100644
--- a/app/config/function-templates.php
+++ b/app/config/function-templates.php
@@ -1,39 +1,8 @@
[
- 'name' => 'node',
- 'versions' => ['22', '21.0', '20.0', '19.0', '18.0', '16.0', '14.5']
- ],
- 'PYTHON' => [
- 'name' => 'python',
- 'versions' => ['3.12', '3.11', '3.10', '3.9', '3.8']
- ],
- 'DART' => [
- 'name' => 'dart',
- 'versions' => ['3.5', '3.3', '3.1', '3.0', '2.19', '2.18', '2.17', '2.16', '2.16']
- ],
- 'GO' => [
- 'name' => 'go',
- 'versions' => ['1.23']
- ],
- 'PHP' => [
- 'name' => 'php',
- 'versions' => ['8.3', '8.2', '8.1', '8.0']
- ],
- 'DENO' => [
- 'name' => 'deno',
- 'versions' => ['2.0', '1.46', '1.40', '1.35', '1.24', '1.21']
- ],
- 'BUN' => [
- 'name' => 'bun',
- 'versions' => ['1.1', '1.0']
- ],
- 'RUBY' => [
- 'name' => 'ruby',
- 'versions' => ['3.3', '3.2', '3.1', '3.0']
- ],
-];
+use Utopia\Config\Config;
+
+$templateRuntimes = Config::getParam('template-runtimes');
function getRuntimes($runtime, $commands, $entrypoint, $providerRootDirectory, $versionsDenyList = [])
{
@@ -62,24 +31,24 @@ return [
'timeout' => 15,
'useCases' => ['starter'],
'runtimes' => [
- ...getRuntimes(TEMPLATE_RUNTIMES['NODE'], 'npm install', 'src/main.js', 'node/starter'),
+ ...getRuntimes($templateRuntimes['NODE'], 'npm install', 'src/main.js', 'node/starter'),
...getRuntimes(
- TEMPLATE_RUNTIMES['PYTHON'],
+ $templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/starter'
),
- ...getRuntimes(TEMPLATE_RUNTIMES['DART'], 'dart pub get', 'lib/main.dart', 'dart/starter'),
- ...getRuntimes(TEMPLATE_RUNTIMES['GO'], '', 'main.go', 'go/starter'),
+ ...getRuntimes($templateRuntimes['DART'], 'dart pub get', 'lib/main.dart', 'dart/starter'),
+ ...getRuntimes($templateRuntimes['GO'], '', 'main.go', 'go/starter'),
...getRuntimes(
- TEMPLATE_RUNTIMES['PHP'],
+ $templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/starter'
),
- ...getRuntimes(TEMPLATE_RUNTIMES['DENO'], 'deno cache src/main.ts', 'src/main.ts', 'deno/starter'),
- ...getRuntimes(TEMPLATE_RUNTIMES['BUN'], 'bun install', 'src/main.ts', 'bun/starter'),
- ...getRuntimes(TEMPLATE_RUNTIMES['RUBY'], 'bundle install', 'lib/main.rb', 'ruby/starter'),
+ ...getRuntimes($templateRuntimes['DENO'], 'deno cache src/main.ts', 'src/main.ts', 'deno/starter'),
+ ...getRuntimes($templateRuntimes['BUN'], 'bun install', 'src/main.ts', 'bun/starter'),
+ ...getRuntimes($templateRuntimes['RUBY'], 'bundle install', 'lib/main.rb', 'ruby/starter'),
],
'instructions' => 'For documentation and instructions check out file.',
'vcsProvider' => 'github',
@@ -101,7 +70,7 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/query-upstash-vector'
@@ -145,7 +114,7 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/query-redis-labs'
@@ -188,7 +157,7 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/query-neo4j-auradb'
@@ -240,7 +209,7 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/query-mongo-atlas'
@@ -277,7 +246,7 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/query-neon-postgres'
@@ -344,25 +313,25 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/prompt-chatgpt'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PYTHON'],
+ $templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/prompt_chatgpt'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PHP'],
+ $templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/prompt-chatgpt'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['DART'],
+ $templateRuntimes['DART'],
'dart pub get',
'lib/main.dart',
'dart/prompt_chatgpt'
@@ -405,19 +374,19 @@ return [
'useCases' => ['messaging'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/discord-command-bot'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PYTHON'],
+ $templateRuntimes['PYTHON'],
'pip install -r requirements.txt && python src/setup.py',
'src/main.py',
'python/discord_command_bot'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['GO'],
+ $templateRuntimes['GO'],
'',
'main.go',
'go/discord-command-bot'
@@ -468,7 +437,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/analyze-with-perspectiveapi'
@@ -504,19 +473,19 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/censor-with-redact'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PYTHON'],
+ $templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/censor_with_redact'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['DART'],
+ $templateRuntimes['DART'],
'dart pub get',
'lib/main.dart',
'dart/censor_with_redact'
@@ -550,7 +519,7 @@ return [
'timeout' => 15,
'useCases' => ['utilities'],
'runtimes' => [
- ...getRuntimes(TEMPLATE_RUNTIMES['NODE'], 'npm install', 'src/main.js', 'node/generate-pdf')
+ ...getRuntimes($templateRuntimes['NODE'], 'npm install', 'src/main.js', 'node/generate-pdf')
],
'instructions' => 'For documentation and instructions check out file.',
'vcsProvider' => 'github',
@@ -573,7 +542,7 @@ return [
'useCases' => ['dev-tools'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/github-issue-bot'
@@ -616,7 +585,7 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/url-shortener'
@@ -667,19 +636,19 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/sync-with-algolia'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PYTHON'],
+ $templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/sync_with_algolia'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PHP'],
+ $templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/sync-with-algolia'
@@ -748,31 +717,31 @@ return [
'useCases' => ['databases'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/sync-with-meilisearch'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PYTHON'],
+ $templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/sync-with-meilisearch'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PHP'],
+ $templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/sync-with-meilisearch'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['BUN'],
+ $templateRuntimes['BUN'],
'bun install',
'src/main.ts',
'bun/sync-with-meilisearch'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['RUBY'],
+ $templateRuntimes['RUBY'],
'bundle install',
'lib/main.rb',
'ruby/sync-with-meilisearch'
@@ -841,37 +810,37 @@ return [
'useCases' => ['messaging'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/whatsapp-with-vonage'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PYTHON'],
+ $templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/whatsapp_with_vonage'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['DART'],
+ $templateRuntimes['DART'],
'dart pub get',
'lib/main.dart',
'dart/whatsapp-with-vonage'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PHP'],
+ $templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/whatsapp-with-vonage'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['BUN'],
+ $templateRuntimes['BUN'],
'bun install',
'src/main.ts',
'bun/whatsapp-with-vonage'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['RUBY'],
+ $templateRuntimes['RUBY'],
'bundle install',
'lib/main.rb',
'ruby/whatsapp-with-vonage'
@@ -927,7 +896,7 @@ return [
'useCases' => ['messaging'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/push-notification-with-fcm'
@@ -983,19 +952,19 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/email-contact-form'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PYTHON'],
+ $templateRuntimes['PYTHON'],
'pip install -r requirements.txt',
'src/main.py',
'python/email_contact_form'
),
...getRuntimes(
- TEMPLATE_RUNTIMES['PHP'],
+ $templateRuntimes['PHP'],
'composer install',
'src/index.php',
'php/email-contact-form'
@@ -1066,7 +1035,7 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/subscriptions-with-stripe'
@@ -1107,7 +1076,7 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/payments-with-stripe'
@@ -1164,7 +1133,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/text-generation-with-huggingface'
@@ -1198,7 +1167,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/language-translation-with-huggingface'
@@ -1232,7 +1201,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/image-classification-with-huggingface'
@@ -1290,7 +1259,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/object-detection-with-huggingface'
@@ -1348,7 +1317,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/speech-recognition-with-huggingface'
@@ -1406,7 +1375,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/text-to-speech-with-huggingface'
@@ -1464,7 +1433,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/generate-with-replicate'
@@ -1499,7 +1468,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/generate-with-together-ai'
@@ -1541,7 +1510,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/chat-with-perplexity-ai'
@@ -1581,7 +1550,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/generate-with-replicate'
@@ -1616,7 +1585,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/sync-with-pinecone'
@@ -1679,7 +1648,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/rag-with-langchain'
@@ -1742,7 +1711,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/speak-with-elevenlabs'
@@ -1797,7 +1766,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/speak-with-lmnt'
@@ -1838,7 +1807,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/chat-with-anyscale'
@@ -1879,7 +1848,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install && npm run setup',
'src/main.js',
'node/music-generation-with-huggingface'
@@ -1921,7 +1890,7 @@ return [
'useCases' => ['ai'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/generate-with-fal-ai'
@@ -1956,7 +1925,7 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/subscriptions-with-lemon-squeezy'
@@ -2011,7 +1980,7 @@ return [
'useCases' => ['utilities'],
'runtimes' => [
...getRuntimes(
- TEMPLATE_RUNTIMES['NODE'],
+ $templateRuntimes['NODE'],
'npm install',
'src/main.js',
'node/payments-with-lemon-squeezy'
diff --git a/app/config/site-templates.php b/app/config/site-templates.php
index f1454433af..1d9821bb46 100644
--- a/app/config/site-templates.php
+++ b/app/config/site-templates.php
@@ -2,60 +2,37 @@
const TEMPLATE_FRAMEWORKS = [
'SVELTEKIT' => [
- 'name' => 'sveltekit'
- ],
- 'NEXTJS' => [
- 'name' => 'nextjs'
+ 'name' => 'Svelte Kit',
+ 'installCommand' => 'npm install',
+ 'buildCommand' => 'npm run build',
+ 'outputDirectory' => './build',
+ 'serveRuntime' => 'node-22',
+ 'buildRuntime' => 'node-22',
],
];
-function getFramework($framework, $installCommand, $buildCommand, $outputDirectory, $fallbackRedirect, $providerRootDirectory)
+function getFramework(string $frameworkEnum, array $overrides)
{
- return [
- 'name' => $framework['name'],
- 'installCommand' => $installCommand,
- 'buildCommand' => $buildCommand,
- 'outputDirectory' => $outputDirectory,
- 'fallbackRedirect' => $fallbackRedirect,
- 'providerRootDirectory' => $providerRootDirectory
- ];
+ $settings = \array_merge(TEMPLATE_FRAMEWORKS[$frameworkEnum], $overrides);
+ return $settings;
}
return [
[
- 'icon' => 'icon-lightning-bolt',
'id' => 'starter',
- 'name' => 'Starter site',
- 'tagline' =>
- 'A simple site to get started. Edit this site to explore endless possibilities with Appwrite Sites.',
+ 'name' => 'Personal portfolio',
'useCases' => ['starter'],
'frameworks' => [
- ...getFramework(TEMPLATE_FRAMEWORKS['SVELTEKIT'], 'npm install', 'npm run build', 'build', 'index.html', 'node/starter')
+ ...getFramework('SVELTEKIT', [
+ 'serveRuntime' => 'static-1',
+ 'installCommand' => 'npm install --force',
+ 'providerRootDirectory' => './'
+ ])
],
- 'instructions' => 'For documentation and instructions check out file.',
'vcsProvider' => 'github',
- 'providerRepositoryId' => 'templates',
- 'providerOwner' => 'appwrite',
- 'providerVersion' => '0.2.*',
+ 'providerRepositoryId' => 'portfolio-walter-o-brien',
+ 'providerOwner' => 'adityaoberai',
+ 'providerVersion' => '0.1.*',
'variables' => [],
- 'scopes' => ['users.read']
],
- [
- 'icon' => 'icon-lightning-bolt',
- 'id' => 'starter1',
- 'name' => 'Starter1 site',
- 'tagline' =>
- 'A simple site to get started. Edit this site to explore endless possibilities with Appwrite Sites.',
- 'useCases' => ['messaging'],
- 'frameworks' => [
- ...getFramework(TEMPLATE_FRAMEWORKS['SVELTEKIT'], 'npm install', 'npm run build', 'build', 'index.html', 'node/starter1')
- ],
- 'instructions' => 'For documentation and instructions check out file.',
- 'vcsProvider' => 'github',
- 'providerRepositoryId' => 'templates',
- 'providerOwner' => 'appwrite',
- 'providerVersion' => '0.2.*',
- 'variables' => [],
- 'scopes' => ['users.read']
- ]
];
diff --git a/app/config/template-runtimes.php b/app/config/template-runtimes.php
new file mode 100644
index 0000000000..2ba7bd390c
--- /dev/null
+++ b/app/config/template-runtimes.php
@@ -0,0 +1,36 @@
+ [
+ 'name' => 'node',
+ 'versions' => ['22', '21.0', '20.0', '19.0', '18.0', '16.0', '14.5']
+ ],
+ 'PYTHON' => [
+ 'name' => 'python',
+ 'versions' => ['3.12', '3.11', '3.10', '3.9', '3.8']
+ ],
+ 'DART' => [
+ 'name' => 'dart',
+ 'versions' => ['3.5', '3.3', '3.1', '3.0', '2.19', '2.18', '2.17', '2.16', '2.16']
+ ],
+ 'GO' => [
+ 'name' => 'go',
+ 'versions' => ['1.23']
+ ],
+ 'PHP' => [
+ 'name' => 'php',
+ 'versions' => ['8.3', '8.2', '8.1', '8.0']
+ ],
+ 'DENO' => [
+ 'name' => 'deno',
+ 'versions' => ['2.0', '1.46', '1.40', '1.35', '1.24', '1.21']
+ ],
+ 'BUN' => [
+ 'name' => 'bun',
+ 'versions' => ['1.1', '1.0']
+ ],
+ 'RUBY' => [
+ 'name' => 'ruby',
+ 'versions' => ['3.3', '3.2', '3.1', '3.0']
+ ],
+];
diff --git a/app/init.php b/app/init.php
index ea9dc5a05e..73a84c3558 100644
--- a/app/init.php
+++ b/app/init.php
@@ -318,6 +318,7 @@ if (!App::isProduction()) {
/*
* ENV vars
*/
+Config::load('template-runtimes', __DIR__ . '/config/template-runtimes.php');
Config::load('events', __DIR__ . '/config/events.php');
Config::load('auth', __DIR__ . '/config/auth.php');
Config::load('apis', __DIR__ . '/config/apis.php'); // List of APIs
diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php
index 3288748f5f..4b9c94d436 100644
--- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php
+++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/CreateSite.php
@@ -65,8 +65,9 @@ class CreateSite extends Base
->param('installCommand', '', new Text(8192, 0), 'Install Command.', true)
->param('buildCommand', '', new Text(8192, 0), 'Build Command.', true)
->param('outputDirectory', '', new Text(8192, 0), 'Output Directory for site.', true)
- ->param('fallbackRedirect', '', new Text(8192, 0), 'Fallback Redirect URL for site in case a route is not found.', true)
->param('subdomain', '', new CustomId(), 'Unique custom sub-domain. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.', true)
+ ->param('buildRuntime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Runtime to use during build step.', true)
+ ->param('serveRuntime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Runtime to use when serving site.', true)
->param('installationId', '', new Text(128, 0), 'Appwrite Installation ID for VCS (Version Control System) deployment.', true)
->param('providerRepositoryId', '', new Text(128, 0), 'Repository ID of the repo linked to the site.', true)
->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the site.', true)
@@ -94,7 +95,7 @@ class CreateSite extends Base
->callback([$this, 'action']);
}
- public function action(string $siteId, string $name, string $framework, bool $enabled, int $timeout, string $installCommand, string $buildCommand, string $outputDirectory, string $fallbackRedirect, string $subdomain, string $installationId, string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $templateRepository, string $templateOwner, string $templateRootDirectory, string $templateVersion, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github)
+ public function action(string $siteId, string $name, string $framework, bool $enabled, int $timeout, string $installCommand, string $buildCommand, string $outputDirectory, string $subdomain, string $buildRuntime, string $serveRuntime, string $installationId, string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $templateRepository, string $templateOwner, string $templateRootDirectory, string $templateVersion, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Document $user, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github)
{
$sitesDomain = System::getEnv('_APP_DOMAIN_SITES', '');
$ruleId = '';
@@ -159,7 +160,6 @@ class CreateSite extends Base
'installCommand' => $installCommand,
'buildCommand' => $buildCommand,
'outputDirectory' => $outputDirectory,
- 'fallbackRedirect' => $fallbackRedirect,
'search' => implode(' ', [$siteId, $name, $framework]),
'installationId' => $installation->getId(),
'installationInternalId' => $installation->getInternalId(),
@@ -170,8 +170,8 @@ class CreateSite extends Base
'providerRootDirectory' => $providerRootDirectory,
'providerSilentMode' => $providerSilentMode,
'specification' => $specification,
- 'buildRuntime' => Config::getParam('frameworks', [])[$framework]['defaultBuildRuntime'],
- 'serveRuntime' => Config::getParam('frameworks', [])[$framework]['defaultServeRuntime'],
+ 'buildRuntime' => $buildRuntime,
+ 'serveRuntime' => $serveRuntime,
]));
// Git connect logic
diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/UpdateSite.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/UpdateSite.php
index 5dc0ecaf28..558f9f34c9 100644
--- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/UpdateSite.php
+++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/UpdateSite.php
@@ -62,7 +62,6 @@ class UpdateSite extends Base
->param('installCommand', '', new Text(8192, 0), 'Install Command.', true)
->param('buildCommand', '', new Text(8192, 0), 'Build Command.', true)
->param('outputDirectory', '', new Text(8192, 0), 'Output Directory for site.', true)
- ->param('fallbackRedirect', '', new Text(8192, 0), 'Fallback Redirect URL for site in case a route is not found.', true)
->param('installationId', '', new Text(128, 0), 'Appwrite Installation ID for VCS (Version Control System) deployment.', true)
->param('providerRepositoryId', '', new Text(128, 0), 'Repository ID of the repo linked to the site.', true)
->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the site.', true)
@@ -85,7 +84,7 @@ class UpdateSite extends Base
->callback([$this, 'action']);
}
- public function action(string $siteId, string $name, string $framework, bool $enabled, int $timeout, string $installCommand, string $buildCommand, string $outputDirectory, string $fallbackRedirect, string $installationId, ?string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github)
+ public function action(string $siteId, string $name, string $framework, bool $enabled, int $timeout, string $installCommand, string $buildCommand, string $outputDirectory, string $installationId, ?string $providerRepositoryId, string $providerBranch, bool $providerSilentMode, string $providerRootDirectory, string $specification, Request $request, Response $response, Database $dbForProject, Document $project, Event $queueForEvents, Build $queueForBuilds, Database $dbForConsole, GitHub $github)
{
// TODO: If only branch changes, re-deploy
$site = $dbForProject->getDocument('sites', $siteId);
@@ -176,7 +175,6 @@ class UpdateSite extends Base
$site->getAttribute('buildCommand') !== $buildCommand ||
$site->getAttribute('installCommand') !== $installCommand ||
$site->getAttribute('outputDirectory') !== $outputDirectory ||
- $site->getAttribute('fallbackRedirect') !== $fallbackRedirect ||
$site->getAttribute('providerRootDirectory') !== $providerRootDirectory ||
$site->getAttribute('framework') !== $framework
) {
@@ -207,7 +205,6 @@ class UpdateSite extends Base
'installCommand' => $installCommand,
'buildCommand' => $buildCommand,
'outputDirectory' => $outputDirectory,
- 'fallbackRedirect' => $fallbackRedirect,
'installationId' => $installation->getId(),
'installationInternalId' => $installation->getInternalId(),
'providerRepositoryId' => $providerRepositoryId,
diff --git a/src/Appwrite/Utopia/Response/Model/Site.php b/src/Appwrite/Utopia/Response/Model/Site.php
index 1a53c794ab..64d2a12a22 100644
--- a/src/Appwrite/Utopia/Response/Model/Site.php
+++ b/src/Appwrite/Utopia/Response/Model/Site.php
@@ -89,12 +89,6 @@ class Site extends Model
'default' => '',
'example' => 'build',
])
- ->addRule('fallbackRedirect', [
- 'type' => self::TYPE_STRING,
- 'description' => 'The URL to redirect to if the route is not found.', //TODO: Update the description
- 'default' => '',
- 'example' => 'https://appwrite.io',
- ])
->addRule('installationId', [
'type' => self::TYPE_STRING,
'description' => 'Site VCS (Version Control System) installation id.',
diff --git a/src/Appwrite/Utopia/Response/Model/TemplateFramework.php b/src/Appwrite/Utopia/Response/Model/TemplateFramework.php
index 8acfcf0017..0b9e81df35 100644
--- a/src/Appwrite/Utopia/Response/Model/TemplateFramework.php
+++ b/src/Appwrite/Utopia/Response/Model/TemplateFramework.php
@@ -32,20 +32,27 @@ class TemplateFramework extends Model
'type' => self::TYPE_STRING,
'description' => 'The output directory to store the build output.',
'default' => '',
- 'example' => 'build',
- ])
- ->addRule('fallbackRedirect', [
- 'type' => self::TYPE_STRING,
- 'description' => 'The fallback redirect for the site when a route is not found.',
- 'default' => '',
- 'example' => 'index.html',
+ 'example' => './build',
])
->addRule('providerRootDirectory', [
'type' => self::TYPE_STRING,
'description' => 'Path to site in VCS (Version Control System) repository',
'default' => '',
- 'example' => 'node/starter',
- ]);
+ 'example' => './svelte-kit/starter',
+ ])
+ ->addRule('serveRuntime', [
+ 'type' => self::TYPE_STRING,
+ 'description' => 'Runtime used during serve of template deployment.',
+ 'default' => '',
+ 'example' => 'static-1',
+ ])
+ ->addRule('buildRuntime', [
+ 'type' => self::TYPE_STRING,
+ 'description' => 'Runtime used during build step of template.',
+ 'default' => '',
+ 'example' => 'node-22',
+ ])
+ ;
}
/**
diff --git a/src/Appwrite/Utopia/Response/Model/TemplateSite.php b/src/Appwrite/Utopia/Response/Model/TemplateSite.php
index 7eeff22076..8129e2ca67 100644
--- a/src/Appwrite/Utopia/Response/Model/TemplateSite.php
+++ b/src/Appwrite/Utopia/Response/Model/TemplateSite.php
@@ -10,12 +10,6 @@ class TemplateSite extends Model
public function __construct()
{
$this
- ->addRule('icon', [
- 'type' => self::TYPE_STRING,
- 'description' => 'Site Template Icon.',
- 'default' => '',
- 'example' => 'icon-lightning-bolt',
- ])
->addRule('id', [
'type' => self::TYPE_STRING,
'description' => 'Site Template ID.',
@@ -28,12 +22,6 @@ class TemplateSite extends Model
'default' => '',
'example' => 'Starter site',
])
- ->addRule('tagline', [
- 'type' => self::TYPE_STRING,
- 'description' => 'Site Template Tagline.',
- 'default' => '',
- 'example' => 'A simple site to get started.',
- ])
->addRule('useCases', [
'type' => self::TYPE_STRING,
'description' => 'Site use cases.',
@@ -48,12 +36,6 @@ class TemplateSite extends Model
'example' => [],
'array' => true
])
- ->addRule('instructions', [
- 'type' => self::TYPE_STRING,
- 'description' => 'Site Template Instructions.',
- 'default' => '',
- 'example' => 'For documentation and instructions check out .',
- ])
->addRule('vcsProvider', [
'type' => self::TYPE_STRING,
'description' => 'VCS (Version Control System) Provider.',
@@ -85,13 +67,7 @@ class TemplateSite extends Model
'example' => [],
'array' => true
])
- ->addRule('scopes', [
- 'type' => self::TYPE_STRING,
- 'description' => 'Site scopes.',
- 'default' => [],
- 'example' => 'users.read',
- 'array' => true,
- ]);
+ ;
}
/**