jpskill.com
🛠️ 開発・MCP コミュニティ

appwrite

Appwriteは、認証機能やデータベース管理、ファイルストレージ、リアルタイム機能などを、バックエンドのコードを書かずに構築できるオープンソースのBaaSで、Firebaseの代替としても活用できる環境を構築するSkill。

📜 元の英語説明(参考)

Build backends with Appwrite — open-source Backend-as-a-Service. Use when a user asks to set up user authentication, manage a database without writing backend code, handle file storage and uploads, add realtime subscriptions, set up cloud functions, build a mobile or web app backend, replace Firebase with an open-source alternative, or self-host a BaaS platform. Covers auth, databases, storage, functions, realtime, and SDK integration for web, mobile, and server-side.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Appwriteは、認証機能やデータベース管理、ファイルストレージ、リアルタイム機能などを、バックエンドのコードを書かずに構築できるオープンソースのBaaSで、Firebaseの代替としても活用できる環境を構築するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o appwrite.zip https://jpskill.com/download/14644.zip && unzip -o appwrite.zip && rm appwrite.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14644.zip -OutFile "$d\appwrite.zip"; Expand-Archive "$d\appwrite.zip" -DestinationPath $d -Force; ri "$d\appwrite.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して appwrite.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → appwrite フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Appwrite

概要

Appwrite は、認証、データベース、ファイルストレージ、クラウド関数、リアルタイムサブスクリプションを提供するオープンソースの Backend-as-a-Service (BaaS) であり、これらすべてを単一のセルフホストされた Docker デプロイメントを通じて提供します。これは Firebase のオープンソースの代替であり、Web (JavaScript)、モバイル (Flutter, Swift, Kotlin)、およびサーバーサイド (Node.js, Python, PHP) 用の SDK があります。このスキルでは、セルフホストのセットアップ、認証、データベース操作、ファイルストレージ、サーバーレス関数、およびリアルタイムサブスクリプションについて説明します。

手順

ステップ 1: セルフホストされたデプロイメント

# ワンコマンド Docker セットアップ
docker run -it --rm \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume "$(pwd)/appwrite:/usr/src/code/appwrite:rw" \
  --entrypoint="install" \
  appwrite/appwrite:latest

# または Docker Compose (本番環境) を使用
curl -o docker-compose.yml https://appwrite.io/install/compose
curl -o .env https://appwrite.io/install/env
docker compose up -d

# コンソール: http://localhost/console
# コンソール UI で最初のプロジェクトを作成します

ステップ 2: 認証

// lib/appwrite.js — クライアント SDK のセットアップと認証
import { Client, Account, ID } from 'appwrite'

const client = new Client()
  .setEndpoint('http://localhost/v1')    // Appwrite API エンドポイント
  .setProject('your-project-id')         // コンソールから

const account = new Account(client)

// サインアップ
async function signUp(email, password, name) {
  const user = await account.create(ID.unique(), email, password, name)
  // サインアップ後に自動ログイン
  await account.createEmailPasswordSession(email, password)
  return user
}

// ログイン
async function login(email, password) {
  return await account.createEmailPasswordSession(email, password)
}

// OAuth ログイン (Google, GitHub, Apple など)
account.createOAuth2Session('google', 'http://localhost:3000/callback', 'http://localhost:3000/login')

// 現在のユーザーを取得
async function getCurrentUser() {
  try {
    return await account.get()
  } catch {
    return null    // ログインしていない
  }
}

// ログアウト
async function logout() {
  await account.deleteSession('current')
}

ステップ 3: データベース操作

// lib/database.js — Appwrite Databases を使用した CRUD 操作
import { Client, Databases, ID, Query } from 'appwrite'

const client = new Client()
  .setEndpoint('http://localhost/v1')
  .setProject('your-project-id')

const databases = new Databases(client)

const DB_ID = 'main'
const COLLECTION_ID = 'posts'

// ドキュメントを作成
async function createPost(title, content, authorId) {
  return await databases.createDocument(DB_ID, COLLECTION_ID, ID.unique(), {
    title,
    content,
    author_id: authorId,
    status: 'draft',
    created_at: new Date().toISOString(),
  })
}

// フィルタとページネーションを使用してリスト
async function listPublishedPosts(page = 1, limit = 10) {
  return await databases.listDocuments(DB_ID, COLLECTION_ID, [
    Query.equal('status', 'published'),
    Query.orderDesc('created_at'),
    Query.limit(limit),
    Query.offset((page - 1) * limit),
  ])
}

// 更新
async function publishPost(postId) {
  return await databases.updateDocument(DB_ID, COLLECTION_ID, postId, {
    status: 'published',
    published_at: new Date().toISOString(),
  })
}

// 削除
async function deletePost(postId) {
  await databases.deleteDocument(DB_ID, COLLECTION_ID, postId)
}

ステップ 4: ファイルストレージ

// lib/storage.js — ファイルのアップロードと管理
import { Client, Storage, ID } from 'appwrite'

const storage = new Storage(new Client()
  .setEndpoint('http://localhost/v1')
  .setProject('your-project-id'))

