Repository navigation
Expand file tree
/
Copy pathfirebase_cli_reference.html
More file actions
685 lines (627 loc) Β· 38.9 KB
/
Copy pathfirebase_cli_reference.html
File metadata and controls
685 lines (627 loc) Β· 38.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>π₯ Firebase CLI Cheatsheet</title>
<style>
/* βββββββββ RESET & BASE βββββββββ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #0f0f1a;
--sidebar-bg: #141428;
--card-bg: #1a1a36;
--card-border: #2a2a50;
--accent: #e94560;
--accent-hover: #ff6b81;
--cmd-color: #00d2ff;
--text: #e8e8f0;
--dim: #7a7aa0;
--detail-bg: #12122a;
--copy-bg: #252550;
--success: #2ecc71;
--topbar-h: 56px;
--sidebar-w: 270px;
}
html { scroll-behavior: smooth; }
body {
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.6;
overflow: hidden;
height: 100vh;
}
/* βββββββββ TOPBAR βββββββββ */
.topbar {
position: fixed; top: 0; left: 0; right: 0;
height: var(--topbar-h);
background: var(--accent);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24px;
z-index: 100;
box-shadow: 0 2px 20px rgba(233,69,96,0.3);
}
.topbar h1 {
font-size: 1.25rem;
font-weight: 700;
color: #fff;
white-space: nowrap;
}
.topbar h1 span { font-size: 1.4rem; }
.search-box {
display: flex;
align-items: center;
background: rgba(255,255,255,0.15);
border-radius: 8px;
padding: 6px 14px;
gap: 8px;
min-width: 280px;
transition: background 0.2s;
}
.search-box:focus-within { background: rgba(255,255,255,0.25); }
.search-box input {
background: transparent;
border: none;
outline: none;
color: #fff;
font-size: 0.95rem;
width: 100%;
}
.search-box input::placeholder { color: rgba(255,255,255,0.6); }
/* βββββββββ LAYOUT βββββββββ */
.layout {
display: flex;
height: calc(100vh - var(--topbar-h));
margin-top: var(--topbar-h);
}
/* βββββββββ SIDEBAR βββββββββ */
.sidebar {
width: var(--sidebar-w);
min-width: var(--sidebar-w);
background: var(--sidebar-bg);
overflow-y: auto;
padding: 16px 0;
border-right: 1px solid var(--card-border);
}
.sidebar-label {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 2px;
color: var(--dim);
padding: 0 20px;
margin-bottom: 8px;
font-weight: 700;
}
.cat-btn {
display: block;
width: 100%;
text-align: left;
padding: 10px 20px;
border: none;
background: transparent;
color: var(--text);
font-size: 0.95rem;
cursor: pointer;
transition: all 0.15s;
border-left: 3px solid transparent;
font-family: inherit;
}
.cat-btn:hover {
background: rgba(233,69,96,0.1);
color: #fff;
}
.cat-btn.active {
background: rgba(233,69,96,0.15);
color: var(--accent);
border-left-color: var(--accent);
font-weight: 600;
}
.cat-btn .cmd-count {
float: right;
font-size: 0.75rem;
background: var(--card-border);
padding: 1px 8px;
border-radius: 10px;
color: var(--dim);
}
.cat-btn.active .cmd-count {
background: var(--accent);
color: #fff;
}
/* βββββββββ MAIN CONTENT βββββββββ */
.main {
flex: 1;
overflow-y: auto;
padding: 28px 32px 60px;
}
.main-header {
margin-bottom: 20px;
padding-bottom: 16px;
border-bottom: 1px solid var(--card-border);
}
.main-header h2 {
font-size: 1.6rem;
font-weight: 700;
}
.main-header .subtitle {
color: var(--dim);
font-size: 0.9rem;
margin-top: 4px;
}
/* βββββββββ COMMAND CARDS βββββββββ */
.card {
background: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 12px;
padding: 18px 22px;
margin-bottom: 14px;
transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
border-color: var(--accent);
box-shadow: 0 0 20px rgba(233,69,96,0.08);
}
.card-top {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 12px;
flex-wrap: wrap;
}
.cmd {
font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
font-size: 0.95rem;
color: var(--cmd-color);
font-weight: 600;
word-break: break-all;
flex: 1;
}
.cmd::before { content: '$ '; opacity: 0.5; }
.copy-btn {
padding: 4px 14px;
background: var(--copy-bg);
color: var(--dim);
border: 1px solid var(--card-border);
border-radius: 6px;
cursor: pointer;
font-size: 0.8rem;
font-family: inherit;
transition: all 0.2s;
white-space: nowrap;
}
.copy-btn:hover {
background: var(--accent);
color: #fff;
border-color: var(--accent);
}
.copy-btn.copied {
background: var(--success);
color: #fff;
border-color: var(--success);
}
.card .description {
margin-top: 10px;
font-size: 0.95rem;
color: var(--text);
line-height: 1.5;
}
.card .category-badge {
display: inline-block;
margin-top: 8px;
font-size: 0.75rem;
background: var(--copy-bg);
color: var(--dim);
padding: 2px 10px;
border-radius: 4px;
}
.details-toggle {
display: inline-flex;
align-items: center;
gap: 6px;
margin-top: 10px;
padding: 4px 0;
background: none;
border: none;
color: var(--dim);
cursor: pointer;
font-size: 0.85rem;
font-family: inherit;
transition: color 0.2s;
}
.details-toggle:hover { color: var(--accent); }
.details-toggle .arrow { transition: transform 0.2s; display: inline-block; }
.details-toggle.open .arrow { transform: rotate(90deg); }
.details-content {
display: none;
margin-top: 10px;
padding: 14px 16px;
background: var(--detail-bg);
border-radius: 8px;
border: 1px solid var(--card-border);
font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
font-size: 0.85rem;
color: var(--dim);
white-space: pre-wrap;
line-height: 1.7;
}
.details-content.open { display: block; }
/* βββββββββ NO RESULTS βββββββββ */
.no-results {
text-align: center;
padding: 60px 20px;
color: var(--dim);
}
.no-results .emoji { font-size: 3rem; margin-bottom: 16px; }
.no-results h3 { font-size: 1.2rem; color: var(--text); margin-bottom: 8px; }
/* βββββββββ MOBILE HAMBURGER βββββββββ */
.hamburger {
display: none;
background: none;
border: none;
color: #fff;
font-size: 1.5rem;
cursor: pointer;
padding: 4px 8px;
}
/* βββββββββ SCROLLBAR βββββββββ */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.sidebar::-webkit-scrollbar { width: 4px; }
/* βββββββββ RESPONSIVE βββββββββ */
@media (max-width: 768px) {
.hamburger { display: block; }
.sidebar {
position: fixed;
top: var(--topbar-h);
left: -100%;
height: calc(100vh - var(--topbar-h));
z-index: 90;
transition: left 0.3s;
box-shadow: 4px 0 20px rgba(0,0,0,0.5);
}
.sidebar.open { left: 0; }
.overlay {
display: none;
position: fixed;
top: var(--topbar-h);
left: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.5);
z-index: 80;
}
.overlay.open { display: block; }
.search-box { min-width: 160px; }
.main { padding: 20px 16px 60px; }
}
</style>
</head>
<body>
<!-- βββ TOPBAR βββ -->
<header class="topbar">
<div style="display:flex;align-items:center;gap:12px;">
<button class="hamburger" onclick="toggleSidebar()" aria-label="Menu">β°</button>
<h1><span>π₯</span> Firebase CLI Cheatsheet</h1>
</div>
<div class="search-box">
<span>π</span>
<input type="text" id="searchInput" placeholder="Search commands..." autocomplete="off">
</div>
</header>
<!-- βββ OVERLAY (mobile) βββ -->
<div class="overlay" id="overlay" onclick="toggleSidebar()"></div>
<!-- βββ LAYOUT βββ -->
<div class="layout">
<aside class="sidebar" id="sidebar">
<div class="sidebar-label">Categories</div>
<div id="sidebarButtons"></div>
</aside>
<main class="main" id="mainContent"></main>
</div>
<script>
// ββββββββββββββββββββββββββββββββββββββββββββ
// DATA
// ββββββββββββββββββββββββββββββββββββββββββββ
const FIREBASE_COMMANDS = {
"π Setup & Login": [
{ command: "npm install -g firebase-tools", description: "Install Firebase CLI globally via npm.", details: "Requires Node.js (v14+). Installs the 'firebase' command globally.\nAlternative: curl -sL https://firebase.tools | bash" },
{ command: "firebase login", description: "Authenticate with your Google account.", details: "Opens a browser window for Google OAuth.\nStores credentials locally for future commands.\nUse --no-localhost for remote/SSH sessions." },
{ command: "firebase login:ci", description: "Generate a CI/CD authentication token.", details: "Produces a refresh token for use in CI/CD pipelines.\nPass it via --token flag or FIREBASE_TOKEN env variable.\nExample: firebase deploy --token $FIREBASE_TOKEN" },
{ command: "firebase logout", description: "Log out of the Firebase CLI.", details: "Removes locally stored credentials." },
{ command: "firebase login:list", description: "List all authenticated accounts.", details: "Shows email addresses of all logged-in accounts." },
{ command: "firebase login:use <email>", description: "Set the active account for commands.", details: "Switch between multiple authenticated accounts." }
],
"π Project Management": [
{ command: "firebase init", description: "Initialize a new Firebase project in the current directory.", details: "Interactive wizard that sets up:\nβ’ firebase.json configuration\nβ’ .firebaserc project aliases\nβ’ Service-specific config files\n\nServices: Hosting, Functions, Firestore, Database,\nStorage, Emulators, Remote Config, Extensions" },
{ command: "firebase init hosting", description: "Initialize only Firebase Hosting.", details: "Sets up:\nβ’ Public directory (default: public/)\nβ’ Single-page app rewrite config\nβ’ GitHub Actions CI/CD (optional)" },
{ command: "firebase init firestore", description: "Initialize Firestore rules and indexes files.", details: "Creates:\nβ’ firestore.rules β Security rules\nβ’ firestore.indexes.json β Composite indexes" },
{ command: "firebase init functions", description: "Initialize Cloud Functions for Firebase.", details: "Creates a functions/ directory with:\nβ’ package.json\nβ’ index.js or index.ts\nβ’ Supports JavaScript, TypeScript, or Python" },
{ command: "firebase init emulators", description: "Set up local Firebase emulators.", details: "Configure emulators for:\nβ’ Auth, Firestore, Realtime DB, Functions,\n Hosting, Pub/Sub, Storage, Extensions\nβ’ Downloads emulator binaries" },
{ command: "firebase init storage", description: "Initialize Cloud Storage rules.", details: "Creates storage.rules file for security rules." },
{ command: "firebase init database", description: "Initialize Realtime Database rules.", details: "Creates database.rules.json for security rules." },
{ command: "firebase projects:list", description: "List all Firebase projects you have access to.", details: "Shows project ID, name, and resource location." },
{ command: "firebase projects:create <project-id>", description: "Create a new Firebase project.", details: "Options:\n --display-name <name> Set display name\n --organization <org> Set organization" },
{ command: "firebase use <project-id>", description: "Set the active Firebase project.", details: "Switch between projects.\nfirebase use --add β Add a project alias\nfirebase use default β Switch to default alias" },
{ command: "firebase use --add", description: "Add a project alias (e.g., staging, production).", details: "Aliases are stored in .firebaserc.\nExample aliases: default, staging, production" },
{ command: "firebase projects:addfirebase <project-id>", description: "Add Firebase to an existing Google Cloud project.", details: "Enables Firebase services on a GCP project." }
],
"π Hosting": [
{ command: "firebase deploy --only hosting", description: "Deploy only hosting files to Firebase.", details: "Deploys contents of your public directory.\nFiles are served via Firebase's global CDN.\nAutomatically provisions SSL certificates." },
{ command: "firebase hosting:channel:deploy <channel-id>", description: "Deploy to a preview channel (temporary URL).", details: "Creates a temporary preview URL for testing.\nOptions:\n --expires <duration> e.g., 7d, 2h (default: 7d)\n\nGreat for PR previews and stakeholder reviews." },
{ command: "firebase hosting:channel:list", description: "List all active preview channels.", details: "Shows channel ID, URL, and expiration date." },
{ command: "firebase hosting:channel:delete <channel-id>", description: "Delete a preview channel.", details: "Removes the channel and its deployed content." },
{ command: "firebase hosting:clone <source> <target>", description: "Clone a version from one site/channel to another.", details: "Format: site:channel\nExample: firebase hosting:clone mysite:ch1 mysite:live" },
{ command: "firebase hosting:disable", description: "Stop serving Firebase Hosting content.", details: "Displays a 'Site Not Found' message instead." },
{ command: "firebase hosting:sites:list", description: "List all Hosting sites in the project.", details: "Shows site ID, default URL, and status." },
{ command: "firebase hosting:sites:create <site-id>", description: "Create a new Hosting site (multisite).", details: "For projects needing multiple hosted sites." },
{ command: "firebase serve --only hosting", description: "Start a local development server for hosting.", details: "Serves files locally (default: http://localhost:5000).\nOptions:\n --port <port> Set custom port\n --host <host> Set custom host (e.g., 0.0.0.0)" }
],
"β‘ Cloud Functions": [
{ command: "firebase deploy --only functions", description: "Deploy all Cloud Functions.", details: "Deploys all functions defined in functions/index.js.\nAutomatically installs npm dependencies in the cloud." },
{ command: "firebase deploy --only functions:<name>", description: "Deploy a specific function by name.", details: "Deploy only one function:\n firebase deploy --only functions:myFunction\n\nDeploy multiple:\n firebase deploy --only functions:func1,functions:func2" },
{ command: "firebase functions:log", description: "View Cloud Functions logs.", details: "Options:\n --only <fn> Filter by function name\n --lines <n> Number of log lines (default: 20)\n --open Open logs in browser (GCP Console)" },
{ command: "firebase functions:shell", description: "Start an interactive shell for testing functions.", details: "Invoke functions locally with test data.\nSupports HTTP, callable, and background functions.\n\nExample in shell:\n myFunction({data: 'test'})\n myHttpFunction.get('/path')" },
{ command: "firebase functions:config:set <key>=<val>", description: "Set environment config for functions (legacy).", details: "Example: firebase functions:config:set api.key='SECRET'\nAccess in code: functions.config().api.key\n\nNOTE: For 2nd gen functions, use --set-env-vars or\ndefineSecret() / defineString() from firebase-functions/params." },
{ command: "firebase functions:config:get", description: "View current function config values.", details: "Outputs JSON of all environment config." },
{ command: "firebase functions:config:unset <key>", description: "Remove an environment config key.", details: "Example: firebase functions:config:unset api.key" },
{ command: "firebase functions:config:clone --from <project>", description: "Clone function config from another project.", details: "Copy environment config between projects." },
{ command: "firebase functions:delete <name>", description: "Delete a deployed Cloud Function.", details: "Options:\n --region <region> Specify region\n --force Skip confirmation prompt" },
{ command: "firebase functions:secrets:set <name>", description: "Create/update a secret in Secret Manager.", details: "For 2nd gen functions. Secrets are stored in\nGoogle Cloud Secret Manager.\nAccess via defineSecret() in code." },
{ command: "firebase functions:secrets:get <name>", description: "Get metadata for a secret.", details: "Shows secret versions and status." },
{ command: "firebase functions:secrets:destroy <name>", description: "Destroy a secret and all its versions.", details: "Permanently removes the secret." }
],
"π₯ Firestore": [
{ command: "firebase firestore:delete <path>", description: "Delete documents/collections from Firestore.", details: "Options:\n --recursive Delete subcollections too\n --shallow Delete document only\n --all-collections Delete ALL data\n\nExample:\n firebase firestore:delete users/uid123 --recursive" },
{ command: "firebase firestore:indexes", description: "List all Firestore composite indexes.", details: "Shows index configuration and status." },
{ command: "firebase deploy --only firestore:rules", description: "Deploy Firestore security rules only.", details: "Deploys the firestore.rules file." },
{ command: "firebase deploy --only firestore:indexes", description: "Deploy Firestore indexes only.", details: "Deploys firestore.indexes.json." },
{ command: "firebase deploy --only firestore", description: "Deploy both Firestore rules and indexes.", details: "Deploys rules and indexes together." }
],
"ποΈ Realtime Database": [
{ command: "firebase database:get <path>", description: "Read data from Realtime Database.", details: "Options:\n --output <file> Save to file\n --order-by <key> Order results\n --limit-to-first <n>\n --limit-to-last <n>\n\nExample: firebase database:get /users --output users.json" },
{ command: "firebase database:set <path>", description: "Overwrite data at a database path.", details: "Replaces ALL data at the specified path.\nOptions:\n --data '<json>' Inline JSON data\n < file.json Pipe from file" },
{ command: "firebase database:push <path>", description: "Push new data to a list at a database path.", details: "Creates a new child with auto-generated key.\n --data '<json>' Inline JSON data" },
{ command: "firebase database:update <path>", description: "Update specific fields at a database path.", details: "Merges data (doesn't overwrite siblings).\n --data '<json>' Inline JSON data" },
{ command: "firebase database:remove <path>", description: "Delete data at a database path.", details: "Removes all data at and below the path.\nExample: firebase database:remove /temp-data" },
{ command: "firebase database:profile", description: "Profile Realtime Database usage.", details: "Records operations for analysis.\nOptions:\n --duration <seconds> Recording time\n --output <file> Save profile data" },
{ command: "firebase deploy --only database", description: "Deploy Realtime Database rules.", details: "Deploys database.rules.json." },
{ command: "firebase database:instances:create <id>", description: "Create a new database instance.", details: "Options:\n --location us-central1 | europe-west1" },
{ command: "firebase database:instances:list", description: "List all Realtime Database instances.", details: "Shows instance name, URL, and state." }
],
"π Auth": [
{ command: "firebase auth:import <file>", description: "Import user accounts from a JSON/CSV file.", details: "Options:\n --hash-algo <algo> BCRYPT, SCRYPT, HMAC_SHA256, etc.\n --rounds <n> Hash rounds\n --hash-key <key> Signer key (base64)\n\nJSON format: {\"users\": [{\"localId\": \"...\", ...}]}" },
{ command: "firebase auth:export <file>", description: "Export all user accounts to a file.", details: "Options:\n --format json|csv Output format\n\nExports: UID, email, phone, providers, metadata." }
],
"π¦ Storage": [
{ command: "firebase deploy --only storage", description: "Deploy Cloud Storage security rules.", details: "Deploys the storage.rules file." },
{ command: "firebase init storage", description: "Initialize Storage rules file.", details: "Creates storage.rules with default template." }
],
"π§ͺ Emulators": [
{ command: "firebase emulators:start", description: "Start all configured local emulators.", details: "Default ports:\n β’ Auth: 9099\n β’ Functions: 5001\n β’ Firestore: 8080\n β’ Database: 9000\n β’ Hosting: 5000\n β’ Pub/Sub: 8085\n β’ Storage: 9199\n β’ UI: 4000\n\nOptions:\n --only <emulators> Comma-separated\n --import <dir> Import saved data\n --export-on-exit <dir> Auto-export on shutdown" },
{ command: "firebase emulators:start --import ./data --export-on-exit ./data", description: "Start emulators with persistent data.", details: "Import previously exported data on startup and\nautomatically export data when emulators stop.\nEssential for local development persistence." },
{ command: "firebase emulators:exec <script>", description: "Run a script with emulators, then shut down.", details: "Perfect for CI/CD testing.\nExample: firebase emulators:exec 'npm test'\n\nStarts emulators β runs script β stops emulators.\nExit code matches the script's exit code." },
{ command: "firebase emulators:export <dir>", description: "Export emulator data to a directory.", details: "Exports: Auth accounts, Firestore documents,\nRealtime Database data, Storage files." },
{ command: "firebase emulators:start --only functions,firestore", description: "Start specific emulators only.", details: "Available: auth, functions, firestore, database,\nhosting, pubsub, storage, eventarc" },
{ command: "firebase setup:emulators:firestore", description: "Download the Firestore emulator binary.", details: "Manually download a specific emulator JAR." },
{ command: "firebase setup:emulators:ui", description: "Download the Emulator UI.", details: "The UI runs at http://localhost:4000 by default." }
],
"π’ Deployment": [
{ command: "firebase deploy", description: "Deploy all configured services.", details: "Deploys everything in firebase.json:\n Hosting, Functions, Firestore rules/indexes,\n Database rules, Storage rules, Extensions.\n\nOptions:\n --only <services> Deploy specific services\n --except <services> Exclude services\n --message <msg> Add deploy message\n --force Skip confirmation prompts\n -P <project> Deploy to specific project" },
{ command: "firebase deploy --only hosting,functions", description: "Deploy multiple specific services.", details: "Comma-separated list (no spaces)." },
{ command: "firebase deploy --except functions", description: "Deploy everything except functions.", details: "Useful to avoid slow function deployments." },
{ command: "firebase deploy --message 'v2.1 release'", description: "Deploy with a version message/label.", details: "Shows in the Firebase Console deploy history." },
{ command: "firebase hosting:rollback", description: "Roll back Hosting to the previous version.", details: "Instant rollback via the console or CLI." }
],
"π Extensions": [
{ command: "firebase ext:install <publisher/extension>", description: "Install a Firebase Extension.", details: "Example:\n firebase ext:install firebase/firestore-send-email\n\nBrowse extensions: https://extensions.dev" },
{ command: "firebase ext:list", description: "List installed extensions.", details: "Shows extension ID, version, and instance ID." },
{ command: "firebase ext:info <publisher/extension>", description: "View details about an extension.", details: "Shows description, APIs used, and parameters." },
{ command: "firebase ext:update <instance-id>", description: "Update an installed extension.", details: "Update to the latest version." },
{ command: "firebase ext:uninstall <instance-id>", description: "Uninstall a Firebase Extension.", details: "Removes the extension and its resources." },
{ command: "firebase ext:configure <instance-id>", description: "Reconfigure an installed extension.", details: "Change parameter values for the extension." }
],
"π§ App Management": [
{ command: "firebase apps:list", description: "List all apps in the Firebase project.", details: "Shows Web, iOS, and Android apps with their IDs." },
{ command: "firebase apps:create WEB <name>", description: "Register a new Web app.", details: "Creates a new web app and returns the app ID." },
{ command: "firebase apps:create IOS <name>", description: "Register a new iOS app.", details: "Options: --bundle-id <id>, --app-store-id <id>" },
{ command: "firebase apps:create ANDROID <name>", description: "Register a new Android app.", details: "Options: --package-name <pkg>" },
{ command: "firebase apps:sdkconfig WEB <app-id>", description: "Get the Firebase SDK config for a web app.", details: "Outputs the firebaseConfig object:\n apiKey, authDomain, projectId, storageBucket, etc.\n\nOptions: --out <file> Save to file" },
{ command: "firebase apps:android:sha:create <app-id> <sha>", description: "Add an SHA hash to an Android app.", details: "Required for features like Google Sign-In." }
],
"π Remote Config": [
{ command: "firebase remoteconfig:get", description: "Download current Remote Config template.", details: "Options:\n --output <file> Save template to file\n\nOutput is JSON with parameters and conditions." },
{ command: "firebase remoteconfig:rollback", description: "Roll back Remote Config to a previous version.", details: "Options: --version-number <n>" },
{ command: "firebase remoteconfig:versions:list", description: "List Remote Config version history.", details: "Shows version number, update time, and user." }
],
"π App Distribution": [
{ command: "firebase appdistribution:distribute <file>", description: "Upload an APK/IPA to App Distribution.", details: "Options:\n --app <app-id> Firebase app ID\n --release-notes <notes> Release notes\n --testers <emails> Comma-separated\n --groups <groups> Tester groups" },
{ command: "firebase appdistribution:testers:add <emails>", description: "Add testers to App Distribution.", details: "Comma-separated email addresses." },
{ command: "firebase appdistribution:testers:remove <emails>", description: "Remove testers from App Distribution.", details: "Comma-separated email addresses." }
],
"π οΈ Misc & Utilities": [
{ command: "firebase --version", description: "Show the installed Firebase CLI version.", details: "Current latest: 13.x+" },
{ command: "firebase help", description: "Show general help or command-specific help.", details: "Usage:\n firebase help β General help\n firebase help deploy β Deploy help\n firebase <cmd> --help β Command help" },
{ command: "firebase open", description: "Open a Firebase resource in the browser.", details: "Resources: console, hosting, hosting:site, functions,\nfunctions:log, database, firestore, storage,\ncrashlytics, analytics, performance, auth" },
{ command: "firebase target:apply hosting <target> <resource>", description: "Set deploy targets for multi-site hosting.", details: "Example:\n firebase target:apply hosting blog my-blog-site\n firebase deploy --only hosting:blog" },
{ command: "firebase target:remove hosting <target>", description: "Remove a deploy target.", details: "Removes the target from .firebaserc." },
{ command: "firebase experiments:list", description: "List available CLI experiments/features.", details: "Shows experimental features that can be enabled." },
{ command: "firebase experiments:enable <experiment>", description: "Enable an experimental CLI feature.", details: "Example: firebase experiments:enable webframeworks" }
],
"ποΈ Frameworks": [
{ command: "firebase experiments:enable webframeworks", description: "Enable web framework support (Next.js, Angular, etc.).", details: "Supports:\n β’ Next.js (SSR/SSG)\n β’ Angular (Universal)\n β’ Nuxt / SvelteKit\n β’ Express.js\n\nAuto-detects framework and configures deployment." },
{ command: "firebase init hosting (with frameworks)", description: "Initialize hosting for a web framework project.", details: "After enabling webframeworks experiment:\n β’ Auto-detects framework\n β’ Configures SSR via Cloud Functions/Cloud Run\n β’ Sets up correct build pipeline" }
]
};
// ββββββββββββββββββββββββββββββββββββββββββββ
// STATE
// ββββββββββββββββββββββββββββββββββββββββββββ
const categories = Object.keys(FIREBASE_COMMANDS);
let activeCategory = categories[0];
// Flatten for search
const allCommandsFlat = [];
for (const [cat, cmds] of Object.entries(FIREBASE_COMMANDS)) {
for (const cmd of cmds) {
allCommandsFlat.push({ ...cmd, _category: cat });
}
}
// ββββββββββββββββββββββββββββββββββββββββββββ
// RENDER SIDEBAR
// ββββββββββββββββββββββββββββββββββββββββββββ
function renderSidebar() {
const container = document.getElementById('sidebarButtons');
container.innerHTML = '';
for (const cat of categories) {
const count = FIREBASE_COMMANDS[cat].length;
const btn = document.createElement('button');
btn.className = 'cat-btn' + (cat === activeCategory ? ' active' : '');
btn.innerHTML = `${escapeHtml(cat)} <span class="cmd-count">${count}</span>`;
btn.addEventListener('click', () => {
document.getElementById('searchInput').value = '';
showCategory(cat);
// Close mobile sidebar
document.getElementById('sidebar').classList.remove('open');
document.getElementById('overlay').classList.remove('open');
});
container.appendChild(btn);
}
}
// ββββββββββββββββββββββββββββββββββββββββββββ
// SHOW CATEGORY
// ββββββββββββββββββββββββββββββββββββββββββββ
function showCategory(cat) {
activeCategory = cat;
renderSidebar();
const commands = FIREBASE_COMMANDS[cat] || [];
renderMain(cat, commands, false);
}
// ββββββββββββββββββββββββββββββββββββββββββββ
// RENDER MAIN CONTENT
// ββββββββββββββββββββββββββββββββββββββββββββ
function renderMain(title, commands, showBadge) {
const main = document.getElementById('mainContent');
const count = commands.length;
const plural = count !== 1 ? 's' : '';
if (commands.length === 0) {
main.innerHTML = `
<div class="main-header">
<h2>${escapeHtml(title)}</h2>
</div>
<div class="no-results">
<div class="emoji">π</div>
<h3>No commands found</h3>
<p>Try a different search term</p>
</div>
`;
return;
}
let html = `
<div class="main-header">
<h2>${escapeHtml(title)}</h2>
<div class="subtitle">${count} command${plural}</div>
</div>
`;
commands.forEach((cmd, i) => {
const id = `details-${Date.now()}-${i}`;
html += `
<div class="card">
<div class="card-top">
<div class="cmd">${escapeHtml(cmd.command)}</div>
<button class="copy-btn" onclick="copyCommand(this, '${escapeAttr(cmd.command)}')">
π Copy
</button>
</div>
${showBadge && cmd._category ? `<span class="category-badge">${escapeHtml(cmd._category)}</span>` : ''}
<div class="description">${escapeHtml(cmd.description)}</div>
${cmd.details ? `
<button class="details-toggle" onclick="toggleDetails('${id}', this)">
<span class="arrow">βΆ</span> Details
</button>
<div class="details-content" id="${id}">${escapeHtml(cmd.details)}</div>
` : ''}
</div>
`;
});
main.innerHTML = html;
main.scrollTop = 0;
}
// ββββββββββββββββββββββββββββββββββββββββββββ
// SEARCH
// ββββββββββββββββββββββββββββββββββββββββββββ
document.getElementById('searchInput').addEventListener('input', function () {
const q = this.value.trim().toLowerCase();
if (!q) {
showCategory(activeCategory);
return;
}
const results = allCommandsFlat.filter(cmd =>
cmd.command.toLowerCase().includes(q) ||
cmd.description.toLowerCase().includes(q) ||
(cmd.details || '').toLowerCase().includes(q)
);
// Clear sidebar active
document.querySelectorAll('.cat-btn').forEach(b => b.classList.remove('active'));
renderMain(`π Search: "${this.value}"`, results, true);
});
// ββββββββββββββββββββββββββββββββββββββββββββ
// ACTIONS
// ββββββββββββββββββββββββββββββββββββββββββββ
function copyCommand(btn, text) {
navigator.clipboard.writeText(text).then(() => {
btn.classList.add('copied');
btn.textContent = 'β Copied!';
setTimeout(() => {
btn.classList.remove('copied');
btn.textContent = 'π Copy';
}, 1500);
});
}
function toggleDetails(id, btn) {
const el = document.getElementById(id);
el.classList.toggle('open');
btn.classList.toggle('open');
}
function toggleSidebar() {
document.getElementById('sidebar').classList.toggle('open');
document.getElementById('overlay').classList.toggle('open');
}
// ββββββββββββββββββββββββββββββββββββββββββββ
// UTILS
// ββββββββββββββββββββββββββββββββββββββββββββ
function escapeHtml(str) {
const div = document.createElement('div');
div.textContent = str;
return div.innerHTML;
}
function escapeAttr(str) {
return str.replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/"/g, '"');
}
// ββββββββββββββββββββββββββββββββββββββββββββ
// KEYBOARD SHORTCUT
// ββββββββββββββββββββββββββββββββββββββββββββ
document.addEventListener('keydown', (e) => {
// Ctrl+K or Cmd+K to focus search
if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
e.preventDefault();
document.getElementById('searchInput').focus();
}
// Escape to clear search
if (e.key === 'Escape') {
const input = document.getElementById('searchInput');
if (input.value) {
input.value = '';
showCategory(activeCategory);
}
input.blur();
}
});
// ββββββββββββββββββββββββββββββββββββββββββββ
// INIT
// ββββββββββββββββββββββββββββββββββββββββββββ
renderSidebar();
showCategory(activeCategory);
</script>
</body>
</html>