DEV Community

Alex Spinov
Alex Spinov

Posted on

Appwrite Has a Free Open-Source Backend Platform — Firebase Alternative You Can Self-Host

Firebase is convenient until the bill arrives. Appwrite gives you the same features — database, auth, storage, functions — fully open-source and self-hostable.

What is Appwrite?

Appwrite is an open-source backend-as-a-service platform. It provides APIs for authentication, databases, file storage, cloud functions, and messaging. Self-host with Docker or use their cloud.

Why Appwrite Over Firebase

1. Self-Hosted in One Command

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
Enter fullscreen mode Exit fullscreen mode

Your data stays on your server. No vendor lock-in.

2. Database with Relationships

import { Client, Databases, ID, Query } from 'appwrite';

const client = new Client()
    .setEndpoint('https://cloud.appwrite.io/v1')
    .setProject('your-project');

const db = new Databases(client);

// Create document
await db.createDocument('main', 'posts', ID.unique(), {
    title: 'My First Post',
    content: 'Hello world',
    tags: ['javascript', 'tutorial'],
    published: true,
});

// Query with filters
const posts = await db.listDocuments('main', 'posts', [
    Query.equal('published', true),
    Query.orderDesc('$createdAt'),
    Query.limit(10),
]);
Enter fullscreen mode Exit fullscreen mode

3. Multi-Provider Authentication

import { Account, OAuthProvider } from 'appwrite';

const account = new Account(client);

// Email/password
await account.create(ID.unique(), 'user@example.com', 'password', 'Alice');

// OAuth (30+ providers)
account.createOAuth2Session(OAuthProvider.Google, 
    'https://myapp.com/success',
    'https://myapp.com/failure'
);

// Phone (SMS)
await account.createPhoneSession(ID.unique(), '+1234567890');

// Magic URL (passwordless)
await account.createMagicURLSession(ID.unique(), 'user@example.com');
Enter fullscreen mode Exit fullscreen mode

4. Cloud Functions (Multiple Runtimes)

// functions/hello/src/main.js
export default async ({ req, res, log }) => {
    const { name } = JSON.parse(req.body);
    log(`Processing request for ${name}`);

    return res.json({
        message: `Hello, ${name}!`,
        timestamp: new Date().toISOString(),
    });
};
Enter fullscreen mode Exit fullscreen mode

Supported runtimes: Node.js, Python, PHP, Ruby, Dart, Swift, Kotlin, Java, .NET, Bun, Deno.

5. File Storage with Transformations

import { Storage } from 'appwrite';

const storage = new Storage(client);

// Upload
await storage.createFile('images', ID.unique(), file);

// Get with preview (resize, crop, format conversion)
const preview = storage.getFilePreview('images', fileId, 
    300,  // width
    200,  // height
    'center', // gravity
    90,   // quality
    'webp' // output format
);
Enter fullscreen mode Exit fullscreen mode

6. Real-Time

client.subscribe('databases.main.collections.messages.documents', (response) => {
    console.log(response.events);  // ['databases.*.collections.*.documents.*.create']
    console.log(response.payload); // The new document
});
Enter fullscreen mode Exit fullscreen mode

Appwrite vs Firebase vs Supabase

Appwrite Firebase Supabase
Self-host Easy (Docker) No Moderate
Database Document NoSQL PostgreSQL
Auth providers 30+ 10+ 20+
Functions 11 runtimes Node.js, Python TypeScript
Storage transforms Built-in Via Extensions Via hooks
License BSD 3-Clause Proprietary Apache 2.0
Messaging Email, SMS, Push FCM only No

SDKs

Official SDKs for: Web, Flutter, Apple, Android, React Native, Node.js, Python, Ruby, PHP, Kotlin, Swift, .NET, Dart.

Getting Started

# Cloud (free tier)
# Sign up at cloud.appwrite.io

# Self-hosted
docker run -it --rm \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  appwrite/appwrite:latest install
Enter fullscreen mode Exit fullscreen mode

The Bottom Line

Appwrite is Firebase without the lock-in. Self-host for free, use any runtime for functions, and keep your data under your control.


Need data solutions? I build web scraping tools. Check my Apify actors or email spinov001@gmail.com.

Top comments (0)