const BUCKET_ID = 'uploads'

// ファイルをアップロード
async function uploadFile(file) {
  /**
   * ファイルを Appwrite ストレージにアップロードします。
   * 引数:
   *   file: <input type="file"> またはドラッグアンドドロップからの File オブジェクト
   */
  return await storage.createFile(BUCKET_ID, ID.unique(), file)
}

// ファイル URL を取得 (画像変換付き)
function getFilePreview(fileId, width = 400, height = 300) {
  return storage.getFilePreview(BUCKET_ID, fileId, width, height)
}

// ファイルをダウンロード
function getFileDownload(fileId) {
  return storage.getFileDownload(BUCKET_ID, fileId)
}

// ファイルを削除
async function deleteFile(fileId) {
  await storage.deleteFile(BUCKET_ID, fileId)
}

ステップ 5: クラウド関数

// functions/on-order-created/src/main.js — データベースイベントによってトリガーされるサーバーレス関数
// Appwrite CLI 経由でデプロイ: appwrite deploy function

import { Client, Databases, Users } from 'node-appwrite'

export default async ({ req, res, log, error }) => {
  const client = new Client()
    .setEndpoint(process.env.APPWRITE_ENDPOINT)
    .setProject(process.env.APPWRITE_PROJECT)
    .setKey(process.env.APPWRITE_API_KEY)

  const payload = JSON.parse(req.body)
  const order = payload.$id ? payload : payload.data

  log(`New order: ${order.$id}, total: ${order.total}`)

  // 通知を送信、在庫を更新など
  const users = new Users(client)
  const user = await users.get(order.user_id)
  log(`Order by: ${user.email}`)

  return res.json({ success: true, orderId: order.$id })
}

ステップ 6: リアルタイムサブスクリプション

// hooks/useRealtime.js — ライブデータベースの変更をサブスクライブ
import { Client } from 'appwrite'

const client = new Client()
  .setEndpoint('http://localhost/v1')
  .setProject('your-project-id')

// コレクションの変更をサブスクライブ
const unsubscribe = client.subscribe(
  'databases.main.collections.messages.documents',
  (response) => {
    // 作成、更新、削除時に発火
    const event = response.events[0]
    const document = response.payload

    if (event.includes('.create')) {
      console.log('New message:', document)
    } else if (event.includes('.update')) {
      console.log('Updated:', document)
    } else if (event.includes('.delete')) {
      console.log('Deleted:', document.$id)
    }
  }
)

// クリーンアップ
// unsubscribe()

例 1: 認証、データベース、a を使用したフルスタックアプリの構築

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Appwrite

Overview

Appwrite is an open-source Backend-as-a-Service (BaaS) providing authentication, databases, file storage, cloud functions, and realtime subscriptions — all through a single self-hosted Docker deployment. It's the open-source alternative to Firebase, with SDKs for web (JavaScript), mobile (Flutter, Swift, Kotlin), and server-side (Node.js, Python, PHP). This skill covers self-hosting setup, authentication, database operations, file storage, serverless functions, and realtime subscriptions.

Instructions

Step 1: Self-Hosted Deployment

# One-command Docker setup
docker run -it --rm \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume "$(pwd)/appwrite:/usr/src/code/appwrite:rw" \
  --entrypoint="install" \
  appwrite/appwrite:latest

# Or with Docker Compose (production)
curl -o docker-compose.yml https://appwrite.io/install/compose
curl -o .env https://appwrite.io/install/env
docker compose up -d

# Console: http://localhost/console
# Create your first project in the console UI

Step 2: Authentication

// lib/appwrite.js — Client SDK setup and authentication
import { Client, Account, ID } from 'appwrite'

const client = new Client()
  .setEndpoint('http://localhost/v1')    // Appwrite API endpoint
  .setProject('your-project-id')         // from console

const account = new Account(client)

// Sign up
async function signUp(email, password, name) {
  const user = await account.create(ID.unique(), email, password, name)
  // Auto-login after signup
  await account.createEmailPasswordSession(email, password)
  return user
}

// Login
async function login(email, password) {
  return await account.createEmailPasswordSession(email, password)
}

// OAuth login (Google, GitHub, Apple, etc.)
account.createOAuth2Session('google', 'http://localhost:3000/callback', 'http://localhost:3000/login')

// Get current user
async function getCurrentUser() {
  try {
    return await account.get()
  } catch {
    return null    // not logged in
  }
}

// Logout
async function logout() {
  await account.deleteSession('current')
}

Step 3: Database Operations

// lib/database.js — CRUD operations with Appwrite Databases
import { Client, Databases, ID, Query } from 'appwrite'

const client = new Client()
  .setEndpoint('http://localhost/v1')
  .setProject('your-project-id')

const databases = new Databases(client)

const DB_ID = 'main'
const COLLECTION_ID = 'posts'

// Create document
async function createPost(title, content, authorId) {
  return await databases.createDocument(DB_ID, COLLECTION_ID, ID.unique(), {
    title,
    content,
    author_id: authorId,
    status: 'draft',
    created_at: new Date().toISOString(),
  })
}

