appwrite/sdk-for-web là dự án tập trung giao diện trên GitHub với 336 sao, viết chủ yếu bằng TypeScript. [READ-ONLY] Official Appwrite Web SDK 🧡
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
This SDK targets Appwrite server version 2.7.x as shipped on Appwrite Cloud. Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from previous releases when APIs differ.
Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Web SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to https://appwrite.io/docs
Installation
npm
npm install appwrite
Import the modules you need. The package ships ES modules, CommonJS and TypeScript types:
import { Client, Account } from 'appwrite';
CDN
Every release is published to https://sdk.appwrite.io/web/29.3.0-rc.1/.
ES modules
Each service, helper and enum is its own module, so the browser downloads only what you import. A service is served under its name in kebab case, such as TablesDB from tables-db.js, and enums under enums/, such as OAuthProvider from enums/o-auth-provider.js. index.js re-exports everything, so importing it loads every service:
<script type="module">
import { Client } from 'https://sdk.appwrite.io/web/29.3.0-rc.1/client.js';
import { Account } from 'https://sdk.appwrite.io/web/29.3.0-rc.1/account.js';
import { OAuthProvider } from 'https://sdk.appwrite.io/web/29.3.0-rc.1/enums/o-auth-provider.js';
</script>
Script tag
Add the script before any code that uses the SDK. It exposes every export on the global Appwrite object:
integrity.json in the same directory maps each .js file to its sha384- hash. An integrity attribute checks only the file it is set on. sdk.min.js is a single file, so its hash as the integrity attribute, together with crossorigin="anonymous", covers the whole SDK. ES modules import other modules and shared chunks, so supply their hashes through the integrity field of an import map to cover those too.
jsDelivr
The script tag build is also available from jsDelivr:
In the Appwrite Console, open your project and under Add a platform choose Web app. Enter the hostname your app runs on: localhost for local development, and your production domain once you deploy. Appwrite only accepts browser requests from hostnames registered as platforms, so a missing hostname shows up as a CORS error.
Initialize the client
Copy your endpoint and project ID from your project's Settings page.
import { Client } from 'appwrite';
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');
For a self-hosted Appwrite, use https://<HOSTNAME>/v1 as the endpoint.
Make your first request
Create a service from the client and call any of its methods. Every method takes a single object of named parameters and returns a promise. See the API reference for every service and method.
import { Account, ID } from 'appwrite';
const account = new Account(client);
const user = await account.create({
userId: ID.unique(),
email: '[email protected]',
password: 'password',
name: "Walter O'Brien",
});
console.log(user);
Sign in with OAuth
Enable the provider in the Console under Auth > Settings, then redirect the user to it. The success and failure URLs must be on a hostname you registered as a platform.
import { Account, OAuthProvider } from 'appwrite';
const account = new Account(client);
account.createOAuth2Session({
provider: OAuthProvider.Github,
success: 'https://example.com/success',
failure: 'https://example.com/failure',
});
Type safety with models
Methods that return rows, such as listRows and getRow, accept a type parameter for your own row shape:
import { TablesDB, type Models } from 'appwrite';
interface Book extends Models.Row {
name: string;
author: string;
releaseYear?: string;
genre?: string[];
isCheckedOut: boolean;
}
const tablesDB = new TablesDB(client);
const result = await tablesDB.listRows<Book>({
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
});
for (const book of result.rows) {
console.log(`${book.name} by ${book.author}`);
}
In JavaScript, the same types are available through JSDoc:
The Appwrite CLI can generate these interfaces from your database schema with appwrite types. See type generation.
Error handling
Failed requests throw an AppwriteException with message, code, type and response properties.
import { AppwriteException } from 'appwrite';
try {
const user = await account.get();
console.log(user);
} catch (error) {
if (error instanceof AppwriteException) {
console.error(error.code, error.type, error.message);
}
}
The response codes page lists every error type.
Learn more
Web quick start
Appwrite docs
Discord community
Web playground
Contribution
This library is auto-generated by the Appwrite SDK Generator. To learn more about how you can help us improve this SDK, please check the contribution guide before sending a pull-request.
License
Please see the BSD-3-Clause license file for more information.
appwrite/sdk-for-web có 336 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/appwrite/sdk-for-web. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
Commit gần nhất trên appwrite/sdk-for-web là 14 ngày trước (theo timestamp GitHub). Repo có 62 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
appwrite/sdk-for-web là gì?
appwrite/sdk-for-web (appwrite/sdk-for-web) là dự án TypeScript trên GitHub. Theo mô tả gốc: [READ-ONLY] Official Appwrite Web SDK 🧡
appwrite/sdk-for-web so với các dự án Frontend khác thế nào?
appwrite/sdk-for-web được TopGit xếp vào nhóm Frontend, với 336 sao GitHub và viết bằng TypeScript. Xem trang chủ đề Frontend trên TopGit để so sánh với các dự án tương tự theo số sao và mức độ hoạt động.
appwrite/sdk-for-web viết bằng ngôn ngữ gì?
appwrite/sdk-for-web chủ yếu viết bằng TypeScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Vì sao appwrite/sdk-for-web được xếp vào nhóm Frontend?
TopGit xếp appwrite/sdk-for-web vào nhóm Frontend dựa trên GitHub topics và mô tả của repo (gắn thẻ: "angular", "appwrite", "baas"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
Đọc đầy đủ README ở tab phía trên.
Chưa chắc sdk-for-web có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về sdk-for-web.