One command. All platforms & frameworks. Zero Firebase setup headache.
Automatically configure Firebase for Next.js, Expo, React (Vite / CRA), Bare React Native, Remix, Astro, and SvelteKit β across Android, iOS, and Web.
npx firestack-cli setup- Why firestack-cli?
- Framework Support
- Install
- Quick Start
- Commands
- How It Works
- Doctor & Fix
- Safety Principles
- Development
- Contributing
- License
Setting up Firebase across different frameworks and platforms is tedious:
- Next.js: Register web app β generate
NEXT_PUBLIC_*in.env.localβ initialize singletonsrc/lib/firebase.tsβ setup Auth & Firestore. - Expo: Register iOS & Android apps β download
google-services.json&GoogleService-Info.plistβ configureapp.jsonplugins &EXPO_PUBLIC_*env vars. - React (Vite / CRA): Register web app β configure
VITE_*/REACT_APP_*in.envβ initialize client SDK. - Bare React Native: Patch root and app
build.gradleβ drop plist in Xcode folder β setup@react-native-firebase/app.
firestack-cli automates all of that with intelligent framework detection and direct Firebase API integration.
Your Project (Next.js / Expo / Vite / React Native / Remix)
β
βΌ
firestack-cli
β
βββββββββββββββββββΌββββββββββββββββββ
βΌ βΌ βΌ
Web Frameworks Expo Bare React Native
(Next.js/Vite/CRA) (iOS/Android/Web) (Android/iOS Native)
β β β
.env / lib/firebase app.json + plists Gradle + plists
β β β
βββββββββββββββββββΌββββββββββββββββββ
βΌ
Firebase Ready π₯
| Framework | Detection Trigger | Config File Location | Env Vars Format | SDK Configured |
|---|---|---|---|---|
| Next.js (App & Pages) | next |
src/lib/firebase.ts / lib/firebase.ts |
NEXT_PUBLIC_FIREBASE_* in .env.local |
firebase (JS SDK) |
| Expo (Managed & Bare) | expo, app.json |
app.json + google-services.json + GoogleService-Info.plist |
EXPO_PUBLIC_FIREBASE_* in .env |
@react-native-firebase or firebase |
| React (Vite) | vite + react |
src/lib/firebase.ts / src/firebase.ts |
VITE_FIREBASE_* in .env |
firebase (JS SDK) |
| Create React App | react-scripts |
src/firebase.ts |
REACT_APP_FIREBASE_* in .env |
firebase (JS SDK) |
| Bare React Native | react-native |
android/app/google-services.json & ios/.../GoogleService-Info.plist |
Native Gradle / Plist | @react-native-firebase/app |
| Remix / Astro / Svelte | package matches | src/lib/firebase.ts / app/lib/firebase.ts |
Framework-specific env prefix | firebase (JS SDK) |
npx firestack-cli setup
# or
bunx firestack-cli setup# npm
npm install -g firestack-cli
# bun
bun add -g firestack-cli
# pnpm
pnpm add -g firestack-cli| Requirement | Purpose |
|---|---|
| Firebase CLI | API access β npm i -g firebase-tools |
firebase login |
Authenticate before running setup |
| Node.js β₯ 18 | Runtime |
From the root of your project:
npx firestack-cli setupThe CLI auto-detects your framework and guides you through every step:
π₯ Firebase Setup CLI for Web, React Native & Expo
β Project analyzed
Framework: Next.js (App Router)
Package manager: bun
TypeScript: yes
β Firebase CLI v15.8.0 found
β Authenticated as you@example.com
? Select a Firebase project to connect: βΊ my-awesome-app
? Which Firebase services do you want to initialize in code?
β Authentication (auth)
β Cloud Firestore (db)
β Cloud Storage (storage)
β Configuring Firebase for Next.js (App Router)
β Created .env.local with NEXT_PUBLIC_FIREBASE_* variables
β Firebase client initialized at src/lib/firebase.ts
β Dependency Management
β Installed missing dependencies (firebase)
π Firebase configuration complete!
| Command | Description |
|---|---|
firestack setup |
Interactive Firebase setup wizard |
firestack doctor |
Diagnose configuration & env issues (read-only) |
firestack fix |
Auto-fix all detected problems |
firestack fix env |
Fix environment variables (.env.local / .env) |
firestack fix web |
Fix Web / JS SDK configuration |
firestack fix android |
Fix Android native configuration |
firestack fix ios |
Fix iOS native configuration |
firestack fix deps |
Install missing Firebase dependencies |
firestack --help |
Show help |
firestack --version |
Show version |
firestack-cli inspects your project before making changes:
- Framework β Next.js (App / Pages router), Expo (with Expo Router), Vite, CRA, Remix, Astro, SvelteKit, Bare React Native
- Package manager β Bun, npm, pnpm, or Yarn
- Environment format β
.env.local(Next.js) or.env(Vite/Expo) with appropriate variable prefixes - Native folders β
android/andios/presence for mobile builds - Firebase services β Auth, Firestore, Storage, Realtime DB, and Analytics
- Generates
.env.localor.env: Safely appends or updatesFIREBASE_*credentials while preserving all your existing non-Firebase environment variables. - Generates Type-Safe Client Module: Creates
src/lib/firebase.ts(or.js) with singleton guards and typed exports forauth,db,storage, andanalytics.
- Android: Downloads
google-services.json, patchesbuild.gradleclasspath insidebuildscript {}, applies plugin inandroid/app/build.gradle. - iOS: Downloads
GoogleService-Info.plist, places it in Xcode target folders, and updatesapp.json. - Expo Prebuild: Detects missing native folders and offers to run
expo prebuild --no-install.
npx firestack-cli doctorπ₯ Firebase Doctor
Project
β Framework: Next.js (App Router) (bun)
β Firebase CLI: Installed (v15.8.0)
β Firebase authentication: Authenticated as you@example.com
Environment
β .env.local: Environment configuration file found
Web
β Firebase configuration: Configuration module found (src/lib/firebase.ts)
Dependencies
β firebase (JS SDK): Installed
No problems detected! Your Firebase setup is healthy.
npx firestack-cli fix # fix all issues
npx firestack-cli fix env # fix .env / .env.local variables
npx firestack-cli fix web # fix client boilerplate
npx firestack-cli fix android # fix Android native
npx firestack-cli fix ios # fix iOS native
npx firestack-cli fix deps # install missing packages- No passwords β uses official
firebase loginOAuth session - No silent overwrites β existing
google-services.jsonandGoogleService-Info.plistare backed up as.bakbefore replacement - Env safety β
.env.localand.envparsing preserves all existing environment variables - No shell injection β all subprocess execution uses
shell: falsewith argument validation - Path traversal protection β paths from
app.jsonare validated against root boundary - Idempotent β running setup multiple times never duplicates Gradle plugins or env keys
# Clone
git clone https://github.com/THARUN-BART/firestack-cli.git
cd firestack-cli
# Install
bun install
# Run tests (44 tests across 7 suites)
bun test
# Build for distribution
bun run build