Open Source, localhost supported, Drop-in Replacement and Self-Hosted Alternative for Firebase using Node.js, Express.js, BetterAuth and PostgreSQL (JSONB), node-pg-migrate
Firebase π | Supabase π | Postbase β€οΈ
Demo Preact app is included !
- Sign Up βπ€
- Sign In π
- Forgot Password βπ
- Reset Password β»οΈπ
- Email Verification Email βοΈβοΈ
- Phone Verification Codes π±βοΈ
- Delete User π€β
Special thanks to @better-auth/better-auth
- NoSQL Document Storage ποΈ
- Collections π
- Query functions π
- CRUD Functions π οΈ
- Security Rules π‘οΈ
- Database Migrations π’οΈ β π’οΈ
- File Upload (https) πβ¬οΈ
- File Serving (https) πβ¬οΈ
- Security Rules π‘οΈ
- Admin SDK πποΈ
- Nginx Config π§±
- Systemd Config βοΈ
- Git Push Deployment β¬οΈπ
Brand new project launched 02 Nov 2025, this is boiler plate but working! Expect heavy changes coming every few hours until stable
Mostly all code is ChatGPT generated but manually tested by human.
To create a new project with Postbase, all you have to do is clone this repo.
git clone https://github.com/umrashrf/postbase.git
then start backend and frontend servers and modify as needed!
Both backend/ and frontend/ folders have their own README.md
import { signIn } from './auth';
await signUp.email({
email: '[email protected]',
password: 'secure-password',
name: 'Umair Ashraf',
callbackURL: "/dashboard",
});import { signIn } from './auth';
await signIn.email({
email: '[email protected]',
password: 'secure-password',
callbackURL: '/dashboard',
});import { auth } from './auth';
auth.onAuthStateChanged(user => {
// user
auth.currentUser === user // true
});
const token = auth.currentUser.getIdToken();
// token for API authentication and rules engineimport { db } from "./postbase";
const data = await db.collection('users').doc('docId').get();
await db.collection('users').set({ name: "Umair" }, { merge: true });
const reference = db.collection('users')
.where('name', '==', 'Umair')
.orderBy('createdAt')
.limit(5);
const docs = await reference.get();
reference.onSnapshot(docs => {
// use docs
});import { createAdminClient } from './lib/postbase/compat/admin.js';
import { authClient } from './auth.js';
const admin = createAdminClient({ authClient });
const user = await admin.auth().getUser(userId);
const doc = await admin.firestore().collection('collection').doc('docId').get();- Firebase Functions Replacement (Backend API can be used for now)
Important functions to replicate:
# https://firebase.google.com/docs/functions/schedule-functions
const { onSchedule } = require("firebase-functions/scheduler");
# https://firebase.google.com/docs/functions/callable
const { onCall } = require("firebase-functions/https");
# https://firebase.google.com/docs/functions/get-started
const { onRequest } = require("firebase-functions/https");
- Firebase Storage Replacement (Support S3 and other backend)
- Testing
- Firebase Authentication Replacement
- Firebase Firestore Replacement
- Firebase Storage Replacement (Filebased Only)
- Firebase Storage Replacement (HTTPS Based Upload)
MIT




