Upgrade to Node.js SDK Admin SDK v10 (modular SDK) Stay organized with collections Save and categorize content based on your preferences.
Version 10 of the Admin Node.js SDK introduces two important changes:
- Support for Node.js 10 is discontinued (this is abreaking change)
- The SDK has adopted a modular API pattern
This guide provides instructions and information to help developers upgradeexisting Node.js apps from earlier versions of theAdmin SDK to v10.
Update Node.js to v12 or higher
With the Admin Node.js SDK v10 release, Firebase has discontinued support forNode.js 10. Developers must use Node.js 12 or higher when using theAdmin SDK.If you're using the Admin Node.js SDK together withCloud Functions for Firebase,make sure that you haveupgraded your Node.js versionto 12 or higher.
Use modules instead of namespaces
Since its inception, the Admin Node.js SDK has offered a stable API structuredas a nested namespace hierarchy. As a result, you might have become familiarwith writing code that looks like this:
// Import the global admin namespaceimport*asadminfrom'firebase-admin';constapp:admin.app.App=admin.initializeApp();consttoken:string=awaitadmin.auth().createCustomToken('alice');constuser:admin.auth.UserRecord=awaitadmin.auth().getUser('bob');Starting from v10, the Admin Node.js SDK offers multiple module entry pointswith named exports. We recommend developers to use these new entry points toaccess the various APIs of the SDK, as opposed to using the globaladminnamespace.
Here’s what the above example would look like with the new moduleentry points:
TypeScript
// Import only what you needimport{initializeApp,App}from'firebase-admin/app';import{getAuth,UserRecord}from'firebase-admin/auth';constapp:App=initializeApp();consttoken:string=awaitgetAuth().createCustomToken('alice');constuser:UserRecord=getAuth().getUser('bob');Node.js
// Import only what you needconst{initializeApp}=require('firebase-admin/app');const{getAuth}=require('firebase-admin/auth');constapp=initializeApp();consttoken=awaitgetAuth().createCustomToken('alice');constuser=getAuth().getUser('bob');Using v10 modular entry points
Note that, in the examples above, you are no longer importing a globaladminnamespace. Instead, you explicitly import only the symbols you need from severalmodule entry points. Also, TypeScript developers no longer have to use triple-nested type identifiers likeadmin.auth.UserRecord andadmin.database.Reference. Since each type belongs to exactly one module, youcan just import them by their short names likeUserRecord andReference.
Here are all the module entry points available in the SDK as of v10:
- firebase-admin/app
- firebase-admin/auth
- firebase-admin/database
- firebase-admin/firestore
- firebase-admin/instance-id
- firebase-admin/machine-learning
- firebase-admin/messaging
- firebase-admin/project-management
- firebase-admin/remote-config
- firebase-admin/security-rules
- firebase-admin/storage
The following table shows the replacement import syntax for each of the legacynamespace functions:
| v9 | v10 |
|---|---|
admin.initializeApp() | import { initializeApp } from 'firebase-admin/app'
|
admin.app() | import { getApp } from 'firebase-admin/ap'
|
admin.credential.cert() | import { cert } from 'firebase-admin/app'
|
admin.auth() | import { getAuth } from 'firebase-admin/auth'
|
admin.database() | import { getDatabase } from 'firebase-admin/database'
|
admin.firestore() | import { getFirestore } from 'firebase-admin/firestore'
|
admin.instanceId() | import { getInstanceId } from 'firebase-admin/instance-id'
|
admin.machineLearning() | import { getMachineLearning } from 'firebase-admin/machine-learning'
|
admin.messaging() | import { getMessaging } from 'firebase-admin/messaging'
|
admin.projectManagement() | import { getProjectManagement } from 'firebase-admin/project-management'
|
admin.remoteConfig() | import { getRemoteConfig } from 'firebase-admin/remote-config'
|
admin.securityRules() | import { getSecurityRules } from 'firebase-admin/security-rules'
|
admin.storage() | import { getStorage } from 'firebase-admin/storage'
|
Use exported functions instead of methods on App
In the legacy API, theApp object exposed a number of methods likeapp.auth() andapp.database(). We recommend developers to avoid using thesemethods, and instead use the same module entry points described above to obtainservice instances scoped to a givenApp object, and perform other app-specifictasks.
| v9 | v10 |
|---|---|
app.auth() | import { getAuth } from 'firebase-admin/auth';
|
app.database() | import { getDatabase } from 'firebase-admin/database';
|
app.database(url) | import { getDatabaseWithUrl } from 'firebase-admin/database';
|
app.firestore() | import { getFirestore } from 'firebase-admin/firestore'
|
app.instanceId() | import { getInstanceId } from 'firebase-admin/instance-id'
|
app.machineLearning() | import { getMachineLearning } from 'firebase-admin/machine-learning'
|
app.messaging() | import { getMessaging } from 'firebase-admin/messaging'
|
app.projectManagement() | import { getProjectManagement } from 'firebase-admin/project-management'
|
app.remoteConfig() | import { getRemoteConfig } from 'firebase-admin/remote-config'
|
app.securityRules() | import { getSecurityRules } from 'firebase-admin/security-rules'
|
app.storage() | import { getStorage } from 'firebase-admin/storage'
|
app.delete() | import { deleteApp } from 'firebase-admin/app';
|
ES modules support
Node.js 12 and above come with experimental support for ES modules, enablingeven non-TypeScript developers to use theexport andimport keywords intheir code. Starting from the v10 release, the Admin Node.js SDK also providesES modules support, so that developers implementing ES modules on plain Node.jscan import the SDK usingimport syntax.
To use ES modules with theAdmin SDK, first make sure you have enabled ESMsupport for your Node.js runtime. This is usually done by adding a"type":"module" field to yourpackage.json file. Then you can write application codethat looks like this:
// With {type: module} in the package.json...// Import only what you needimport{initializeApp}from'firebase-admin/app';import{getAuth}from'firebase-admin/auth';constapp=initializeApp();consttoken=awaitgetAuth().createCustomToken('alice');constuser=getAuth().getUser('bob');Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-05 UTC.