Appwrite is an open-source Firebase alternative with databases, auth, storage, functions, and messaging — all self-hosted with a polished REST API and SDKs.
Setup
docker run -it --rm \
-p 80:80 -p 443:443 \
-v appwrite:/storage \
appwrite/appwrite
Database API
import { Client, Databases, ID, Query } from 'appwrite';
const client = new Client()
.setEndpoint('https://your-appwrite.com/v1')
.setProject('your-project-id');
const db = new Databases(client);
// Create document
const doc = await db.createDocument('mydb', 'posts', ID.unique(), {
title: 'Hello World',
content: 'First post!',
published: true
});
// List with filters
const posts = await db.listDocuments('mydb', 'posts', [
Query.equal('published', true),
Query.orderDesc('$createdAt'),
Query.limit(10)
]);
// Real-time
client.subscribe('databases.mydb.collections.posts.documents', (response) => {
console.log('Change:', response.payload);
});
Authentication
import { Account, ID } from 'appwrite';
const account = new Account(client);
// Email signup
await account.create(ID.unique(), 'user@example.com', 'password', 'Alice');
// Login
const session = await account.createEmailPasswordSession('user@example.com', 'password');
// OAuth
account.createOAuth2Session('google', 'https://myapp.com/success', 'https://myapp.com/fail');
// Get current user
const user = await account.get();
Storage
import { Storage, ID } from 'appwrite';
const storage = new Storage(client);
// Upload
const file = await storage.createFile('bucket-id', ID.unique(), document.getElementById('file').files[0]);
// Get preview (auto-resized)
const preview = storage.getFilePreview('bucket-id', file.$id, 300, 300);
Cloud Functions
// functions/hello/src/main.js
export default async ({ req, res, log }) => {
const { name } = JSON.parse(req.body);
log(`Hello ${name}`);
return res.json({ message: `Hello, ${name}!` });
};
Why This Matters
- Self-hosted Firebase: Your data, your server
- 14+ SDKs: Flutter, React Native, iOS, Android, Web
- Real-time: Built-in subscriptions on all resources
- Functions: Deploy serverless functions in any language
Need custom backend infrastructure or mobile app backends? I build developer tools. Check out my web scraping actors on Apify or reach out at spinov001@gmail.com for custom solutions.
Top comments (0)