// List with filters and pagination
async function listPublishedPosts(page = 1, limit = 10) {
  return await databases.listDocuments(DB_ID, COLLECTION_ID, [
    Query.equal('status', 'published'),
    Query.orderDesc('created_at'),
    Query.limit(limit),
    Query.offset((page - 1) * limit),
  ])
}

// Update
async function publishPost(postId) {
  return await databases.updateDocument(DB_ID, COLLECTION_ID, postId, {
    status: 'published',
    published_at: new Date().toISOString(),
  })
}

// Delete
async function deletePost(postId) {
  await databases.deleteDocument(DB_ID, COLLECTION_ID, postId)
}

Step 4: File Storage

// lib/storage.js — Upload and manage files
import { Client, Storage, ID } from 'appwrite'

const storage = new Storage(new Client()
  .setEndpoint('http://localhost/v1')
  .setProject('your-project-id'))

const BUCKET_ID = 'uploads'

// Upload file
async function uploadFile(file) {
  /**
   * Upload a file to Appwrite storage.
   * Args:
   *   file: File object from <input type="file"> or drag-and-drop
   */
  return await storage.createFile(BUCKET_ID, ID.unique(), file)
}

// Get file URL (with transformations for images)
function getFilePreview(fileId, width = 400, height = 300) {
  return storage.getFilePreview(BUCKET_ID, fileId, width, height)
}

// Download file
function getFileDownload(fileId) {
  return storage.getFileDownload(BUCKET_ID, fileId)
}

// Delete file
async function deleteFile(fileId) {
  await storage.deleteFile(BUCKET_ID, fileId)
}

Step 5: Cloud Functions

// functions/on-order-created/src/main.js — Serverless function triggered by database event
// Deploy via Appwrite CLI: appwrite deploy function

import { Client, Databases, Users } from 'node-appwrite'

export default async ({ req, res, log, error }) => {
  const client = new Client()
    .setEndpoint(process.env.APPWRITE_ENDPOINT)
    .setProject(process.env.APPWRITE_PROJECT)
    .setKey(process.env.APPWRITE_API_KEY)

  const payload = JSON.parse(req.body)
  const order = payload.$id ? payload : payload.data

  log(`New order: ${order.$id}, total: ${order.total}`)

  // Send notification, update inventory, etc.
  const users = new Users(client)
  const user = await users.get(order.user_id)
  log(`Order by: ${user.email}`)

  return res.json({ success: true, orderId: order.$id })
}

Step 6: Realtime Subscriptions

// hooks/useRealtime.js — Subscribe to live database changes
import { Client } from 'appwrite'

const client = new Client()
  .setEndpoint('http://localhost/v1')
  .setProject('your-project-id')

// Subscribe to changes in a collection
const unsubscribe = client.subscribe(
  'databases.main.collections.messages.documents',
  (response) => {
    // Fires on create, update, delete
    const event = response.events[0]
    const document = response.payload

    if (event.includes('.create')) {
      console.log('New message:', document)
    } else if (event.includes('.update')) {
      console.log('Updated:', document)
    } else if (event.includes('.delete')) {
      console.log('Deleted:', document.$id)
    }
  }
)

// Cleanup
// unsubscribe()

Examples

Example 1: Build a full-stack app with auth, database, and file uploads

User prompt: "I want to build a recipe sharing app. Users sign up, post recipes with photos, and browse others' recipes. Use an open-source backend I can self-host."

The agent will:

  1. Deploy Appwrite with Docker Compose.
  2. Set up authentication with email/password and Google OAuth.
  3. Create database collections: recipes (title, ingredients, steps, author, image_id), users.
  4. Configure file storage bucket for recipe photos with size limits.
  5. Build a Next.js frontend using the Appwrite Web SDK.
  6. Set permissions so users can only edit their own recipes but read all published ones.

Example 2: Replace Firebase with a self-hosted alternative

User prompt: "We're using Firebase but want to self-host for data sovereignty. Migrate our auth, Firestore, and storage to something open-source."

The agent will:

  1. Deploy Appwrite on the target server.
  2. Export users from Firebase Auth, import to Appwrite.
  3. Map Firestore collections to Appwrite database collections.
  4. Migrate storage files using the Appwrite Server SDK.
  5. Update frontend code to use Appwrite SDK (similar API surface to Firebase).

Guidelines

  • Appwrite runs as a set of Docker containers (API, worker, database, cache, etc.). It needs ~2GB RAM minimum for comfortable operation. Use Docker Compose for managing the full stack.
  • Configure database indexes in the Appwrite console for fields you filter or sort on — queries on unindexed fields will be slow at scale.
  • Use Appwrite's permission system (read("any"), write("user:USER_ID")) to control document access. Default is owner-only — explicitly set permissions for public content.
  • Server SDKs (Node.js, Python) use API keys and bypass permissions — use them for admin operations, cron jobs, and cloud functions. Client SDKs enforce user permissions.
  • Appwrite handles auth tokens, session management, and OAuth flows internally. You don't need to manage JWTs or refresh tokens manually.