🐘 Postbase (Demo)
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 !
Features
Authentication Features
- Sign Up ➕👤
- Sign In 🔑
- Sign in with Google/Facebook/Apple etc. ➕👤
- Forgot Password ❓🔐
- Reset Password ♻️🔐
- Email Verification Email ✉️✔️
- Phone Verification Codes 📱✔️
- Delete User 👤❌
Special thanks to @better-auth/better-auth
Database Features
- NoSQL Document Storage 🗄️
- Collections 📁
- Query functions 🔍
- CRUD Functions 🛠️
- Security Rules 🛡️
- Database Migrations 🛢️ → 🛢️
File Upload / Storage
- File Upload (https) 📄⬆️
- File Serving (https) 📄⬇️
- Security Rules 🛡️
Admin & System
- Admin SDK 👑🗄️
- Nginx Config 🧱
- Systemd Config ⚙️
- Git Push Deployment ⬆️🐙
Disclaimer !!!
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.
Getting Started
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
Docs
Authentication (Firebase Like API)
Sign Up
import { signIn } from './auth'; await signUp.email({ email: 'umrashrf@gmail.com', password: 'secure-password', name: 'Umair Ashraf', callbackURL: "/dashboard", });
Sign In
import { signIn } from './auth'; await signIn.email({ email: 'umrashrf@gmail.com', password: 'secure-password', callbackURL: '/dashboard', });
auth.onAuthStateChanged, auth.currentUser and auth.currentUser.getIdToken()
import { auth } from './auth'; auth.onAuthStateChanged(user => { // user auth.currentUser === user // true }); const token = auth.currentUser.getIdToken(); // token for API authentication and rules engine
Document Storage (Firestore Like API)
Collections, get/set/where/orderBy/limit/delete
import { 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 });
Admin Client
import { createAdminClient } from './lib/postbase/compat/admin.js'; import { authClient } from './admin/auth.js'; const admin = createAdminClient({ authClient }); const user = await admin.auth().getUser(userId); const doc = await admin.firestore().collection('collection').doc('docId').get();
Todo
- 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)
In Progress
- Testing
Done
- Firebase Authentication Replacement
- Firebase Firestore Replacement
- Firebase Storage Replacement (Filebased Only)
- Firebase Storage Replacement (HTTPS Based Upload)
License
MIT






