A powerful, type-safe TypeScript ORM for Appwrite with automatic migrations, schema validation, indexes, and join support. Works seamlessly in both server-side (Node.js) and client-side (browser) environments.
🌐 Try the Interactive Demo - Experience Appwrite ORM in action with live examples!
- Environment: The ORM works for both web Client AND for nodejs servers
- Server migration: Migrate your database schema into Appwrite, SQL, Firebase, or just text
- Caching: Want to optimize your queries? Appwrite ORM autometically handles caching to possibly reduce database loads
# For server-side (Node.js)
npm install appwrite-orm node-appwrite
# For client-side (browser)
npm install appwrite-orm appwriteimport { ServerORM } from 'appwrite-orm/server';
import { Query } from 'node-appwrite';
interface User {
$id: string;
name: string;
email: string;
age: number;
}
const orm = new ServerORM({
endpoint: process.env.APPWRITE_ENDPOINT!,
projectId: process.env.APPWRITE_PROJECT_ID!,
databaseId: process.env.APPWRITE_DATABASE_ID!,
apiKey: process.env.APPWRITE_API_KEY!,
autoMigrate: true
});
const db = await orm.init([{
name: 'users',
schema: {
name: { type: 'string', required: true },
email: { type: 'string', required: true },
age: { type: 'integer', min: 0 }
},
indexes: [
{ key: 'email_idx', type: 'unique', attributes: ['email'] }
]
}]);
// Create user
const user = await db.table('users').create({
name: 'John Doe',
email: 'john@example.com',
age: 30
}) as User;
// Query users
const adults = await db.table('users').find([
Query.greaterThanEqual('age', 18),
Query.orderDesc('age')
]) as User[];import { WebORM } from 'appwrite-orm/web';
const orm = new WebORM({
endpoint: import.meta.env.VITE_APPWRITE_ENDPOINT,
projectId: import.meta.env.VITE_APPWRITE_PROJECT_ID,
databaseId: import.meta.env.VITE_APPWRITE_DATABASE_ID
});
const db = await orm.init([{
name: 'posts',
schema: {
title: { type: 'string', required: true },
content: { type: 'string', required: true },
published: { type: 'boolean', default: false }
}
}]);
const posts = await db.table('posts').query({ published: true });For testing without Appwrite backend:
const orm = new WebORM({
endpoint: 'http://localhost',
projectId: 'dev',
databaseId: 'my-dev-db',
development: true // Uses cookie storage
});# Set up environment
cp .env.example .env
# Run tests
npm test
# Run integration tests
npm run test:integrationAccess documentation via AI assistants using the Model Context Protocol:
npx appwrite-ormConfigure in your MCP client:
{
"mcpServers": {
"appwrite-orm-docs": {
"command": "npx",
"args": ["appwrite-orm@latest"]
}
}
}- Interactive Demo - Try it live in your browser
- Full Documentation
- MCP Server Guide
- API Reference
- GitHub Repository
MIT License - see LICENSE file for details.
Built for Appwrite - The open-source backend-as-a-service platform.
Made with ❤️ by Ori Raisfeld
