{"id":25191415,"url":"https://github.com/lukas-heinrich/appwrite-function-tools","last_synced_at":"2026-02-10T03:31:38.053Z","repository":{"id":276641649,"uuid":"929869477","full_name":"lukas-heinrich/appwrite-function-tools","owner":"lukas-heinrich","description":"A collection of utility functions and type definitions for Appwrite functions","archived":false,"fork":false,"pushed_at":"2025-02-09T16:00:19.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T12:06:09.885Z","etag":null,"topics":["appwrite","appwrite-function"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukas-heinrich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-09T15:43:25.000Z","updated_at":"2025-02-09T16:00:27.000Z","dependencies_parsed_at":"2025-02-09T16:45:49.611Z","dependency_job_id":null,"html_url":"https://github.com/lukas-heinrich/appwrite-function-tools","commit_stats":null,"previous_names":["lukas-heinrich/appwrite-function-tools","lukas-heinrich/appwrite-function-utils"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukas-heinrich%2Fappwrite-function-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukas-heinrich%2Fappwrite-function-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukas-heinrich%2Fappwrite-function-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukas-heinrich%2Fappwrite-function-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukas-heinrich","download_url":"https://codeload.github.com/lukas-heinrich/appwrite-function-tools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247176169,"owners_count":20896428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appwrite","appwrite-function"],"created_at":"2025-02-09T22:21:13.566Z","updated_at":"2026-02-10T03:31:37.956Z","avatar_url":"https://github.com/lukas-heinrich.png","language":"TypeScript","readme":"# Appwrite Functions Tools\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n![Appwrite Version](https://img.shields.io/badge/Appwrite_Version-1.6.0-red)\n\nA TypeScript utility library for [Appwrite Functions](https://appwrite.io/docs/products/functions), providing type\ndefinitions and utilities to interact with requests and handle errors.\n\n⚠️ This package was designed to be used in different runtimes, but it has only been tested using `bun-1.0`. If you\nnotice any problems feel free to create a pull request.\n\n## Features\n\n- 🦺 Type definitions for Appwrite Functions\n- 🛠️ Error handling utilities\n- 🔍 Request validation utilities\n- 📦 Lightweight path-based router using [route-recognizer](https://www.npmjs.com/package/route-recognizer)\n\n## Usage\n\n### Installation\n\n```bash\n# npm\nnpm install appwrite-function-tools\n\n# pnpm\npnpm add appwrite-function-tools\n\n# bun\nbun add appwrite-function-tools\n```\n\n### Type Definitions\n\nSee the following example based on the appwrite starter function for a basic usage of the type definitions:\n\n```ts\nimport { FunctionEntrypoint } from 'appwrite-function-tools';\n\nexport default async ({ req, res, log, error }: FunctionEntrypoint) =\u003e {\n\t// ⬇️ Type Safe access to the request, response, logger and error handler\n\t// You can use the Appwrite SDK to interact with other services\n\t// For this example, we're using the Users service\n\tconst client = new Client()\n\t\t.setEndpoint(Bun.env['APPWRITE_FUNCTION_API_ENDPOINT']) // ⬅️ Type Safe access to the environment variables\n\t\t.setProject(Bun.env['APPWRITE_FUNCTION_PROJECT_ID'])\n\t\t.setKey(req.headers['x-appwrite-key'] ?? '');\n\tconst users = new Users(client);\n\n\ttry {\n\t\tconst response = await users.list();\n\t\t// Log messages and errors to the Appwrite Console\n\t\t// These logs won't be seen by your end users\n\t\tlog(`Total users: ${response.total}`);\n\t} catch (err) {\n\t\terror('Could not list users: ' + asError(err).message); // ⬅️ Type Safe error handling\n\t}\n\n\t// The req object contains the request data\n\tif (req.path === '/ping') {\n\t\t// Use res object to respond with text(), json(), or binary()\n\t\t// Don't forget to return a response!\n\t\treturn res.text('Pong');\n\t}\n\n\treturn res.json({\n\t\tmotto: 'Build like a team of hundreds_',\n\t\tlearn: 'https://appwrite.io/docs',\n\t\tconnect: 'https://appwrite.io/discord',\n\t\tgetInspired: 'https://builtwith.appwrite.io',\n\t});\n};\n```\n\nTo use the global types, you need to create a `global.d.ts` file in the root of your project. You may want to use it to\ndeclare the environment variables or provide type safety for the Appwrite functions runtime without importing the types.\n\n```ts\nimport type { FunctionEnvironment } from 'appwrite-function-tools';\n\n// Declare Bun environment variables for the Appwrite functions runtime\ndeclare module 'bun' {\n\tinterface Env extends FunctionEnvironment {}\n}\n\nexport {};\n```\n\n### Validation and Routing\n\n... Coming Soon\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukas-heinrich%2Fappwrite-function-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukas-heinrich%2Fappwrite-function-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukas-heinrich%2Fappwrite-function-tools/lists"}