diff --git a/benchmark/package-lock.json b/benchmark/package-lock.json new file mode 100644 index 0000000..44f718b --- /dev/null +++ b/benchmark/package-lock.json @@ -0,0 +1,85 @@ +{ + "name": "appwrite-arena-benchmark", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "appwrite-arena-benchmark", + "dependencies": { + "@openrouter/sdk": "^0.9.11" + }, + "devDependencies": { + "@types/bun": "latest", + "typescript": "^5.7.2" + } + }, + "node_modules/@openrouter/sdk": { + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/@openrouter/sdk/-/sdk-0.9.11.tgz", + "integrity": "sha512-BgFu6NcIJO4a9aVjr04y3kZ8pyM71j15I+bzfVAGEvxnj+KQNIkBYQGgwrG3D+aT1QpDKLki8btcQmpaxUas6A==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "zod": "^3.25.0 || ^4.0.0" + } + }, + "node_modules/@types/bun": { + "version": "1.3.10", + "resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.3.10.tgz", + "integrity": "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bun-types": "1.3.10" + } + }, + "node_modules/@types/node": { + "version": "25.3.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.3.3.tgz", + "integrity": "sha512-DpzbrH7wIcBaJibpKo9nnSQL0MTRdnWttGyE5haGwK86xgMOkFLp7vEyfQPGLOJh5wNYiJ3V9PmUMDhV9u8kkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.18.0" + } + }, + "node_modules/bun-types": { + "version": "1.3.10", + "resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.3.10.tgz", + "integrity": "sha512-tcpfCCl6XWo6nCVnpcVrxQ+9AYN1iqMIzgrSKYMB/fjLtV2eyAVEg7AxQJuCq/26R6HpKWykQXuSOq/21RYcbg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "7.18.2", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz", + "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/zod": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", + "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/benchmark/package.json b/benchmark/package.json index 016b1fd..be7585e 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -15,5 +15,8 @@ "devDependencies": { "@types/bun": "latest", "typescript": "^5.7.2" + }, + "dependencies": { + "@openrouter/sdk": "^0.9.11" } } diff --git a/benchmark/src/config.ts b/benchmark/src/config.ts index f8a91c7..42d19fe 100644 --- a/benchmark/src/config.ts +++ b/benchmark/src/config.ts @@ -10,6 +10,7 @@ export const MODELS: ModelConfig[] = [ name: "Gemini 3.1 Pro (Preview)", provider: "Google", openRouterId: "google/gemini-3.1-pro-preview", + openRouterProviderOrder: ["google-ai-studio"], }, { id: "gpt-5-3-codex", diff --git a/benchmark/src/index.ts b/benchmark/src/index.ts index c98ae8b..23a1434 100644 --- a/benchmark/src/index.ts +++ b/benchmark/src/index.ts @@ -147,6 +147,29 @@ interface ModelProgress { results: QuestionResult[]; } +function sanitizeResults(models: Record): boolean { + let fixed = false; + for (const [modelId, model] of Object.entries(models)) { + const seen = new Map(); + const duplicates: string[] = []; + for (let i = 0; i < model.results.length; i++) { + const qid = model.results[i].questionId; + if (seen.has(qid)) { + duplicates.push(qid); + } + seen.set(qid, i); + } + if (duplicates.length > 0) { + // Keep last occurrence of each questionId + const keepIndices = new Set(seen.values()); + model.results = model.results.filter((_, i) => keepIndices.has(i)); + console.log(` Sanitize: removed ${duplicates.length} duplicate(s) from ${modelId}: ${[...new Set(duplicates)].join(", ")}`); + fixed = true; + } + } + return fixed; +} + function getResultsPath(mode: string): string { return resolve(import.meta.dir, `../../src/data/results-${mode}.json`); } @@ -172,6 +195,7 @@ function loadExistingResults(mode: string): Record { correct: d.correct, score: d.score, judgeReasoning: d.judgeReasoning, + ...(d.modComment ? { modComment: d.modComment } : {}), })), }; } @@ -214,6 +238,7 @@ function saveResults( correct: r.correct, score: r.score, judgeReasoning: r.judgeReasoning, + ...(r.modComment ? { modComment: r.modComment } : {}), }; }); @@ -273,6 +298,11 @@ async function main() { ); } + if (sanitizeResults(models)) { + saveResults(models, mode); + console.log(`Sanitized results saved.`); + } + let skillsMap: Map | undefined; let tools: Tool[] | undefined; if (mode === "with-skills") { diff --git a/benchmark/src/judge.ts b/benchmark/src/judge.ts index bb3f5bd..51beaef 100644 --- a/benchmark/src/judge.ts +++ b/benchmark/src/judge.ts @@ -1,8 +1,11 @@ -import { JUDGE_MODEL, OPENROUTER_API_URL, TEMPERATURE } from "./config"; +import { OpenRouter } from "@openrouter/sdk"; +import { JUDGE_MODEL, TEMPERATURE } from "./config"; import type { Question } from "./types"; const apiKey = process.env.OPENROUTER_API_KEY; +const openrouter = new OpenRouter({ apiKey }); + interface JudgeResult { score: number; reasoning: string; @@ -28,31 +31,17 @@ Score the model's answer from 0.0 to 1.0 where: Respond in this exact JSON format: {"score": , "reasoning": ""}`; - const response = await fetch(OPENROUTER_API_URL, { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${apiKey}`, - }, - body: JSON.stringify({ + const data = await openrouter.chat.send({ + chatGenerationParams: { model: JUDGE_MODEL, temperature: TEMPERATURE, messages: [ { role: "system", content: systemPrompt }, { role: "user", content: modelAnswer }, ], - }), + }, }); - - if (!response.ok) { - const text = await response.text(); - throw new Error(`Judge API error (${response.status}): ${text}`); - } - - const data = (await response.json()) as { - choices: Array<{ message: { content: string } }>; - }; - const content = data.choices[0]?.message?.content ?? ""; + const content = (data as { choices: Array<{ message: { content: string } }> }).choices[0]?.message?.content ?? ""; try { const jsonMatch = content.match(/\{[\s\S]*\}/); diff --git a/benchmark/src/questions/cli.ts b/benchmark/src/questions/cli.ts index ed60cca..f9be0e3 100644 --- a/benchmark/src/questions/cli.ts +++ b/benchmark/src/questions/cli.ts @@ -51,7 +51,7 @@ export const cliQuestions: Question[] = [ "appwrite.config.js", ".appwriterc", "appwrite.yaml", - "appwrite.json", + "appwrite.config.json", ], correctAnswer: "D", }, @@ -120,17 +120,17 @@ export const cliQuestions: Question[] = [ category: "cli", type: "free-form", question: - "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.json.", + "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.config.json.", correctAnswer: - "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", + "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.config.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", rubric: - "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", + "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.config.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", }, { id: "cli-11", category: "cli", type: "mcq", - question: "What command initializes the CLI with your Appwrite project and creates appwrite.json?", + question: "What command initializes the CLI with your Appwrite project and creates appwrite.config.json?", choices: [ "appwrite init project", "appwrite setup", @@ -169,7 +169,7 @@ export const cliQuestions: Question[] = [ id: "cli-14", category: "cli", type: "mcq", - question: "What does the appwrite.json file represent?", + question: "What does the appwrite.config.json file represent?", choices: [ "Only function configurations", "User credentials only", @@ -225,7 +225,7 @@ export const cliQuestions: Question[] = [ choices: [ "Pushes code to a Git repository", "Uploads environment variables only", - "Deploys tracked resources (e.g. functions, collections) from appwrite.json to your Appwrite project", + "Deploys tracked resources (e.g. functions, collections) from appwrite.config.json to your Appwrite project", "Syncs local config with the server and overwrites server state", ], correctAnswer: "C", @@ -254,4 +254,116 @@ export const cliQuestions: Question[] = [ rubric: "Must mention: 1) data as JSON string with double quotes, 2) permissions as array (space-separated in CLI), 3) Example or correct syntax for databases create-document", }, + { + id: "cli-21", + category: "cli", + type: "mcq", + question: + "What happens if an Appwrite project contains an appwrite.json file but no appwrite.config.json?", + choices: [ + "The CLI throws an error and requires appwrite.config.json", + "The CLI falls back to appwrite.json for legacy backwards compatibility", + "The CLI ignores it and uses default settings", + "The CLI automatically migrates appwrite.json to appwrite.config.json", + ], + correctAnswer: "B", + }, + { + id: "cli-22", + category: "cli", + type: "mcq", + question: + "What does the appwrite types command do?", + choices: [ + "Generates typed models for your Appwrite project's collections and attributes", + "Lists all data types supported by Appwrite databases", + "Converts documents between different data formats", + "Validates the types defined in appwrite.config.json", + ], + correctAnswer: "A", + }, + { + id: "cli-23", + category: "cli", + type: "mcq", + question: + "What does the --strict flag do in the appwrite types command?", + choices: [ + "Enforces type-safe null checks in generated code", + "Throws errors for missing or invalid collection attributes", + "Automatically converts field names to follow language conventions", + "Disables generation of optional fields", + ], + correctAnswer: "C", + }, + { + id: "cli-24", + category: "cli", + type: "mcq", + question: + "A function works locally but fails after pushing because environment variables are missing. What flag was likely missing from the push command?", + choices: [ + "--env", + "--with-variables", + "--include-env", + "--push-variables", + ], + correctAnswer: "B", + }, + { + id: "cli-25", + category: "cli", + type: "mcq", + question: + "When defining an attribute in appwrite.config.json, what happens if 'type' is 'string' or 'varchar' but 'size' is not defined?", + choices: [ + "The attribute is created with a default size of 255", + "The attribute is created as an unlimited text field", + "The CLI automatically calculates the size based on sample data", + "The CLI throws a validation error because 'size' is required for string/varchar types", + ], + correctAnswer: "D", + }, + { + id: "cli-26", + category: "cli", + type: "mcq", + question: + "In appwrite.config.json, when defining an attribute with 'required' set to true, what must the 'default' property be set to?", + choices: [ + "The default can be any value matching the type", + "The default must be set to an empty string or 0", + "The default must be null", + "The default property is optional and can be omitted", + ], + correctAnswer: "C", + }, + { + id: "cli-27", + category: "cli", + type: "mcq", + question: + "What does the 'appwrite generate' command do?", + choices: [ + "Generates a new Appwrite project from a template", + "Creates boilerplate code for functions and collections", + "Generates a type-safe SDK from your Appwrite project configuration", + "Generates API documentation for your project", + ], + correctAnswer: "C", + }, + { + id: "cli-28", + category: "cli", + type: "mcq", + question: + "What's the key difference between `appwrite run function` and `appwrite push function`?", + choices: [ + "`run` executes locally with Docker emulation, `push` deploys to Appwrite cloud", + "`run` deploys to staging, `push` deploys to production", + "`run` is for testing, `push` is for CI/CD pipelines only", + "`run` requires internet connection, `push` works offline", + ], + correctAnswer: "A", + }, ]; diff --git a/benchmark/src/questions/databases.ts b/benchmark/src/questions/databases.ts index 1dc7ad8..0e77638 100644 --- a/benchmark/src/questions/databases.ts +++ b/benchmark/src/questions/databases.ts @@ -260,4 +260,46 @@ export const databasesQuestions: Question[] = [ rubric: "Must include: 1) Query.greaterThan for the filter, 2) Query.orderDesc for sort, 3) Query.limit(20), 4) Passing queries to listDocuments()", }, + { + id: "db-21", + category: "databases", + type: "mcq", + question: + "What are the minimum and maximum values for an integer attribute in Appwrite?", + choices: [ + "-2147483648 to 2147483647 (32-bit signed integer)", + "-9223372036854775808 to 9223372036854775807 (64-bit signed integer)", + "0 to 18446744073709551615 (64-bit unsigned integer)", + "-999999999999 to 999999999999 (12-digit limit)", + ], + correctAnswer: "B", + }, + { + id: "db-22", + category: "databases", + type: "mcq", + question: + "Which of the following is NOT a valid string-based attribute type in Appwrite databases?", + choices: [ + "varchar", + "mediumtext", + "tinytext", + "longtext", + ], + correctAnswer: "C", + }, + { + id: "db-23", + category: "databases", + type: "mcq", + question: + "Which of the following is NOT a valid format for a string attribute in Appwrite?", + choices: [ + "uuid", + "email", + "url", + "enum", + ], + correctAnswer: "A", + }, ]; diff --git a/benchmark/src/runner.ts b/benchmark/src/runner.ts index 2a5c9f7..82d1b4c 100644 --- a/benchmark/src/runner.ts +++ b/benchmark/src/runner.ts @@ -1,4 +1,5 @@ -import { OPENROUTER_API_URL, TEMPERATURE } from "./config"; +import { OpenRouter } from "@openrouter/sdk"; +import { TEMPERATURE } from "./config"; import { judgeAnswer } from "./judge"; import type { ChatMessage, @@ -15,6 +16,8 @@ if (!apiKey) { throw new Error("OPENROUTER_API_KEY environment variable is required"); } +const openrouter = new OpenRouter({ apiKey }); + const MAX_TOOL_ROUNDS = 5; const MCQ_LETTER_MAP: Record = { @@ -46,7 +49,7 @@ interface ApiResponse { choices: Array<{ message: { content?: string | null; - tool_calls?: ToolCall[]; + toolCalls?: ToolCall[]; }; }>; } @@ -55,31 +58,97 @@ async function callModelRaw( model: ModelConfig, messages: ChatMessage[], tools?: Tool[], + debug?: boolean, ): Promise { - const body: Record = { + const chatGenerationParams: Record = { model: model.openRouterId, temperature: TEMPERATURE, messages, + stream: true, }; if (tools && tools.length > 0) { - body.tools = tools; + chatGenerationParams.tools = tools; + } + if (model.openRouterProviderOrder) { + chatGenerationParams.provider = { order: model.openRouterProviderOrder }; } - const response = await fetch(OPENROUTER_API_URL, { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${apiKey}`, - }, - body: JSON.stringify(body), - }); + const stream = await openrouter.chat.send({ chatGenerationParams } as Parameters[0]) as AsyncIterable<{ + choices: Array<{ + delta: { + role?: string; + content?: string | null; + reasoning?: string | null; + toolCalls?: Array<{ + index: number; + id?: string; + type?: string; + function?: { name?: string; arguments?: string }; + }>; + }; + finishReason?: string | null; + }>; + }>; + + let content = ""; + let reasoning = ""; + const toolCallMap = new Map(); + + for await (const chunk of stream) { + const delta = chunk.choices?.[0]?.delta; + if (!delta) continue; - if (!response.ok) { - const text = await response.text(); - throw new Error(`OpenRouter API error (${response.status}): ${text}`); + if (delta.content) { + content += delta.content; + if (debug) { + process.stdout.write(delta.content); + } + } + + if (delta.reasoning) { + reasoning += delta.reasoning; + if (debug) { + process.stdout.write(`\x1b[2m${delta.reasoning}\x1b[0m`); + } + } + + if (delta.toolCalls) { + for (const tc of delta.toolCalls) { + const existing = toolCallMap.get(tc.index); + if (existing) { + if (tc.function?.arguments) { + existing.function.arguments += tc.function.arguments; + } + } else { + toolCallMap.set(tc.index, { + id: tc.id ?? "", + type: "function", + function: { + name: tc.function?.name ?? "", + arguments: tc.function?.arguments ?? "", + }, + }); + } + } + } } - return (await response.json()) as ApiResponse; + if (debug && (content || reasoning)) { + process.stdout.write("\n"); + } + + const toolCalls = toolCallMap.size > 0 + ? Array.from(toolCallMap.entries()).sort((a, b) => a[0] - b[0]).map(([, v]) => v) + : undefined; + + return { + choices: [{ + message: { + content: content || null, + toolCalls, + }, + }], + }; } function resolveToolCall( @@ -122,7 +191,7 @@ function debugMessages(messages: ChatMessage[]): void { } else if (msg.role === "user") { debugLog("USER", msg.content ?? ""); } else if (msg.role === "tool") { - debugLog(`TOOL RESULT (call ${msg.tool_call_id})`, truncate(msg.content ?? "", 300)); + debugLog(`TOOL RESULT (call ${msg.toolCallId})`, truncate(msg.content ?? "", 300)); } } } @@ -154,22 +223,23 @@ async function callModel( } for (let round = 0; round < MAX_TOOL_ROUNDS; round++) { - const data = await callModelRaw(model, messages, tools); + const data = await callModelRaw(model, messages, tools, debug); const msg = data.choices[0]?.message; if (!msg) return ""; // If no tool calls, return the text content - if (!msg.tool_calls || msg.tool_calls.length === 0) { - if (debug) { + if (!msg.toolCalls || msg.toolCalls.length === 0) { + if (debug) { + console.log(msg); debugLog("RESPONSE ← (final text)", truncate(msg.content ?? "", 500)); } return msg.content ?? ""; } if (debug) { - debugLog(`RESPONSE ← (round ${round + 1}, ${msg.tool_calls.length} tool call(s))`, { + debugLog(`RESPONSE ← (round ${round + 1}, ${msg.toolCalls.length} tool call(s))`, { content: msg.content ? truncate(msg.content, 200) : null, - tool_calls: msg.tool_calls.map(tc => ({ + toolCalls: msg.toolCalls.map(tc => ({ id: tc.id, function: tc.function.name, arguments: tc.function.arguments, @@ -179,7 +249,7 @@ async function callModel( // Check if any tool call is an MCQ answer if (mcqToolNames) { - for (const toolCall of msg.tool_calls) { + for (const toolCall of msg.toolCalls) { const letter = MCQ_LETTER_MAP[toolCall.function.name]; if (letter) { if (debug) { @@ -195,22 +265,22 @@ async function callModel( return msg.content ?? ""; } - // Append assistant message with tool_calls + // Append assistant message with toolCalls messages.push({ role: "assistant", content: msg.content ?? undefined, - tool_calls: msg.tool_calls, + toolCalls: msg.toolCalls, }); // Resolve each tool call and append results - for (const toolCall of msg.tool_calls) { + for (const toolCall of msg.toolCalls) { const result = resolveToolCall(toolCall, skillsMap); if (debug) { debugLog(`TOOL RESOLVE: ${toolCall.function.name}(${toolCall.function.arguments})`, truncate(result, 300)); } messages.push({ role: "tool", - tool_call_id: toolCall.id, + toolCallId: toolCall.id, content: result, }); } @@ -221,7 +291,7 @@ async function callModel( } // Max rounds exceeded — make one final call without tools to force a text response - const finalData = await callModelRaw(model, messages); + const finalData = await callModelRaw(model, messages, undefined, debug); const finalContent = finalData.choices[0]?.message?.content ?? ""; if (debug) { debugLog("RESPONSE ← (forced final)", truncate(finalContent, 500)); diff --git a/benchmark/src/types.ts b/benchmark/src/types.ts index 1432566..e3ee0a6 100644 --- a/benchmark/src/types.ts +++ b/benchmark/src/types.ts @@ -16,6 +16,7 @@ export interface QuestionResult { correct: boolean; score: number; judgeReasoning?: string; + modComment?: string; } export interface QuestionDetail { @@ -30,6 +31,7 @@ export interface QuestionDetail { correct: boolean; score: number; judgeReasoning?: string; + modComment?: string; } export interface ModelConfig { @@ -37,6 +39,7 @@ export interface ModelConfig { name: string; provider: string; openRouterId: string; + openRouterProviderOrder?: string[]; } export interface SkillInfo { @@ -71,8 +74,8 @@ export interface ToolCall { export interface ChatMessage { role: "system" | "user" | "assistant" | "tool"; content?: string; - tool_calls?: ToolCall[]; - tool_call_id?: string; + toolCalls?: ToolCall[]; + toolCallId?: string; } export interface BenchmarkResults { diff --git a/src/components/QuestionCard.tsx b/src/components/QuestionCard.tsx index 5fe5e3c..6c7b7c3 100644 --- a/src/components/QuestionCard.tsx +++ b/src/components/QuestionCard.tsx @@ -12,6 +12,7 @@ export default function QuestionCard({ detail }: QuestionCardProps) { const [open, setOpen] = useState(false); const [renderContent, setRenderContent] = useState(false); const isMcq = detail.type === "mcq"; + const isFail = detail.modelAnswer === "FAIL"; const scorePercent = Math.round(detail.score * 100); const scoreClass = scorePercent >= 70 @@ -51,7 +52,9 @@ export default function QuestionCard({ detail }: QuestionCardProps) { className="flex w-full cursor-pointer items-center gap-3 border-none bg-transparent p-4 text-left transition hover:bg-[var(--link-bg-hover)] md:px-5 md:py-4" > - {isMcq ? ( + {isFail ? ( + + ) : isMcq ? ( detail.correct ? ( ) : ( @@ -84,6 +87,20 @@ export default function QuestionCard({ detail }: QuestionCardProps) { ) : ( )} + {isFail && ( +
+

+ Model failed to produce an answer. + {detail.modComment && ( + + {" "} + Moderator note:{" "} + {detail.modComment} + + )} +

+
+ )} )} @@ -104,7 +121,10 @@ function McqChoices({ detail }: { detail: QuestionDetail }) { const isWrongPick = isModelPick && !isCorrect; let cls = "border-transparent bg-transparent"; - if (isCorrect) cls = "border-[#85DBD8]/30 bg-[#85DBD8]/8"; + if (isCorrect && isModelPick) + cls = "border-[#85DBD8]/30 bg-[#85DBD8]/8"; + else if (isCorrect) + cls = "border-[var(--line)] bg-[rgba(255,255,255,0.03)]"; else if (isWrongPick) cls = "border-[#FF453A]/30 bg-[#FF453A]/8"; return ( @@ -119,7 +139,7 @@ function McqChoices({ detail }: { detail: QuestionDetail }) { {isCorrect && ( )} {isWrongPick && ( diff --git a/src/data/results-with-skills.json b/src/data/results-with-skills.json index 20791b3..ee44724 100644 --- a/src/data/results-with-skills.json +++ b/src/data/results-with-skills.json @@ -1,9 +1,9 @@ { "version": "1.0.0", - "runDate": "2026-03-04T12:04:51.665Z", + "runDate": "2026-03-05T15:00:53.740Z", "mode": "with-skills", - "totalQuestions": 180, - "totalMcq": 154, + "totalQuestions": 191, + "totalMcq": 165, "totalFreeform": 26, "models": [ { @@ -14,24 +14,24 @@ "scores": { "fundamental": 99.5, "auth": 98.5, - "databases": 82.3, + "databases": 80.2, "functions": 100, "storage": 94.5, "sites": 96, "messaging": 95, "realtime": 95.5, - "cli": 93 + "cli": 87.9 }, "mcqScores": { "fundamental": 100, "auth": 100, - "databases": 82.4, + "databases": 80, "functions": 100, "storage": 94.1, "sites": 100, "messaging": 94.1, "realtime": 100, - "cli": 94.1 + "cli": 88 }, "freeformScores": { "fundamental": 96.7, @@ -44,12 +44,12 @@ "realtime": 70, "cli": 86.7 }, - "overall": 94.9, - "mcqOverall": 96.1, + "overall": 93.6, + "mcqOverall": 94.5, "freeformOverall": 87.9, - "totalQuestions": 180, - "totalCorrect": 172, - "runDate": "2026-03-04T12:04:51.665Z", + "totalQuestions": 191, + "totalCorrect": 180, + "runDate": "2026-03-05T15:00:53.739Z", "questionDetails": [ { "questionId": "fund-1", @@ -1908,7 +1908,7 @@ "appwrite.config.js", ".appwriterc", "appwrite.yaml", - "appwrite.json" + "appwrite.config.json" ], "correctAnswer": "D", "modelAnswer": "D", @@ -1919,7 +1919,7 @@ "questionId": "cli-11", "category": "cli", "type": "mcq", - "question": "What command initializes the CLI with your Appwrite project and creates appwrite.json?", + "question": "What command initializes the CLI with your Appwrite project and creates appwrite.config.json?", "choices": [ "appwrite init project", "appwrite setup", @@ -1995,7 +1995,7 @@ "questionId": "cli-14", "category": "cli", "type": "mcq", - "question": "What does the appwrite.json file represent?", + "question": "What does the appwrite.config.json file represent?", "choices": [ "Only function configurations", "User credentials only", @@ -2071,9 +2071,9 @@ "questionId": "cli-10", "category": "cli", "type": "free-form", - "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.json.", - "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", - "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", + "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.config.json.", + "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.config.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", + "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.config.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", "modelAnswer": "Here is the complete workflow for creating, configuring, and deploying an Appwrite Function using the Appwrite CLI. \n\n*Note: Appwrite uses `appwrite.config.json` (rather than `appwrite.json`) at the root of your project to store configuration.*\n\n### Step 1: Initialize the Function\nTo create a new function, open your terminal at the root of your Appwrite project and run:\n\n```bash\nappwrite init functions\n```\nThe CLI will prompt you to:\n1. Name your function (e.g., `userAuth`).\n2. Choose a runtime (e.g., Node.js, Python, Dart, etc.).\n3. Select the folder name for your function.\n\nThis command generates the boilerplate code for your function and automatically registers it in your `appwrite.config.json` file.\n\n*(If you already created a function in the Appwrite Console and want to bring it into your local project, you can run `appwrite pull functions` instead).*\n\n### Step 2: Configure `appwrite.config.json`\nWhen the function is initialized, the CLI updates the `functions` array in your `appwrite.config.json` file. You can manually edit this file to configure how your function builds and triggers.\n\nHere are the key configuration options:\n\n```json\n{\n \"functions\": [\n {\n \"$id\": \"\",\n \"name\": \"userAuth\",\n \"runtime\": \"node-18.0\",\n \"path\": \"functions/userAuth\",\n \"entrypoint\": \"src/main.js\",\n \"commands\": \"npm install\",\n \"events\": [\"users.*.create\"],\n \"schedule\": \"0 0 * * *\",\n \"timeout\": 15,\n \"enabled\": true,\n \"logging\": true,\n \"vars\": []\n }\n ]\n}\n```\n\n**Key Configuration Options:**\n* **`path`**: The relative path to your function's source code folder.\n* **`entrypoint`**: The file Appwrite should execute when the function is triggered (e.g., `src/main.js` or `main.py`).\n* **`commands`**: The build commands executed before deployment (e.g., `npm install` or `pip install -r requirements.txt`).\n* **`events`**: An array of Appwrite system events that will automatically trigger the function (e.g., `users.*.create` to run when a new user signs up).\n* **`schedule`**: A CRON expression to trigger the function on a recurring schedule (e.g., `0 0 * * *` for daily).\n* **`timeout`**: Maximum allowed execution time in seconds (default is usually 15).\n* **`vars`**: An array of environment variables required by the function.\n\n### Step 3: Local Development (Optional)\nWhile writing your function's code, you can test it locally without deploying it to your live Appwrite instance by running:\n\n```bash\nappwrite run functions\n```\n\n### Step 4: Deploy the Function\nOnce your code is ready and your `appwrite.config.json` is configured, deploy the function to your Appwrite project using the `push` command:\n\n```bash\nappwrite push functions\n```\nThe CLI will package your code from the specified `\"path\"`, run the `\"commands\"` to build it, and deploy it to the Appwrite server. \n\n*(If you want to bypass interactive prompts in a CI/CD pipeline, you can use `appwrite push functions --all --force`)*.\n\n### Step 5: Execute the Function (Optional)\nIf your function is not triggered by an event or a schedule, you can manually trigger an execution directly from the CLI to test it:\n\n```bash\nappwrite functions create-execution \\\n --function-id \\\n --body '{\"key\": \"value\"}'\n```\n\nYou can then check the execution logs using:\n```bash\nappwrite functions list-executions --function-id \n```", "correct": true, "score": 0.9, @@ -2087,7 +2087,7 @@ "choices": [ "Pushes code to a Git repository", "Uploads environment variables only", - "Deploys tracked resources (e.g. functions, collections) from appwrite.json to your Appwrite project", + "Deploys tracked resources (e.g. functions, collections) from appwrite.config.json to your Appwrite project", "Syncs local config with the server and overwrites server state" ], "correctAnswer": "C", @@ -2826,6 +2826,182 @@ "modelAnswer": "A", "correct": true, "score": 1 + }, + { + "questionId": "db-22", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid string-based attribute type in Appwrite databases?", + "choices": [ + "varchar", + "mediumtext", + "tinytext", + "longtext" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "db-23", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid format for a string attribute in Appwrite?", + "choices": [ + "uuid", + "email", + "url", + "enum" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-21", + "category": "cli", + "type": "mcq", + "question": "What happens if an Appwrite project contains an appwrite.json file but no appwrite.config.json?", + "choices": [ + "The CLI throws an error and requires appwrite.config.json", + "The CLI falls back to appwrite.json for legacy backwards compatibility", + "The CLI ignores it and uses default settings", + "The CLI automatically migrates appwrite.json to appwrite.config.json" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-22", + "category": "cli", + "type": "mcq", + "question": "What does the appwrite types command do?", + "choices": [ + "Generates typed models for your Appwrite project's collections and attributes", + "Lists all data types supported by Appwrite databases", + "Converts documents between different data formats", + "Validates the types defined in appwrite.config.json" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-24", + "category": "cli", + "type": "mcq", + "question": "A function works locally but fails after pushing because environment variables are missing. What flag was likely missing from the push command?", + "choices": [ + "--env", + "--with-variables", + "--include-env", + "--push-variables" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-25", + "category": "cli", + "type": "mcq", + "question": "When defining an attribute in appwrite.config.json, what happens if 'type' is 'string' or 'varchar' but 'size' is not defined?", + "choices": [ + "The attribute is created with a default size of 255", + "The attribute is created as an unlimited text field", + "The CLI automatically calculates the size based on sample data", + "The CLI throws a validation error because 'size' is required for string/varchar types" + ], + "correctAnswer": "D", + "modelAnswer": "D", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-26", + "category": "cli", + "type": "mcq", + "question": "In appwrite.config.json, when defining an attribute with 'required' set to true, what must the 'default' property be set to?", + "choices": [ + "The default can be any value matching the type", + "The default must be set to an empty string or 0", + "The default must be null", + "The default property is optional and can be omitted" + ], + "correctAnswer": "C", + "modelAnswer": "B", + "correct": false, + "score": 0 + }, + { + "questionId": "cli-27", + "category": "cli", + "type": "mcq", + "question": "What does the 'appwrite generate' command do?", + "choices": [ + "Generates a new Appwrite project from a template", + "Creates boilerplate code for functions and collections", + "Generates a type-safe SDK from your Appwrite project configuration", + "Generates API documentation for your project" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-28", + "category": "cli", + "type": "mcq", + "question": "What's the key difference between `appwrite run function` and `appwrite push function`?", + "choices": [ + "`run` executes locally with Docker emulation, `push` deploys to Appwrite cloud", + "`run` deploys to staging, `push` deploys to production", + "`run` is for testing, `push` is for CI/CD pipelines only", + "`run` requires internet connection, `push` works offline" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-23", + "category": "cli", + "type": "mcq", + "question": "What does the --strict flag do in the appwrite types command?", + "choices": [ + "Enforces type-safe null checks in generated code", + "Throws errors for missing or invalid collection attributes", + "Automatically converts field names to follow language conventions", + "Disables generation of optional fields" + ], + "correctAnswer": "C", + "modelAnswer": "A", + "correct": false, + "score": 0 + }, + { + "questionId": "db-21", + "category": "databases", + "type": "mcq", + "question": "What are the minimum and maximum values for an integer attribute in Appwrite?", + "choices": [ + "-2147483648 to 2147483647 (32-bit signed integer)", + "-9223372036854775808 to 9223372036854775807 (64-bit signed integer)", + "0 to 18446744073709551615 (64-bit unsigned integer)", + "-999999999999 to 999999999999 (12-digit limit)" + ], + "correctAnswer": "B", + "modelAnswer": "A", + "correct": false, + "score": 0 } ] }, @@ -2837,24 +3013,24 @@ "scores": { "fundamental": 99, "auth": 98.8, - "databases": 98.8, + "databases": 94.6, "functions": 99.3, "storage": 98.5, "sites": 100, "messaging": 99.7, "realtime": 95.5, - "cli": 91.5 + "cli": 90.4 }, "mcqScores": { "fundamental": 100, "auth": 100, - "databases": 100, + "databases": 95, "functions": 100, "storage": 100, "sites": 100, "messaging": 100, "realtime": 100, - "cli": 94.1 + "cli": 92 }, "freeformScores": { "fundamental": 93.3, @@ -2867,12 +3043,12 @@ "realtime": 70, "cli": 76.7 }, - "overall": 97.9, - "mcqOverall": 99.4, + "overall": 97, + "mcqOverall": 98.2, "freeformOverall": 89.2, - "totalQuestions": 180, - "totalCorrect": 178, - "runDate": "2026-03-04T12:04:51.665Z", + "totalQuestions": 191, + "totalCorrect": 187, + "runDate": "2026-03-05T15:00:53.740Z", "questionDetails": [ { "questionId": "fund-1", @@ -5410,7 +5586,7 @@ "questionId": "cli-11", "category": "cli", "type": "mcq", - "question": "What command initializes the CLI with your Appwrite project and creates appwrite.json?", + "question": "What command initializes the CLI with your Appwrite project and creates appwrite.config.json?", "choices": [ "appwrite init project", "appwrite setup", @@ -5470,7 +5646,7 @@ "questionId": "cli-14", "category": "cli", "type": "mcq", - "question": "What does the appwrite.json file represent?", + "question": "What does the appwrite.config.json file represent?", "choices": [ "Only function configurations", "User credentials only", @@ -5538,7 +5714,7 @@ "choices": [ "Pushes code to a Git repository", "Uploads environment variables only", - "Deploys tracked resources (e.g. functions, collections) from appwrite.json to your Appwrite project", + "Deploys tracked resources (e.g. functions, collections) from appwrite.config.json to your Appwrite project", "Syncs local config with the server and overwrites server state" ], "correctAnswer": "C", @@ -5571,7 +5747,7 @@ "appwrite.config.js", ".appwriterc", "appwrite.yaml", - "appwrite.json" + "appwrite.config.json" ], "correctAnswer": "D", "modelAnswer": "D", @@ -5642,13 +5818,189 @@ "questionId": "cli-10", "category": "cli", "type": "free-form", - "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.json.", - "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", - "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", + "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.config.json.", + "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.config.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", + "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.config.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", "modelAnswer": "Great question. Here’s the **end-to-end CLI workflow** for Appwrite Functions.\n\n> Small naming note: the CLI uses **`appwrite.config.json`** (not `appwrite.json`).\n\n---\n\n## 1) Install and authenticate CLI\n\n```bash\nnpm install -g appwrite-cli\nappwrite -v\nappwrite login\n# or self-hosted:\n# appwrite login --endpoint \"https://your-instance.com/v1\"\n```\n\nIf needed, set client config explicitly:\n\n```bash\nappwrite client --endpoint https://.cloud.appwrite.io/v1\nappwrite client --key \n```\n\n---\n\n## 2) Initialize your project\n\nIn your project root:\n\n```bash\nappwrite init project\n```\n\nThis creates `appwrite.config.json` with project metadata and resource arrays.\n\n---\n\n## 3) Initialize Function scaffolding\n\n```bash\nappwrite init functions\n```\n\nThis adds a function entry to `appwrite.config.json` and creates function folder/files.\n\nIf your function already exists in Console, you can import it instead:\n\n```bash\nappwrite pull functions\n```\n\n---\n\n## 4) Configure Function in `appwrite.config.json`\n\nA function entry looks like:\n\n```json\n{\n \"functions\": [\n {\n \"$id\": \"\",\n \"name\": \"userAuth\",\n \"enabled\": true,\n \"live\": true,\n \"logging\": true,\n \"runtime\": \"node-18.0\",\n \"deployment\": \"\",\n \"vars\": [],\n \"events\": [],\n \"schedule\": \"\",\n \"timeout\": 15,\n \"entrypoint\": \"userAuth.js\",\n \"commands\": \"npm install\",\n \"version\": \"v3\",\n \"path\": \"functions/userAuth\"\n }\n ]\n}\n```\n\n### Key options (what to set carefully)\n- **`$id`**: Function ID.\n- **`name`**: Display name.\n- **`enabled`**: Turn function on/off.\n- **`live`**: Whether it serves live traffic.\n- **`logging`**: Store execution logs.\n- **`runtime`**: Runtime (check available via `appwrite functions list-runtimes`).\n- **`vars`**: Environment variables.\n- **`events`**: Event triggers.\n- **`schedule`**: Cron schedule for timed execution.\n- **`timeout`**: Max execution time in seconds.\n- **`entrypoint`**: Main source file.\n- **`commands`**: Build/install commands run during deployment.\n- **`deployment`**: Active deployment ID (managed after deploy).\n- **`path`**: Local folder containing function code.\n- **`version`**: Config/runtime version marker.\n\n---\n\n## 5) Deploy Function\n\n```bash\nappwrite push functions\n```\n\nThis uploads and deploys functions defined in config.\n\nUseful alternatives:\n```bash\nappwrite push functions --all --force\nappwrite push functions --function-id --force\n```\n\n---\n\n## 6) Test and verify\n\n### Trigger execution manually\n```bash\nappwrite functions create-execution --function-id \n```\n\nWith JSON body:\n```bash\nappwrite functions create-execution \\\n --function-id \\\n --body '{\"key\":\"value\"}'\n```\n\n### Check logs/executions\n```bash\nappwrite functions list-executions --function-id \nappwrite functions get-execution --function-id --execution-id \n```\n\n---\n\n## 7) Local development loop (optional)\n\n```bash\nappwrite run functions\n```\n\nUse this while iterating, then `appwrite push functions` for remote deploy.\n\n---\n\n## 8) CI/CD (non-interactive)\n\nFor pipelines, configure client once (no interactive login/session):\n\n```bash\nappwrite client \\\n --endpoint https://.cloud.appwrite.io/v1 \\\n --project-id \\\n --key \n```\n\nThen deploy:\n\n```bash\nappwrite push functions --all --force\n```\n\n---\n\nIf you want, I can also give you a **minimal real `appwrite.config.json` template** for Node, Python, or Go functions you can paste directly.", "correct": true, "score": 0.7, "judgeReasoning": "The answer covers most of the required rubric points: (1) appwrite init functions for scaffolding, (2) runtime selection is mentioned in the config options, (3) appwrite.json configuration options are detailed (though incorrectly named as appwrite.config.json - the actual file is appwrite.json), (4) local development with 'appwrite run functions' is mentioned in step 7 (though the reference uses 'appwrite run function' singular), and (5) deployment with 'appwrite push functions' is covered. The answer is comprehensive and detailed. The main issues are: the incorrect claim that the file is named 'appwrite.config.json' rather than 'appwrite.json', and the local development command is mentioned only briefly at the end rather than as a primary workflow step. The execute permissions configuration is also missing from the appwrite.json example. Despite these issues, all 5 rubric points are addressed, earning a reasonably high score, but the incorrect filename claim is a notable error." + }, + { + "questionId": "db-21", + "category": "databases", + "type": "mcq", + "question": "What are the minimum and maximum values for an integer attribute in Appwrite?", + "choices": [ + "-2147483648 to 2147483647 (32-bit signed integer)", + "-9223372036854775808 to 9223372036854775807 (64-bit signed integer)", + "0 to 18446744073709551615 (64-bit unsigned integer)", + "-999999999999 to 999999999999 (12-digit limit)" + ], + "correctAnswer": "B", + "modelAnswer": "A", + "correct": false, + "score": 0 + }, + { + "questionId": "db-22", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid string-based attribute type in Appwrite databases?", + "choices": [ + "varchar", + "mediumtext", + "tinytext", + "longtext" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "db-23", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid format for a string attribute in Appwrite?", + "choices": [ + "uuid", + "email", + "url", + "enum" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-21", + "category": "cli", + "type": "mcq", + "question": "What happens if an Appwrite project contains an appwrite.json file but no appwrite.config.json?", + "choices": [ + "The CLI throws an error and requires appwrite.config.json", + "The CLI falls back to appwrite.json for legacy backwards compatibility", + "The CLI ignores it and uses default settings", + "The CLI automatically migrates appwrite.json to appwrite.config.json" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-22", + "category": "cli", + "type": "mcq", + "question": "What does the appwrite types command do?", + "choices": [ + "Generates typed models for your Appwrite project's collections and attributes", + "Lists all data types supported by Appwrite databases", + "Converts documents between different data formats", + "Validates the types defined in appwrite.config.json" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-23", + "category": "cli", + "type": "mcq", + "question": "What does the --strict flag do in the appwrite types command?", + "choices": [ + "Enforces type-safe null checks in generated code", + "Throws errors for missing or invalid collection attributes", + "Automatically converts field names to follow language conventions", + "Disables generation of optional fields" + ], + "correctAnswer": "C", + "modelAnswer": "B", + "correct": false, + "score": 0 + }, + { + "questionId": "cli-24", + "category": "cli", + "type": "mcq", + "question": "A function works locally but fails after pushing because environment variables are missing. What flag was likely missing from the push command?", + "choices": [ + "--env", + "--with-variables", + "--include-env", + "--push-variables" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-25", + "category": "cli", + "type": "mcq", + "question": "When defining an attribute in appwrite.config.json, what happens if 'type' is 'string' or 'varchar' but 'size' is not defined?", + "choices": [ + "The attribute is created with a default size of 255", + "The attribute is created as an unlimited text field", + "The CLI automatically calculates the size based on sample data", + "The CLI throws a validation error because 'size' is required for string/varchar types" + ], + "correctAnswer": "D", + "modelAnswer": "D", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-26", + "category": "cli", + "type": "mcq", + "question": "In appwrite.config.json, when defining an attribute with 'required' set to true, what must the 'default' property be set to?", + "choices": [ + "The default can be any value matching the type", + "The default must be set to an empty string or 0", + "The default must be null", + "The default property is optional and can be omitted" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-27", + "category": "cli", + "type": "mcq", + "question": "What does the 'appwrite generate' command do?", + "choices": [ + "Generates a new Appwrite project from a template", + "Creates boilerplate code for functions and collections", + "Generates a type-safe SDK from your Appwrite project configuration", + "Generates API documentation for your project" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-28", + "category": "cli", + "type": "mcq", + "question": "What's the key difference between `appwrite run function` and `appwrite push function`?", + "choices": [ + "`run` executes locally with Docker emulation, `push` deploys to Appwrite cloud", + "`run` deploys to staging, `push` deploys to production", + "`run` is for testing, `push` is for CI/CD pipelines only", + "`run` requires internet connection, `push` works offline" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 } ] }, @@ -5660,24 +6012,24 @@ "scores": { "fundamental": 100, "auth": 100, - "databases": 93.5, + "databases": 94.3, "functions": 94.3, "storage": 99.7, "sites": 100, "messaging": 100, "realtime": 88.5, - "cli": 92.7 + "cli": 91.2 }, "mcqScores": { "fundamental": 100, "auth": 100, - "databases": 94.1, + "databases": 95, "functions": 94.1, "storage": 100, "sites": 100, "messaging": 100, "realtime": 94.1, - "cli": 94.1 + "cli": 92 }, "freeformScores": { "fundamental": 100, @@ -5690,12 +6042,12 @@ "realtime": 56.7, "cli": 85 }, - "overall": 96.5, - "mcqOverall": 97.4, + "overall": 96.2, + "mcqOverall": 97, "freeformOverall": 91.3, - "totalQuestions": 180, - "totalCorrect": 175, - "runDate": "2026-03-04T12:04:51.665Z", + "totalQuestions": 191, + "totalCorrect": 185, + "runDate": "2026-03-05T15:00:53.740Z", "questionDetails": [ { "questionId": "fund-1", @@ -8098,7 +8450,7 @@ "appwrite.config.js", ".appwriterc", "appwrite.yaml", - "appwrite.json" + "appwrite.config.json" ], "correctAnswer": "D", "modelAnswer": "D", @@ -8169,7 +8521,7 @@ "questionId": "cli-11", "category": "cli", "type": "mcq", - "question": "What command initializes the CLI with your Appwrite project and creates appwrite.json?", + "question": "What command initializes the CLI with your Appwrite project and creates appwrite.config.json?", "choices": [ "appwrite init project", "appwrite setup", @@ -8201,7 +8553,7 @@ "questionId": "cli-14", "category": "cli", "type": "mcq", - "question": "What does the appwrite.json file represent?", + "question": "What does the appwrite.config.json file represent?", "choices": [ "Only function configurations", "User credentials only", @@ -8269,7 +8621,7 @@ "choices": [ "Pushes code to a Git repository", "Uploads environment variables only", - "Deploys tracked resources (e.g. functions, collections) from appwrite.json to your Appwrite project", + "Deploys tracked resources (e.g. functions, collections) from appwrite.config.json to your Appwrite project", "Syncs local config with the server and overwrites server state" ], "correctAnswer": "C", @@ -8321,9 +8673,9 @@ "questionId": "cli-10", "category": "cli", "type": "free-form", - "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.json.", - "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", - "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", + "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.config.json.", + "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.config.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", + "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.config.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", "modelAnswer": "\n\n# Complete Workflow for Creating, Configuring, and Deploying an Appwrite Function via the CLI\n\n## 1. Prerequisites\n\nBefore starting, ensure the CLI is installed and you're authenticated with a project initialized:\n\n```bash\n# Install the CLI\nnpm install -g appwrite-cli\n\n# Login to your Appwrite account\nappwrite login\n\n# Initialize a project (creates appwrite.config.json)\nappwrite init project\n```\n\n---\n\n## 2. Create a New Function\n\n```bash\nappwrite init functions\n```\n\nThis interactive command prompts you to choose a runtime (e.g., `node-18.0`), give the function a name, and scaffolds a starter function in a local directory (e.g., `functions/myFunction/`).\n\n---\n\n## 3. Configure the Function in `appwrite.config.json`\n\nAfter creation, the function is registered in your `appwrite.config.json`. Here's a breakdown of every key configuration option:\n\n```json\n{\n \"projectId\": \"\",\n \"endpoint\": \"https://.cloud.appwrite.io/v1\",\n \"functions\": [\n {\n \"$id\": \"myFunction\",\n \"name\": \"userAuth\",\n \"enabled\": true,\n \"live\": true,\n \"logging\": true,\n \"runtime\": \"node-18.0\",\n \"deployment\": \"\",\n \"vars\": [],\n \"events\": [],\n \"schedule\": \"\",\n \"timeout\": 15,\n \"entrypoint\": \"userAuth.js\",\n \"commands\": \"npm install\",\n \"version\": \"v3\",\n \"path\": \"functions/userAuth\"\n }\n ]\n}\n```\n\n### Key Configuration Options Explained\n\n| Option | Description |\n|---|---|\n| `$id` | Unique identifier for the function |\n| `name` | Human-readable display name |\n| `enabled` | Whether the function can be executed (`true`/`false`) |\n| `live` | Whether the function is live in production |\n| `logging` | Enable execution logging for debugging |\n| `runtime` | Language runtime (e.g., `node-18.0`, `python-3.9`, `dart-3.0`, `ruby-3.1`, etc.) |\n| `deployment` | ID of the currently active deployment |\n| `vars` | Array of environment variables available to the function |\n| `events` | Array of system events that trigger the function (e.g., `databases.*.tables.*.rows.*.create`) |\n| `schedule` | Cron expression for scheduled execution (e.g., `\"0 */6 * * *\"` for every 6 hours) |\n| `timeout` | Max execution time in seconds before the function is killed |\n| `entrypoint` | The file that serves as the function's entry point |\n| `commands` | Build/install commands run before deployment (e.g., `npm install`) |\n| `version` | Function version format (`v3` is current) |\n| `path` | Local directory path containing the function source code |\n\n---\n\n## 4. Write the Function Code\n\nEdit the entry point file in the function's directory. For example, for a Node.js function at `functions/userAuth/userAuth.js`:\n\n```typescript\nexport default async ({ req, res, log, error }) => {\n log('Processing: ' + req.method + ' ' + req.path);\n\n if (req.method === 'GET') {\n return res.json({ message: 'Hello from Appwrite Function!' });\n }\n\n const data = req.bodyJson;\n if (!data?.name) {\n error('Missing name field');\n return res.json({ error: 'Name is required' }, 400);\n }\n\n return res.json({ success: true, name: data.name });\n};\n```\n\n---\n\n## 5. Test Locally\n\nBefore deploying, run the function locally to verify it works:\n\n```bash\nappwrite run functions\n```\n\nThis starts a local development server that simulates the Appwrite Function runtime.\n\n---\n\n## 6. Manage Environment Variables\n\nAdd environment variables your function needs, either via the CLI or by populating the `vars` array in the config:\n\n```bash\n# Create a variable\nappwrite functions create-variable \\\n --function-id myFunction \\\n --key API_SECRET \\\n --value \"s3cr3t-value\"\n\n# List variables\nappwrite functions list-variables --function-id myFunction\n\n# Update a variable\nappwrite functions update-variable \\\n --function-id myFunction \\\n --variable-id \\\n --key API_SECRET \\\n --value \"new-s3cr3t\"\n\n# Delete a variable\nappwrite functions delete-variable \\\n --function-id myFunction \\\n --variable-id \n```\n\n---\n\n## 7. Deploy the Function\n\n```bash\n# Deploy all functions defined in appwrite.config.json\nappwrite push functions\n\n# Deploy a specific function by ID\nappwrite push functions --function-id myFunction\n```\n\nThis uploads the source code from the `path` directory, runs the `commands` (e.g., `npm install`), builds the function, and activates the deployment.\n\n---\n\n## 8. Verify and Manage Deployments\n\n```bash\n# List all deployments for the function\nappwrite functions list-deployments --function-id myFunction\n\n# Set a specific deployment as active (rollback)\nappwrite functions update-deployment \\\n --function-id myFunction \\\n --deployment-id \n\n# Download a deployment's source code\nappwrite functions download-deployment \\\n --function-id myFunction \\\n --deployment-id \n\n# Delete an old deployment\nappwrite functions delete-deployment \\\n --function-id myFunction \\\n --deployment-id \n```\n\n---\n\n## 9. Trigger and Monitor Executions\n\n```bash\n# Trigger the function manually\nappwrite functions create-execution --function-id myFunction\n\n# Trigger with a JSON body\nappwrite functions create-execution \\\n --function-id myFunction \\\n --body '{\"name\": \"Walter\"}'\n\n# List execution logs\nappwrite functions list-executions --function-id myFunction\n\n# Get a specific execution log\nappwrite functions get-execution \\\n --function-id myFunction \\\n --execution-id \n```\n\n---\n\n## 10. Pull Remote Changes\n\nIf the function was modified in the Appwrite Console by another team member, sync those changes locally:\n\n```bash\nappwrite pull functions\n```\n\nThis updates both the `appwrite.config.json` and the local source files.\n\n---\n\n## 11. CI/CD (Non-Interactive) Deployment\n\nFor automated pipelines where there's no interactive prompt, configure the client inline and use `--force` to skip confirmations:\n\n```bash\n# Configure credentials\nappwrite client \\\n --endpoint https://.cloud.appwrite.io/v1 \\\n --project-id \\\n --key \n\n# Deploy all functions non-interactively\nappwrite push functions --all --force\n\n# Or deploy a specific function\nappwrite push functions --function-id myFunction --force\n```\n\n---\n\n## Summary: End-to-End Flow\n\n```\nappwrite login\n ↓\nappwrite init project\n ↓\nappwrite init functions ← scaffold function + register in config\n ↓\nEdit source code ← write your handler logic\n ↓\nEdit appwrite.config.json ← configure runtime, timeout, events, schedule, vars\n ↓\nappwrite run functions ← test locally\n ↓\nappwrite push functions ← deploy to Appwrite\n ↓\nappwrite functions create-execution --function-id ← trigger & verify\n ↓\nappwrite functions list-executions --function-id ← monitor logs\n```", "correct": true, "score": 0.9, @@ -8472,6 +8824,182 @@ "modelAnswer": "D", "correct": true, "score": 1 + }, + { + "questionId": "db-21", + "category": "databases", + "type": "mcq", + "question": "What are the minimum and maximum values for an integer attribute in Appwrite?", + "choices": [ + "-2147483648 to 2147483647 (32-bit signed integer)", + "-9223372036854775808 to 9223372036854775807 (64-bit signed integer)", + "0 to 18446744073709551615 (64-bit unsigned integer)", + "-999999999999 to 999999999999 (12-digit limit)" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "db-22", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid string-based attribute type in Appwrite databases?", + "choices": [ + "varchar", + "mediumtext", + "tinytext", + "longtext" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "db-23", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid format for a string attribute in Appwrite?", + "choices": [ + "uuid", + "email", + "url", + "enum" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-21", + "category": "cli", + "type": "mcq", + "question": "What happens if an Appwrite project contains an appwrite.json file but no appwrite.config.json?", + "choices": [ + "The CLI throws an error and requires appwrite.config.json", + "The CLI falls back to appwrite.json for legacy backwards compatibility", + "The CLI ignores it and uses default settings", + "The CLI automatically migrates appwrite.json to appwrite.config.json" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-22", + "category": "cli", + "type": "mcq", + "question": "What does the appwrite types command do?", + "choices": [ + "Generates typed models for your Appwrite project's collections and attributes", + "Lists all data types supported by Appwrite databases", + "Converts documents between different data formats", + "Validates the types defined in appwrite.config.json" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-23", + "category": "cli", + "type": "mcq", + "question": "What does the --strict flag do in the appwrite types command?", + "choices": [ + "Enforces type-safe null checks in generated code", + "Throws errors for missing or invalid collection attributes", + "Automatically converts field names to follow language conventions", + "Disables generation of optional fields" + ], + "correctAnswer": "C", + "modelAnswer": "B", + "correct": false, + "score": 0 + }, + { + "questionId": "cli-24", + "category": "cli", + "type": "mcq", + "question": "A function works locally but fails after pushing because environment variables are missing. What flag was likely missing from the push command?", + "choices": [ + "--env", + "--with-variables", + "--include-env", + "--push-variables" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-25", + "category": "cli", + "type": "mcq", + "question": "When defining an attribute in appwrite.config.json, what happens if 'type' is 'string' or 'varchar' but 'size' is not defined?", + "choices": [ + "The attribute is created with a default size of 255", + "The attribute is created as an unlimited text field", + "The CLI automatically calculates the size based on sample data", + "The CLI throws a validation error because 'size' is required for string/varchar types" + ], + "correctAnswer": "D", + "modelAnswer": "D", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-26", + "category": "cli", + "type": "mcq", + "question": "In appwrite.config.json, when defining an attribute with 'required' set to true, what must the 'default' property be set to?", + "choices": [ + "The default can be any value matching the type", + "The default must be set to an empty string or 0", + "The default must be null", + "The default property is optional and can be omitted" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-27", + "category": "cli", + "type": "mcq", + "question": "What does the 'appwrite generate' command do?", + "choices": [ + "Generates a new Appwrite project from a template", + "Creates boilerplate code for functions and collections", + "Generates a type-safe SDK from your Appwrite project configuration", + "Generates API documentation for your project" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-28", + "category": "cli", + "type": "mcq", + "question": "What's the key difference between `appwrite run function` and `appwrite push function`?", + "choices": [ + "`run` executes locally with Docker emulation, `push` deploys to Appwrite cloud", + "`run` deploys to staging, `push` deploys to production", + "`run` is for testing, `push` is for CI/CD pipelines only", + "`run` requires internet connection, `push` works offline" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 } ] }, @@ -8483,24 +9011,24 @@ "scores": { "fundamental": 100, "auth": 99.3, - "databases": 93.2, + "databases": 94.1, "functions": 99.7, "storage": 93.5, "sites": 100, "messaging": 98.5, "realtime": 89, - "cli": 92.3 + "cli": 87.3 }, "mcqScores": { "fundamental": 100, "auth": 100, - "databases": 94.1, + "databases": 95, "functions": 100, "storage": 94.1, "sites": 100, "messaging": 100, "realtime": 94.1, - "cli": 94.1 + "cli": 88 }, "freeformScores": { "fundamental": 100, @@ -8513,12 +9041,12 @@ "realtime": 60, "cli": 81.7 }, - "overall": 96.2, - "mcqOverall": 97.4, + "overall": 95.3, + "mcqOverall": 96.4, "freeformOverall": 88.8, - "totalQuestions": 180, - "totalCorrect": 175, - "runDate": "2026-03-04T12:04:51.665Z", + "totalQuestions": 191, + "totalCorrect": 184, + "runDate": "2026-03-05T15:00:53.740Z", "questionDetails": [ { "questionId": "fund-1", @@ -10740,7 +11268,7 @@ "questionId": "cli-11", "category": "cli", "type": "mcq", - "question": "What command initializes the CLI with your Appwrite project and creates appwrite.json?", + "question": "What command initializes the CLI with your Appwrite project and creates appwrite.config.json?", "choices": [ "appwrite init project", "appwrite setup", @@ -10761,7 +11289,7 @@ "appwrite.config.js", ".appwriterc", "appwrite.yaml", - "appwrite.json" + "appwrite.config.json" ], "correctAnswer": "D", "modelAnswer": "D", @@ -10784,7 +11312,7 @@ "questionId": "cli-14", "category": "cli", "type": "mcq", - "question": "What does the appwrite.json file represent?", + "question": "What does the appwrite.config.json file represent?", "choices": [ "Only function configurations", "User credentials only", @@ -10800,9 +11328,9 @@ "questionId": "cli-10", "category": "cli", "type": "free-form", - "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.json.", - "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", - "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", + "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.config.json.", + "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.config.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", + "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.config.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", "modelAnswer": " Here is the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI, from initialization to production deployment.\n\n## 1. Prerequisites & Project Setup\n\nFirst, ensure you are logged in and have initialized a project:\n\n```bash\n# Login to Appwrite (Cloud or self-hosted)\nappwrite login\n\n# Initialize project (creates appwrite.config.json)\nappwrite init project\n```\n\nThis creates an `appwrite.config.json` file at your project root where all function configurations are stored.\n\n## 2. Create a New Function\n\nGenerate the function scaffold using the CLI:\n\n```bash\n# Interactive creation (prompts for runtime, name, etc.)\nappwrite init functions\n\n# Or specify options directly\nappwrite init functions --runtime node-18.0 --name \"processPayment\"\n```\n\nThis command:\n- Creates a directory structure (e.g., `functions/processPayment/`)\n- Generates starter code based on the runtime\n- Adds the function configuration to `appwrite.config.json`\n\n## 3. Configure the Function (appwrite.config.json)\n\nThe CLI manages function settings in `appwrite.config.json`. Here is the complete configuration structure with all key options:\n\n```json\n{\n \"projectId\": \"\",\n \"endpoint\": \"https://.cloud.appwrite.io/v1\",\n \"functions\": [\n {\n \"$id\": \"processPayment\",\n \"name\": \"Process Payment\",\n \"enabled\": true,\n \"live\": true,\n \"logging\": true,\n \"runtime\": \"node-18.0\",\n \"deployment\": \"\",\n \"vars\": [\n { \"key\": \"STRIPE_KEY\", \"value\": \"sk_live_...\" },\n { \"key\": \"WEBHOOK_SECRET\", \"value\": \"whsec_...\" }\n ],\n \"events\": [\n \"databases.*.tables.*.rows.*.create\",\n \"users.*.create\"\n ],\n \"schedule\": \"0 9 * * *\",\n \"timeout\": 30,\n \"entrypoint\": \"src/main.js\",\n \"commands\": \"npm install && npm run build\",\n \"version\": \"v3\",\n \"path\": \"functions/processPayment\"\n }\n ]\n}\n```\n\n### Key Configuration Options\n\n| Option | Description | Example |\n|--------|-------------|---------|\n| `$id` | Unique function identifier (auto-generated if not specified) | `\"processPayment\"` |\n| `runtime` | Language and version (e.g., `node-18.0`, `python-3.11`, `dart-3.0`) | `\"node-18.0\"` |\n| `entrypoint` | Main file executed when function is triggered | `\"src/main.js\"` |\n| `commands` | Build/install commands run during deployment | `\"npm install\"` |\n| `timeout` | Maximum execution time in seconds (max 900s/15min) | `30` |\n| `schedule` | Cron expression for scheduled execution (optional) | `\"0 9 * * *\"` |\n| `events` | Array of Appwrite events that trigger this function (optional) | `[\"databases.*.tables.*.rows.*.create\"]` |\n| `vars` | Environment variables as key-value pairs | `[{\"key\": \"API_KEY\", \"value\": \"xxx\"}]` |\n| `path` | Local directory path relative to config file | `\"functions/processPayment\"` |\n| `enabled` | Whether the function is active | `true` |\n| `logging` | Enable execution logging | `true` |\n| `live` | Enable live mode (production) | `true` |\n\n## 4. Local Development\n\nDevelop your function locally with hot-reload support:\n\n```bash\n# Run all functions locally\nappwrite run functions\n\n# Run specific function\nappwrite run functions --function-id processPayment\n```\n\nThe local runtime simulates the Appwrite environment, allowing you to test:\n- HTTP requests/responses\n- Environment variables (from `vars` in config)\n- Event payloads\n\n**Example Function Handler (Node.js):**\n```javascript\n// functions/processPayment/src/main.js\nexport default async ({ req, res, log, error }) => {\n log('Processing payment...');\n \n if (req.method === 'POST') {\n const data = req.bodyJson;\n // Process payment logic here\n \n return res.json({ success: true, amount: data.amount });\n }\n \n return res.text('Method not allowed', 405);\n};\n```\n\n## 5. Deploy the Function\n\nDeploy to Appwrite Cloud or your self-hosted instance:\n\n```bash\n# Deploy all functions\nappwrite push functions\n\n# Deploy specific function\nappwrite push functions --function-id processPayment\n\n# Force deploy without confirmation prompts (CI/CD)\nappwrite push functions --all --force\n```\n\nThe deployment process:\n1. Packages the code from the `path` directory\n2. Executes the `commands` (e.g., `npm install`)\n3. Creates a new deployment\n4. Activates the deployment (if `live: true`)\n\n## 6. Post-Deployment Management\n\n### Manage Environment Variables\n```bash\n# List variables\nappwrite functions list-variables --function-id processPayment\n\n# Add/update variable\nappwrite functions create-variable --function-id processPayment --key NEW_KEY --value \"value\"\n```\n\n### View Executions & Logs\n```bash\n# List recent executions\nappwrite functions list-executions --function-id processPayment\n\n# Get specific execution details\nappwrite functions get-execution --function-id processPayment --execution-id \n```\n\n### Manual Execution (Testing)\n```bash\nappwrite functions create-execution \\\n --function-id processPayment \\\n --body '{\"amount\": 100, \"currency\": \"USD\"}'\n```\n\n## 7. CI/CD Integration (Non-Interactive Mode)\n\nFor automated pipelines, configure the client and deploy without interaction:\n\n```bash\n# Configure client for CI/CD\nappwrite client \\\n --endpoint https://.cloud.appwrite.io/v1 \\\n --project-id \\\n --key \n\n# Deploy with force flag\nappwrite push functions --all --force\n```\n\n## Complete Workflow Summary\n\n1. **Initialize**: `appwrite init project`\n2. **Create**: `appwrite init functions` (select runtime)\n3. **Configure**: Edit `appwrite.config.json` (timeout, vars, events, schedule)\n4. **Develop**: Write code in the generated directory, test with `appwrite run functions`\n5. **Deploy**: `appwrite push functions`\n6. **Monitor**: Check executions via CLI or Console\n\nThe `appwrite.config.json` serves as the single source of truth for your function infrastructure, allowing you to version control your entire Appwrite backend configuration alongside your application code.", "correct": true, "score": 0.9, @@ -10848,7 +11376,7 @@ "choices": [ "Pushes code to a Git repository", "Uploads environment variables only", - "Deploys tracked resources (e.g. functions, collections) from appwrite.json to your Appwrite project", + "Deploys tracked resources (e.g. functions, collections) from appwrite.config.json to your Appwrite project", "Syncs local config with the server and overwrites server state" ], "correctAnswer": "C", @@ -11295,6 +11823,182 @@ "modelAnswer": "C", "correct": true, "score": 1 + }, + { + "questionId": "db-21", + "category": "databases", + "type": "mcq", + "question": "What are the minimum and maximum values for an integer attribute in Appwrite?", + "choices": [ + "-2147483648 to 2147483647 (32-bit signed integer)", + "-9223372036854775808 to 9223372036854775807 (64-bit signed integer)", + "0 to 18446744073709551615 (64-bit unsigned integer)", + "-999999999999 to 999999999999 (12-digit limit)" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "db-22", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid string-based attribute type in Appwrite databases?", + "choices": [ + "varchar", + "mediumtext", + "tinytext", + "longtext" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "db-23", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid format for a string attribute in Appwrite?", + "choices": [ + "uuid", + "email", + "url", + "enum" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-21", + "category": "cli", + "type": "mcq", + "question": "What happens if an Appwrite project contains an appwrite.json file but no appwrite.config.json?", + "choices": [ + "The CLI throws an error and requires appwrite.config.json", + "The CLI falls back to appwrite.json for legacy backwards compatibility", + "The CLI ignores it and uses default settings", + "The CLI automatically migrates appwrite.json to appwrite.config.json" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-22", + "category": "cli", + "type": "mcq", + "question": "What does the appwrite types command do?", + "choices": [ + "Generates typed models for your Appwrite project's collections and attributes", + "Lists all data types supported by Appwrite databases", + "Converts documents between different data formats", + "Validates the types defined in appwrite.config.json" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-23", + "category": "cli", + "type": "mcq", + "question": "What does the --strict flag do in the appwrite types command?", + "choices": [ + "Enforces type-safe null checks in generated code", + "Throws errors for missing or invalid collection attributes", + "Automatically converts field names to follow language conventions", + "Disables generation of optional fields" + ], + "correctAnswer": "C", + "modelAnswer": "B", + "correct": false, + "score": 0 + }, + { + "questionId": "cli-24", + "category": "cli", + "type": "mcq", + "question": "A function works locally but fails after pushing because environment variables are missing. What flag was likely missing from the push command?", + "choices": [ + "--env", + "--with-variables", + "--include-env", + "--push-variables" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-25", + "category": "cli", + "type": "mcq", + "question": "When defining an attribute in appwrite.config.json, what happens if 'type' is 'string' or 'varchar' but 'size' is not defined?", + "choices": [ + "The attribute is created with a default size of 255", + "The attribute is created as an unlimited text field", + "The CLI automatically calculates the size based on sample data", + "The CLI throws a validation error because 'size' is required for string/varchar types" + ], + "correctAnswer": "D", + "modelAnswer": "D", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-26", + "category": "cli", + "type": "mcq", + "question": "In appwrite.config.json, when defining an attribute with 'required' set to true, what must the 'default' property be set to?", + "choices": [ + "The default can be any value matching the type", + "The default must be set to an empty string or 0", + "The default must be null", + "The default property is optional and can be omitted" + ], + "correctAnswer": "C", + "modelAnswer": "D", + "correct": false, + "score": 0 + }, + { + "questionId": "cli-27", + "category": "cli", + "type": "mcq", + "question": "What does the 'appwrite generate' command do?", + "choices": [ + "Generates a new Appwrite project from a template", + "Creates boilerplate code for functions and collections", + "Generates a type-safe SDK from your Appwrite project configuration", + "Generates API documentation for your project" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-28", + "category": "cli", + "type": "mcq", + "question": "What's the key difference between `appwrite run function` and `appwrite push function`?", + "choices": [ + "`run` executes locally with Docker emulation, `push` deploys to Appwrite cloud", + "`run` deploys to staging, `push` deploys to production", + "`run` is for testing, `push` is for CI/CD pipelines only", + "`run` requires internet connection, `push` works offline" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 } ] } diff --git a/src/data/results-without-skills.json b/src/data/results-without-skills.json index 83659f4..f804e93 100644 --- a/src/data/results-without-skills.json +++ b/src/data/results-without-skills.json @@ -1,9 +1,9 @@ { "version": "1.0.0", - "runDate": "2026-03-04T12:04:18.191Z", + "runDate": "2026-03-05T15:00:54.867Z", "mode": "without-skills", - "totalQuestions": 180, - "totalMcq": 154, + "totalQuestions": 191, + "totalMcq": 165, "totalFreeform": 26, "models": [ { @@ -14,24 +14,24 @@ "scores": { "fundamental": 100, "auth": 99.3, - "databases": 84.5, + "databases": 86.5, "functions": 100, "storage": 95, "sites": 96, "messaging": 95, "realtime": 100, - "cli": 80 + "cli": 71.4 }, "mcqScores": { "fundamental": 100, "auth": 100, - "databases": 82.4, + "databases": 85, "functions": 100, "storage": 94.1, "sites": 100, "messaging": 94.1, "realtime": 100, - "cli": 82.4 + "cli": 72 }, "freeformScores": { "fundamental": 100, @@ -44,12 +44,12 @@ "realtime": 100, "cli": 66.7 }, - "overall": 94.4, - "mcqOverall": 94.8, + "overall": 92.6, + "mcqOverall": 92.7, "freeformOverall": 92.1, - "totalQuestions": 180, - "totalCorrect": 171, - "runDate": "2026-03-04T12:04:18.190Z", + "totalQuestions": 191, + "totalCorrect": 178, + "runDate": "2026-03-05T15:00:54.866Z", "questionDetails": [ { "questionId": "fund-1", @@ -2560,7 +2560,7 @@ "appwrite.config.js", ".appwriterc", "appwrite.yaml", - "appwrite.json" + "appwrite.config.json" ], "correctAnswer": "D", "modelAnswer": "D", @@ -2635,7 +2635,7 @@ "questionId": "cli-11", "category": "cli", "type": "mcq", - "question": "What command initializes the CLI with your Appwrite project and creates appwrite.json?", + "question": "What command initializes the CLI with your Appwrite project and creates appwrite.config.json?", "choices": [ "appwrite init project", "appwrite setup", @@ -2667,7 +2667,7 @@ "questionId": "cli-14", "category": "cli", "type": "mcq", - "question": "What does the appwrite.json file represent?", + "question": "What does the appwrite.config.json file represent?", "choices": [ "Only function configurations", "User credentials only", @@ -2695,9 +2695,9 @@ "questionId": "cli-10", "category": "cli", "type": "free-form", - "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.json.", - "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", - "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", + "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.config.json.", + "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.config.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", + "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.config.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", "modelAnswer": "Here is the complete workflow for creating, configuring, and deploying an Appwrite Function using the Appwrite CLI.\n\n### Prerequisites\nBefore starting, ensure you have the Appwrite CLI installed (`npm install -g appwrite-cli`), authenticated (`appwrite login`), and linked to your Appwrite project (`appwrite init project`).\n\n---\n\n### Step 1: Create the Function\nUse the CLI to initialize a new function. This will create the boilerplate code and update your `appwrite.json` file.\n\n```bash\nappwrite init function\n```\nThe CLI will prompt you to:\n1. Name your function (e.g., `My Function`).\n2. Choose a runtime (e.g., `Node.js`, `Python`, `Dart`, etc.).\n3. Select the source code folder name.\n\n### Step 2: Write the Function Code\nNavigate to the newly created function directory. Open the entry point file (e.g., `src/main.js` for Node.js) and write your logic. Appwrite functions always receive a `context` object containing the request (`req`), response (`res`), and logging utilities (`log`, `error`).\n\n```javascript\n// Example Node.js entrypoint\nexport default async ({ req, res, log, error }) => {\n log(\"Function executed!\");\n return res.json({ message: \"Hello from Appwrite!\" });\n};\n```\n\n### Step 3: Configure `appwrite.json`\nWhen you initialized the function, the CLI automatically generated an `appwrite.json` file in your project root. This file acts as the source of truth for your function's configuration. \n\nHere are the key configuration options you can modify:\n\n```json\n{\n \"projectId\": \"your-project-id\",\n \"projectName\": \"Your Project\",\n \"functions\": [\n {\n \"$id\": \"my-function-id\",\n \"name\": \"My Function\",\n \"runtime\": \"node-18.0\",\n \"path\": \"functions/My Function\",\n \"entrypoint\": \"src/main.js\",\n \"commands\": \"npm install\",\n \"execute\": [\"any\"],\n \"events\": [\"users.*.create\"],\n \"schedule\": \"0 0 * * *\",\n \"timeout\": 15,\n \"ignore\": [\"node_modules\", \".env\"]\n }\n ]\n}\n```\n\n**Key Configuration Options:**\n* **`path`**: The relative path to your function's source code directory.\n* **`entrypoint`**: The file Appwrite should execute when the function is triggered.\n* **`commands`**: The build commands executed before deployment (e.g., `npm install` or `pip install -r requirements.txt`).\n* **`execute`**: An array of permissions defining who can trigger the function (e.g., `[\"any\"]` for public, or `[\"users\"]` for authenticated users).\n* **`events`**: An array of Appwrite system events that will automatically trigger the function (e.g., `databases.*.collections.*.documents.*.create`).\n* **`schedule`**: A CRON expression to trigger the function on a recurring schedule.\n* **`timeout`**: Maximum execution time in seconds (default is usually 15).\n* **`ignore`**: An array of files/folders to exclude when packaging the function for deployment (crucial for keeping deployment sizes small).\n\n### Step 4: Deploy the Function\nOnce your code is written and `appwrite.json` is configured, deploy the function to your Appwrite server.\n\n```bash\nappwrite deploy function\n```\nThe CLI will prompt you to select which function(s) to deploy. You can also bypass the prompt by passing the function ID directly:\n```bash\nappwrite deploy function --functionId my-function-id\n```\n*During deployment, the CLI zips your code (respecting the `ignore` array), uploads it to the Appwrite server, runs the `commands` to build the environment, and applies the settings from `appwrite.json`.*\n\n### Step 5: Execute and Test (Optional)\nYou can manually trigger the deployed function via the CLI to ensure it works:\n\n```bash\nappwrite functions createExecution --functionId my-function-id\n```\nYou can also pass custom data to the execution using the `--body` flag.", "correct": true, "score": 0.7, @@ -2743,7 +2743,7 @@ "choices": [ "Pushes code to a Git repository", "Uploads environment variables only", - "Deploys tracked resources (e.g. functions, collections) from appwrite.json to your Appwrite project", + "Deploys tracked resources (e.g. functions, collections) from appwrite.config.json to your Appwrite project", "Syncs local config with the server and overwrites server state" ], "correctAnswer": "C", @@ -2826,6 +2826,186 @@ "modelAnswer": "C", "correct": true, "score": 1 + }, + { + "questionId": "db-21", + "category": "databases", + "type": "mcq", + "question": "What are the minimum and maximum values for an integer attribute in Appwrite?", + "choices": [ + "-2147483648 to 2147483647 (32-bit signed integer)", + "-9223372036854775808 to 9223372036854775807 (64-bit signed integer)", + "0 to 18446744073709551615 (64-bit unsigned integer)", + "-999999999999 to 999999999999 (12-digit limit)" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "db-22", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid string-based attribute type in Appwrite databases?", + "choices": [ + "varchar", + "mediumtext", + "tinytext", + "longtext" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "db-23", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid format for a string attribute in Appwrite?", + "choices": [ + "uuid", + "email", + "url", + "enum" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-22", + "category": "cli", + "type": "mcq", + "question": "What does the appwrite types command do?", + "choices": [ + "Generates typed models for your Appwrite project's collections and attributes", + "Lists all data types supported by Appwrite databases", + "Converts documents between different data formats", + "Validates the types defined in appwrite.config.json" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-23", + "category": "cli", + "type": "mcq", + "question": "What does the --strict flag do in the appwrite types command?", + "choices": [ + "Enforces type-safe null checks in generated code", + "Throws errors for missing or invalid collection attributes", + "Automatically converts field names to follow language conventions", + "Disables generation of optional fields" + ], + "correctAnswer": "C", + "modelAnswer": "FAIL", + "correct": false, + "score": 0, + "modComment": "Model got stuck in an infinite thinking loop." + }, + { + "questionId": "cli-24", + "category": "cli", + "type": "mcq", + "question": "A function works locally but fails after pushing because environment variables are missing. What flag was likely missing from the push command?", + "choices": [ + "--env", + "--with-variables", + "--include-env", + "--push-variables" + ], + "correctAnswer": "B", + "modelAnswer": "FAIL", + "correct": false, + "score": 0, + "modComment": "Model got stuck in an infinite thinking loop." + }, + { + "questionId": "cli-27", + "category": "cli", + "type": "mcq", + "question": "What does the 'appwrite generate' command do?", + "choices": [ + "Generates a new Appwrite project from a template", + "Creates boilerplate code for functions and collections", + "Generates a type-safe SDK from your Appwrite project configuration", + "Generates API documentation for your project" + ], + "correctAnswer": "C", + "modelAnswer": "FAIL", + "correct": false, + "score": 0, + "modComment": "Model got stuck in an infinite thinking loop." + }, + { + "questionId": "cli-21", + "category": "cli", + "type": "mcq", + "question": "What happens if an Appwrite project contains an appwrite.json file but no appwrite.config.json?", + "choices": [ + "The CLI throws an error and requires appwrite.config.json", + "The CLI falls back to appwrite.json for legacy backwards compatibility", + "The CLI ignores it and uses default settings", + "The CLI automatically migrates appwrite.json to appwrite.config.json" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-25", + "category": "cli", + "type": "mcq", + "question": "When defining an attribute in appwrite.config.json, what happens if 'type' is 'string' or 'varchar' but 'size' is not defined?", + "choices": [ + "The attribute is created with a default size of 255", + "The attribute is created as an unlimited text field", + "The CLI automatically calculates the size based on sample data", + "The CLI throws a validation error because 'size' is required for string/varchar types" + ], + "correctAnswer": "D", + "modelAnswer": "D", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-26", + "category": "cli", + "type": "mcq", + "question": "In appwrite.config.json, when defining an attribute with 'required' set to true, what must the 'default' property be set to?", + "choices": [ + "The default can be any value matching the type", + "The default must be set to an empty string or 0", + "The default must be null", + "The default property is optional and can be omitted" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-28", + "category": "cli", + "type": "mcq", + "question": "What's the key difference between `appwrite run function` and `appwrite push function`?", + "choices": [ + "`run` executes locally with Docker emulation, `push` deploys to Appwrite cloud", + "`run` deploys to staging, `push` deploys to production", + "`run` is for testing, `push` is for CI/CD pipelines only", + "`run` requires internet connection, `push` works offline" + ], + "correctAnswer": "A", + "modelAnswer": "FAIL", + "correct": false, + "score": 0, + "modComment": "Model got stuck in an infinite thinking loop." } ] }, @@ -2837,24 +3017,24 @@ "scores": { "fundamental": 99.3, "auth": 99.7, - "databases": 100, + "databases": 91.3, "functions": 98.2, "storage": 93.5, "sites": 100, "messaging": 100, "realtime": 100, - "cli": 77.5 + "cli": 80.4 }, "mcqScores": { "fundamental": 100, "auth": 100, - "databases": 100, + "databases": 90, "functions": 100, "storage": 94.1, "sites": 100, "messaging": 100, "realtime": 100, - "cli": 76.5 + "cli": 80 }, "freeformScores": { "fundamental": 95, @@ -2867,12 +3047,12 @@ "realtime": 100, "cli": 83.3 }, - "overall": 96.5, - "mcqOverall": 96.8, + "overall": 95.1, + "mcqOverall": 95.2, "freeformOverall": 94.8, - "totalQuestions": 180, - "totalCorrect": 175, - "runDate": "2026-03-04T12:04:18.190Z", + "totalQuestions": 191, + "totalCorrect": 183, + "runDate": "2026-03-05T15:00:54.866Z", "questionDetails": [ { "questionId": "fund-1", @@ -5359,7 +5539,7 @@ "appwrite.config.js", ".appwriterc", "appwrite.yaml", - "appwrite.json" + "appwrite.config.json" ], "correctAnswer": "D", "modelAnswer": "D", @@ -5458,7 +5638,7 @@ "questionId": "cli-11", "category": "cli", "type": "mcq", - "question": "What command initializes the CLI with your Appwrite project and creates appwrite.json?", + "question": "What command initializes the CLI with your Appwrite project and creates appwrite.config.json?", "choices": [ "appwrite init project", "appwrite setup", @@ -5490,7 +5670,7 @@ "questionId": "cli-14", "category": "cli", "type": "mcq", - "question": "What does the appwrite.json file represent?", + "question": "What does the appwrite.config.json file represent?", "choices": [ "Only function configurations", "User credentials only", @@ -5590,7 +5770,7 @@ "choices": [ "Pushes code to a Git repository", "Uploads environment variables only", - "Deploys tracked resources (e.g. functions, collections) from appwrite.json to your Appwrite project", + "Deploys tracked resources (e.g. functions, collections) from appwrite.config.json to your Appwrite project", "Syncs local config with the server and overwrites server state" ], "correctAnswer": "C", @@ -5642,13 +5822,189 @@ "questionId": "cli-10", "category": "cli", "type": "free-form", - "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.json.", - "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", - "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", + "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.config.json.", + "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.config.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", + "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.config.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", "modelAnswer": "Here’s a practical **end-to-end CLI workflow** for Appwrite Functions.\n\n## 1) Install and authenticate CLI\n\n```bash\nnpm i -g appwrite-cli\nappwrite login\n```\n\nThen initialize (or link) your local folder to a project:\n\n```bash\nappwrite init project\n```\n\nThis creates/updates `appwrite.json` with your project linkage.\n\n---\n\n## 2) Create a Function scaffold\n\nUse the CLI wizard:\n\n```bash\nappwrite init function\n```\n\nYou’ll choose:\n- Function name / ID\n- Runtime (Node, Python, PHP, etc.)\n- Entrypoint\n- Build/install command\n- Local path\n\nThe CLI adds function metadata to `appwrite.json` and creates the function source folder.\n\n---\n\n## 3) Implement code locally\n\nInside the function folder:\n- Add your function code at the configured entrypoint.\n- Add dependencies (`package.json`, `requirements.txt`, etc.).\n- Make sure the build command in config installs dependencies correctly.\n\n---\n\n## 4) Configure `appwrite.json` (key options)\n\nA typical function block includes options like:\n\n```json\n{\n \"functions\": [\n {\n \"$id\": \"my-function\",\n \"name\": \"My Function\",\n \"runtime\": \"node-18.0\",\n \"path\": \"functions/my-function\",\n \"entrypoint\": \"src/main.js\",\n \"commands\": \"npm install\",\n \"ignore\": [\"node_modules\", \".git\"],\n \"enabled\": true,\n \"execute\": [\"any\"],\n \"events\": [],\n \"schedule\": \"\",\n \"timeout\": 15,\n \"logging\": true\n }\n ]\n}\n```\n\n### What each key controls\n- **`$id`**: unique function ID in Appwrite.\n- **`runtime`**: language/runtime image used for build + execution.\n- **`path`**: local directory containing function code.\n- **`entrypoint`**: file Appwrite runs.\n- **`commands`**: build/install command run during deployment.\n- **`ignore`**: excluded files from upload.\n- **`enabled`**: on/off switch.\n- **`execute`**: who can execute (`any`, users/teams, etc.).\n- **`events`**: event triggers (DB/file/auth events, etc.).\n- **`schedule`**: cron expression for scheduled runs.\n- **`timeout`**: max execution time (seconds).\n- **`logging`**: whether execution logs are stored.\n\n---\n\n## 5) Deploy\n\nDepending on CLI version, use one of these patterns:\n\n```bash\nappwrite deploy function\n```\n\nor push synced resources/deployments:\n\n```bash\nappwrite push functions\n```\n\nDeployment flow:\n1. CLI packages function code (`path` minus `ignore`)\n2. Uploads to Appwrite\n3. Runs `commands` in build environment\n4. Creates a new deployment and activates it\n\n---\n\n## 6) Test and verify\n\n- Trigger manually from Console or via API/SDK execution call.\n- Check function logs and deployment status in Console or CLI.\n- Iterate: edit code/config → redeploy.\n\n---\n\n## 7) Typical production best practices\n\n- Keep secrets in Appwrite Function variables (not hardcoded).\n- Use precise `execute` permissions (avoid broad `any` unless needed).\n- Pin runtime versions.\n- Keep `ignore` clean to reduce deployment size/time.\n- Use event triggers + schedules intentionally to avoid noisy invocations.\n\nIf you want, I can also give you a **ready-to-copy `appwrite.json` for Node/Python** with event trigger and cron schedule examples.", "correct": true, "score": 0.95, "judgeReasoning": "The answer covers all 5 required rubric points: 1) appwrite init function to scaffold the function, 2) runtime selection during the wizard, 3) detailed appwrite.json configuration options including name, runtime, execute permissions, variables, schedule, events, timeout, etc., 4) local development (though 'appwrite run function' specifically isn't mentioned, local development workflow is described), 5) deployment with 'appwrite push functions' (also mentions 'appwrite deploy function'). The only minor gap is that 'appwrite run function' for local development isn't explicitly called out by that exact command name - the answer describes implementing code locally but doesn't mention the specific 'appwrite run function' command for local testing. Otherwise the answer is comprehensive and accurate." + }, + { + "questionId": "db-21", + "category": "databases", + "type": "mcq", + "question": "What are the minimum and maximum values for an integer attribute in Appwrite?", + "choices": [ + "-2147483648 to 2147483647 (32-bit signed integer)", + "-9223372036854775808 to 9223372036854775807 (64-bit signed integer)", + "0 to 18446744073709551615 (64-bit unsigned integer)", + "-999999999999 to 999999999999 (12-digit limit)" + ], + "correctAnswer": "B", + "modelAnswer": "A", + "correct": false, + "score": 0 + }, + { + "questionId": "db-22", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid string-based attribute type in Appwrite databases?", + "choices": [ + "varchar", + "mediumtext", + "tinytext", + "longtext" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "db-23", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid format for a string attribute in Appwrite?", + "choices": [ + "uuid", + "email", + "url", + "enum" + ], + "correctAnswer": "A", + "modelAnswer": "D", + "correct": false, + "score": 0 + }, + { + "questionId": "cli-21", + "category": "cli", + "type": "mcq", + "question": "What happens if an Appwrite project contains an appwrite.json file but no appwrite.config.json?", + "choices": [ + "The CLI throws an error and requires appwrite.config.json", + "The CLI falls back to appwrite.json for legacy backwards compatibility", + "The CLI ignores it and uses default settings", + "The CLI automatically migrates appwrite.json to appwrite.config.json" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-22", + "category": "cli", + "type": "mcq", + "question": "What does the appwrite types command do?", + "choices": [ + "Generates typed models for your Appwrite project's collections and attributes", + "Lists all data types supported by Appwrite databases", + "Converts documents between different data formats", + "Validates the types defined in appwrite.config.json" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-23", + "category": "cli", + "type": "mcq", + "question": "What does the --strict flag do in the appwrite types command?", + "choices": [ + "Enforces type-safe null checks in generated code", + "Throws errors for missing or invalid collection attributes", + "Automatically converts field names to follow language conventions", + "Disables generation of optional fields" + ], + "correctAnswer": "C", + "modelAnswer": "B", + "correct": false, + "score": 0 + }, + { + "questionId": "cli-24", + "category": "cli", + "type": "mcq", + "question": "A function works locally but fails after pushing because environment variables are missing. What flag was likely missing from the push command?", + "choices": [ + "--env", + "--with-variables", + "--include-env", + "--push-variables" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-25", + "category": "cli", + "type": "mcq", + "question": "When defining an attribute in appwrite.config.json, what happens if 'type' is 'string' or 'varchar' but 'size' is not defined?", + "choices": [ + "The attribute is created with a default size of 255", + "The attribute is created as an unlimited text field", + "The CLI automatically calculates the size based on sample data", + "The CLI throws a validation error because 'size' is required for string/varchar types" + ], + "correctAnswer": "D", + "modelAnswer": "D", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-26", + "category": "cli", + "type": "mcq", + "question": "In appwrite.config.json, when defining an attribute with 'required' set to true, what must the 'default' property be set to?", + "choices": [ + "The default can be any value matching the type", + "The default must be set to an empty string or 0", + "The default must be null", + "The default property is optional and can be omitted" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-27", + "category": "cli", + "type": "mcq", + "question": "What does the 'appwrite generate' command do?", + "choices": [ + "Generates a new Appwrite project from a template", + "Creates boilerplate code for functions and collections", + "Generates a type-safe SDK from your Appwrite project configuration", + "Generates API documentation for your project" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-28", + "category": "cli", + "type": "mcq", + "question": "What's the key difference between `appwrite run function` and `appwrite push function`?", + "choices": [ + "`run` executes locally with Docker emulation, `push` deploys to Appwrite cloud", + "`run` deploys to staging, `push` deploys to production", + "`run` is for testing, `push` is for CI/CD pipelines only", + "`run` requires internet connection, `push` works offline" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 } ] }, @@ -5660,24 +6016,24 @@ "scores": { "fundamental": 100, "auth": 100, - "databases": 95, + "databases": 95.7, "functions": 95, "storage": 99.7, "sites": 100, "messaging": 100, "realtime": 100, - "cli": 88.5 + "cli": 84.6 }, "mcqScores": { "fundamental": 100, "auth": 100, - "databases": 94.1, + "databases": 95, "functions": 94.1, "storage": 100, "sites": 100, "messaging": 100, "realtime": 100, - "cli": 94.1 + "cli": 88 }, "freeformScores": { "fundamental": 100, @@ -5690,12 +6046,12 @@ "realtime": 100, "cli": 56.7 }, - "overall": 97.6, - "mcqOverall": 98.1, + "overall": 96.7, + "mcqOverall": 97, "freeformOverall": 94.8, - "totalQuestions": 180, - "totalCorrect": 176, - "runDate": "2026-03-04T12:04:18.190Z", + "totalQuestions": 191, + "totalCorrect": 185, + "runDate": "2026-03-05T15:00:54.867Z", "questionDetails": [ { "questionId": "fund-1", @@ -8186,7 +8542,7 @@ "appwrite.config.js", ".appwriterc", "appwrite.yaml", - "appwrite.json" + "appwrite.config.json" ], "correctAnswer": "D", "modelAnswer": "D", @@ -8313,7 +8669,7 @@ "questionId": "cli-11", "category": "cli", "type": "mcq", - "question": "What command initializes the CLI with your Appwrite project and creates appwrite.json?", + "question": "What command initializes the CLI with your Appwrite project and creates appwrite.config.json?", "choices": [ "appwrite init project", "appwrite setup", @@ -8361,7 +8717,7 @@ "questionId": "cli-14", "category": "cli", "type": "mcq", - "question": "What does the appwrite.json file represent?", + "question": "What does the appwrite.config.json file represent?", "choices": [ "Only function configurations", "User credentials only", @@ -8413,7 +8769,7 @@ "choices": [ "Pushes code to a Git repository", "Uploads environment variables only", - "Deploys tracked resources (e.g. functions, collections) from appwrite.json to your Appwrite project", + "Deploys tracked resources (e.g. functions, collections) from appwrite.config.json to your Appwrite project", "Syncs local config with the server and overwrites server state" ], "correctAnswer": "C", @@ -8465,13 +8821,189 @@ "questionId": "cli-10", "category": "cli", "type": "free-form", - "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.json.", - "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", - "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", + "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.config.json.", + "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.config.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", + "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.config.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", "modelAnswer": "# Complete Workflow for Appwrite Functions via CLI\n\n## 1. Initialize Your Project\n\n```bash\n# Login to Appwrite\nappwrite login\n\n# Initialize the project (links to your Appwrite project)\nappwrite init project\n```\n\n## 2. Create a Function\n\n```bash\nappwrite init function\n```\n\nThis interactive command prompts you for:\n- **Function ID** (or auto-generated)\n- **Function name**\n- **Runtime** (e.g., `node-18.0`, `python-3.9`, `dart-2.18`, etc.)\n\nThis scaffolds a function directory with starter code and updates `appwrite.json`.\n\n## 3. Understanding `appwrite.json` Configuration\n\n```json\n{\n \"projectId\": \"your-project-id\",\n \"projectName\": \"My Project\",\n \"functions\": [\n {\n \"functionId\": \"my-function\",\n \"name\": \"My Function\",\n \"runtime\": \"node-18.0\",\n \"execute\": [\"any\"],\n \"events\": [\"databases.*.collections.*.documents.*.create\"],\n \"schedule\": \"0 */6 * * *\",\n \"timeout\": 15,\n \"enabled\": true,\n \"logging\": true,\n \"entrypoint\": \"src/main.js\",\n \"commands\": \"npm install\",\n \"path\": \"functions/my-function\",\n \"scopes\": [\"databases.read\", \"databases.write\"],\n \"variables\": {\n \"API_KEY\": \"your-api-key\",\n \"CUSTOM_VAR\": \"some-value\"\n }\n }\n ]\n}\n```\n\n### Key Configuration Options Explained\n\n| Option | Description |\n|---|---|\n| `functionId` | Unique identifier for the function |\n| `name` | Human-readable display name |\n| `runtime` | Language runtime and version |\n| `execute` | Execution permissions (`[\"any\"]`, `[\"users\"]`, specific roles) |\n| `events` | System events that trigger the function |\n| `schedule` | CRON expression for scheduled execution |\n| `timeout` | Max execution time in seconds (1–900) |\n| `enabled` | Whether the function is active |\n| `logging` | Enable/disable execution logging |\n| `entrypoint` | Path to the main file relative to the function directory |\n| `commands` | Build commands run during deployment (e.g., `npm install`) |\n| `path` | Local directory path containing the function code |\n| `scopes` | API permissions granted to the function's server context |\n| `variables` | Environment variables as key-value pairs |\n\n## 4. Develop Your Function\n\nEdit the entrypoint file (e.g., `functions/my-function/src/main.js`):\n\n```javascript\nexport default async ({ req, res, log, error }) => {\n log('Function invoked!');\n\n // Access request data\n const payload = req.body;\n const headers = req.headers;\n const method = req.method;\n\n // Access environment variables\n const apiKey = process.env.API_KEY;\n\n // Return a response\n return res.json({\n message: 'Hello from Appwrite Function!',\n payload,\n });\n};\n```\n\n## 5. Deploy the Function\n\n```bash\n# Deploy all functions defined in appwrite.json\nappwrite deploy function\n\n# Deploy a specific function (interactive selection)\nappwrite deploy function\n```\n\nThe CLI will:\n1. **Package** the function source from the `path` directory\n2. **Run build commands** specified in `commands`\n3. **Upload** the deployment to your Appwrite instance\n4. **Activate** the new deployment automatically\n\n## 6. Test & Execute\n\n```bash\n# Execute the function via CLI\nappwrite functions create-execution \\\n --function-id=\"my-function\" \\\n --body='{\"key\": \"value\"}' \\\n --async=false \\\n --method=\"POST\"\n```\n\n## 7. Monitor & Debug\n\n```bash\n# List executions\nappwrite functions list-executions --function-id=\"my-function\"\n\n# Get a specific execution (includes logs and response)\nappwrite functions get-execution \\\n --function-id=\"my-function\" \\\n --execution-id=\"execution-id\"\n```\n\n## Full Lifecycle Summary\n\n```\nappwrite login\n → appwrite init project\n → appwrite init function\n → Edit appwrite.json (events, schedule, variables, permissions)\n → Write function code\n → appwrite deploy function\n → appwrite functions create-execution (test)\n → Monitor via list-executions / console\n```\n\n## Tips\n\n- **Redeployment**: Run `appwrite deploy function` again after any code or config changes.\n- **Multiple functions**: `appwrite.json` supports an array of functions; deploy selectively or all at once.\n- **Local development**: Use the Appwrite CLI's local runtime or test logic independently before deploying.\n- **Version control**: Commit `appwrite.json` alongside your function code, but keep sensitive variables in Appwrite's console or use `.env` files excluded from VCS.", "correct": true, "score": 0.7, "judgeReasoning": "The answer covers most of the required elements: 1) appwrite init function to scaffold ✓, 2) Runtime selection ✓, 3) appwrite.json configuration options with detailed explanation ✓, 4) Local development is only briefly mentioned in tips without the specific 'appwrite run function' command ✗, 5) Deployment uses 'appwrite deploy function' instead of the correct 'appwrite push functions' command ✗. The answer is comprehensive and detailed but misses two key rubric points: the local development command 'appwrite run function' is not mentioned (only vaguely referenced in tips), and the deployment command given is 'appwrite deploy function' rather than 'appwrite push functions'. These are specific CLI command differences that matter for accuracy." + }, + { + "questionId": "db-21", + "category": "databases", + "type": "mcq", + "question": "What are the minimum and maximum values for an integer attribute in Appwrite?", + "choices": [ + "-2147483648 to 2147483647 (32-bit signed integer)", + "-9223372036854775808 to 9223372036854775807 (64-bit signed integer)", + "0 to 18446744073709551615 (64-bit unsigned integer)", + "-999999999999 to 999999999999 (12-digit limit)" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "db-22", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid string-based attribute type in Appwrite databases?", + "choices": [ + "varchar", + "mediumtext", + "tinytext", + "longtext" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "db-23", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid format for a string attribute in Appwrite?", + "choices": [ + "uuid", + "email", + "url", + "enum" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-21", + "category": "cli", + "type": "mcq", + "question": "What happens if an Appwrite project contains an appwrite.json file but no appwrite.config.json?", + "choices": [ + "The CLI throws an error and requires appwrite.config.json", + "The CLI falls back to appwrite.json for legacy backwards compatibility", + "The CLI ignores it and uses default settings", + "The CLI automatically migrates appwrite.json to appwrite.config.json" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-22", + "category": "cli", + "type": "mcq", + "question": "What does the appwrite types command do?", + "choices": [ + "Generates typed models for your Appwrite project's collections and attributes", + "Lists all data types supported by Appwrite databases", + "Converts documents between different data formats", + "Validates the types defined in appwrite.config.json" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-23", + "category": "cli", + "type": "mcq", + "question": "What does the --strict flag do in the appwrite types command?", + "choices": [ + "Enforces type-safe null checks in generated code", + "Throws errors for missing or invalid collection attributes", + "Automatically converts field names to follow language conventions", + "Disables generation of optional fields" + ], + "correctAnswer": "C", + "modelAnswer": "B", + "correct": false, + "score": 0 + }, + { + "questionId": "cli-24", + "category": "cli", + "type": "mcq", + "question": "A function works locally but fails after pushing because environment variables are missing. What flag was likely missing from the push command?", + "choices": [ + "--env", + "--with-variables", + "--include-env", + "--push-variables" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-25", + "category": "cli", + "type": "mcq", + "question": "When defining an attribute in appwrite.config.json, what happens if 'type' is 'string' or 'varchar' but 'size' is not defined?", + "choices": [ + "The attribute is created with a default size of 255", + "The attribute is created as an unlimited text field", + "The CLI automatically calculates the size based on sample data", + "The CLI throws a validation error because 'size' is required for string/varchar types" + ], + "correctAnswer": "D", + "modelAnswer": "D", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-26", + "category": "cli", + "type": "mcq", + "question": "In appwrite.config.json, when defining an attribute with 'required' set to true, what must the 'default' property be set to?", + "choices": [ + "The default can be any value matching the type", + "The default must be set to an empty string or 0", + "The default must be null", + "The default property is optional and can be omitted" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-27", + "category": "cli", + "type": "mcq", + "question": "What does the 'appwrite generate' command do?", + "choices": [ + "Generates a new Appwrite project from a template", + "Creates boilerplate code for functions and collections", + "Generates a type-safe SDK from your Appwrite project configuration", + "Generates API documentation for your project" + ], + "correctAnswer": "C", + "modelAnswer": "B", + "correct": false, + "score": 0 + }, + { + "questionId": "cli-28", + "category": "cli", + "type": "mcq", + "question": "What's the key difference between `appwrite run function` and `appwrite push function`?", + "choices": [ + "`run` executes locally with Docker emulation, `push` deploys to Appwrite cloud", + "`run` deploys to staging, `push` deploys to production", + "`run` is for testing, `push` is for CI/CD pipelines only", + "`run` requires internet connection, `push` works offline" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 } ] }, @@ -8483,24 +9015,24 @@ "scores": { "fundamental": 99.7, "auth": 99.7, - "databases": 94.3, + "databases": 95, "functions": 93.2, "storage": 95, "sites": 100, "messaging": 99.5, "realtime": 90, - "cli": 76 + "cli": 79.3 }, "mcqScores": { "fundamental": 100, "auth": 100, - "databases": 94.1, + "databases": 95, "functions": 94.1, "storage": 94.1, "sites": 100, "messaging": 100, "realtime": 88.2, - "cli": 76.5 + "cli": 80 }, "freeformScores": { "fundamental": 98.3, @@ -8513,12 +9045,12 @@ "realtime": 100, "cli": 73.3 }, - "overall": 94.2, - "mcqOverall": 94.2, + "overall": 94, + "mcqOverall": 93.9, "freeformOverall": 94.2, - "totalQuestions": 180, - "totalCorrect": 171, - "runDate": "2026-03-04T12:04:18.191Z", + "totalQuestions": 191, + "totalCorrect": 181, + "runDate": "2026-03-05T15:00:54.867Z", "questionDetails": [ { "questionId": "fund-1", @@ -11001,7 +11533,7 @@ "appwrite.config.js", ".appwriterc", "appwrite.yaml", - "appwrite.json" + "appwrite.config.json" ], "correctAnswer": "D", "modelAnswer": "D", @@ -11104,7 +11636,7 @@ "questionId": "cli-11", "category": "cli", "type": "mcq", - "question": "What command initializes the CLI with your Appwrite project and creates appwrite.json?", + "question": "What command initializes the CLI with your Appwrite project and creates appwrite.config.json?", "choices": [ "appwrite init project", "appwrite setup", @@ -11120,7 +11652,7 @@ "questionId": "cli-14", "category": "cli", "type": "mcq", - "question": "What does the appwrite.json file represent?", + "question": "What does the appwrite.config.json file represent?", "choices": [ "Only function configurations", "User credentials only", @@ -11216,9 +11748,9 @@ "questionId": "cli-10", "category": "cli", "type": "free-form", - "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.json.", - "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", - "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", + "question": "Describe the complete workflow for creating, configuring, and deploying an Appwrite Function using the CLI. Include key configuration options in appwrite.config.json.", + "correctAnswer": "Run appwrite init function to scaffold, choose runtime and template, configure appwrite.config.json with function settings (name, runtime, execute permissions, variables, schedule, etc.), develop locally with appwrite run function, then deploy with appwrite push functions.", + "rubric": "Must mention: 1) appwrite init function to scaffold, 2) Runtime selection, 3) appwrite.config.json configuration options, 4) Local development with appwrite run function, 5) Deployment with appwrite push functions", "modelAnswer": "Here's the complete workflow for Appwrite Functions using the CLI:\n\n## 1. Prerequisites\n```bash\n# Install and login\nnpm install -g appwrite-cli\nappwrite login\nappwrite init project # Select or create project\n```\n\n## 2. Initialize Function\n```bash\nappwrite init function\n# Select runtime (e.g., node-18.0, python-3.9, dart-3.0)\n# Creates: functions/[function-name]/ directory with starter code\n```\n\n## 3. Configure appwrite.json\n\nThe CLI generates/updates `appwrite.json` at project root. Key configuration options:\n\n```json\n{\n \"projectId\": \"demo\",\n \"projectName\": \"Demo Project\",\n \"functions\": [\n {\n \"$id\": \"processOrder\",\n \"name\": \"Process Order\",\n \"runtime\": \"node-18.0\",\n \"entrypoint\": \"src/main.js\",\n \"commands\": \"npm install\",\n \n \"execute\": [\"users\", \"guests\", \"role:admin\"],\n \"events\": [\"databases.*.collections.*.documents.*.create\"],\n \"schedule\": \"0 9 * * *\",\n \"timeout\": 30,\n \n \"enabled\": true,\n \"logging\": true,\n \"scopes\": [\"users.read\", \"databases.write\", \"storage.read\"]\n }\n ]\n}\n```\n\n**Key Configuration Options:**\n\n- **`$id`**: Unique function identifier (auto-generated if omitted)\n- **`runtime`**: Environment (node-18.0, python-3.9, php-8.2, etc.)\n- **`entrypoint`**: Main file to execute (e.g., `src/index.js`, `main.py`)\n- **`commands`**: Build command (install dependencies, compile)\n- **`execute`**: Execution permissions (roles/IDs allowed to trigger)\n- **`events`**: Database/webhook triggers (e.g., `databases.*.collections.users.documents.*.create`)\n- **`schedule`**: CRON expression for scheduled execution\n- **`timeout`**: Max execution time in seconds (1-900)\n- **`scopes`**: Function's service permissions (users.read, databases.write, storage.read, etc.)\n\n## 4. Local Development\n```bash\n# Structure\nfunctions/\n processOrder/\n src/\n main.js\n package.json\n README.md\n\n# Local testing (optional)\nappwrite run function --function-id=processOrder\n```\n\n## 5. Deploy\n```bash\n# Deploy specific function\nappwrite deploy function --function-id=processOrder\n\n# Deploy all functions\nappwrite deploy function\n\n# Force deploy without confirmation\nappwrite deploy function --yes\n```\n\n## 6. Execution Methods\n\n**Via Console:**\n```bash\nappwrite functions createExecution --function-id=processOrder --data='{\"key\":\"value\"}'\n```\n\n**Via SDK (Client/Server):**\n```javascript\nconst execution = await functions.createExecution('processOrder', JSON.stringify(data));\n```\n\n**Via HTTP:**\n```\nPOST /v1/functions/{functionId}/executions\n```\n\n## Pro Tips\n\n- **Environment Variables**: Set via Console/CLI: `appwrite functions createVariable --function-id=processOrder --key=API_KEY --value=secret`\n- **Live Reload**: Use `appwrite run function` for local development with hot-reload\n- **Dependencies**: Include `package.json`, `requirements.txt`, etc.; the `commands` field runs during build\n- **Cold Starts**: Minimize by keeping dependencies lightweight; use `scopes` minimally to reduce JWT size\n\nThe function becomes active immediately after deployment and responds to HTTP requests, events, or schedules based on your configuration.", "correct": true, "score": 0.85, @@ -11232,7 +11764,7 @@ "choices": [ "Pushes code to a Git repository", "Uploads environment variables only", - "Deploys tracked resources (e.g. functions, collections) from appwrite.json to your Appwrite project", + "Deploys tracked resources (e.g. functions, collections) from appwrite.config.json to your Appwrite project", "Syncs local config with the server and overwrites server state" ], "correctAnswer": "C", @@ -11295,6 +11827,182 @@ "modelAnswer": " A", "correct": true, "score": 1 + }, + { + "questionId": "db-21", + "category": "databases", + "type": "mcq", + "question": "What are the minimum and maximum values for an integer attribute in Appwrite?", + "choices": [ + "-2147483648 to 2147483647 (32-bit signed integer)", + "-9223372036854775808 to 9223372036854775807 (64-bit signed integer)", + "0 to 18446744073709551615 (64-bit unsigned integer)", + "-999999999999 to 999999999999 (12-digit limit)" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "db-22", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid string-based attribute type in Appwrite databases?", + "choices": [ + "varchar", + "mediumtext", + "tinytext", + "longtext" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "db-23", + "category": "databases", + "type": "mcq", + "question": "Which of the following is NOT a valid format for a string attribute in Appwrite?", + "choices": [ + "uuid", + "email", + "url", + "enum" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-21", + "category": "cli", + "type": "mcq", + "question": "What happens if an Appwrite project contains an appwrite.json file but no appwrite.config.json?", + "choices": [ + "The CLI throws an error and requires appwrite.config.json", + "The CLI falls back to appwrite.json for legacy backwards compatibility", + "The CLI ignores it and uses default settings", + "The CLI automatically migrates appwrite.json to appwrite.config.json" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-22", + "category": "cli", + "type": "mcq", + "question": "What does the appwrite types command do?", + "choices": [ + "Generates typed models for your Appwrite project's collections and attributes", + "Lists all data types supported by Appwrite databases", + "Converts documents between different data formats", + "Validates the types defined in appwrite.config.json" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-23", + "category": "cli", + "type": "mcq", + "question": "What does the --strict flag do in the appwrite types command?", + "choices": [ + "Enforces type-safe null checks in generated code", + "Throws errors for missing or invalid collection attributes", + "Automatically converts field names to follow language conventions", + "Disables generation of optional fields" + ], + "correctAnswer": "C", + "modelAnswer": "B", + "correct": false, + "score": 0 + }, + { + "questionId": "cli-24", + "category": "cli", + "type": "mcq", + "question": "A function works locally but fails after pushing because environment variables are missing. What flag was likely missing from the push command?", + "choices": [ + "--env", + "--with-variables", + "--include-env", + "--push-variables" + ], + "correctAnswer": "B", + "modelAnswer": "B", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-25", + "category": "cli", + "type": "mcq", + "question": "When defining an attribute in appwrite.config.json, what happens if 'type' is 'string' or 'varchar' but 'size' is not defined?", + "choices": [ + "The attribute is created with a default size of 255", + "The attribute is created as an unlimited text field", + "The CLI automatically calculates the size based on sample data", + "The CLI throws a validation error because 'size' is required for string/varchar types" + ], + "correctAnswer": "D", + "modelAnswer": "D", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-26", + "category": "cli", + "type": "mcq", + "question": "In appwrite.config.json, when defining an attribute with 'required' set to true, what must the 'default' property be set to?", + "choices": [ + "The default can be any value matching the type", + "The default must be set to an empty string or 0", + "The default must be null", + "The default property is optional and can be omitted" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-27", + "category": "cli", + "type": "mcq", + "question": "What does the 'appwrite generate' command do?", + "choices": [ + "Generates a new Appwrite project from a template", + "Creates boilerplate code for functions and collections", + "Generates a type-safe SDK from your Appwrite project configuration", + "Generates API documentation for your project" + ], + "correctAnswer": "C", + "modelAnswer": "C", + "correct": true, + "score": 1 + }, + { + "questionId": "cli-28", + "category": "cli", + "type": "mcq", + "question": "What's the key difference between `appwrite run function` and `appwrite push function`?", + "choices": [ + "`run` executes locally with Docker emulation, `push` deploys to Appwrite cloud", + "`run` deploys to staging, `push` deploys to production", + "`run` is for testing, `push` is for CI/CD pipelines only", + "`run` requires internet connection, `push` works offline" + ], + "correctAnswer": "A", + "modelAnswer": "A", + "correct": true, + "score": 1 } ] } diff --git a/src/lib/types.ts b/src/lib/types.ts index eb08602..fdf262f 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -10,6 +10,7 @@ export interface QuestionDetail { correct: boolean; score: number; judgeReasoning?: string; + modComment?: string; } export interface BenchmarkResults {