This is a monorepo for the Nx toolkits. It contains the following toolkits:
- @nx-toolkits/firebase - Generate Firebase Functions apps (Node.js & Python) and configure Firebase Hosting (experimental)
This toolkit helps you integrate Firebase services into your Nx workspace:
- Firebase Functions (Node.js) - Generate Cloud Functions apps with optional Genkit AI support
- Firebase Functions (Python) - Generate Python Cloud Functions with pytest and linting
- Firebase Hosting
⚠️ Experimental - Configure hosting for any static Nx app
We generate a Firebase Functions app using the @nx-toolkits/firebase:functions and
connect it to the Firebase project using the --project option. This allows for
normal firebase cli commands to be used to work, as if it was an app generated
using firebase cli.
Install the generator in an nx workspace:
npm install -D @nx-toolkits/firebaseUse the generator to generate a Firebase Functions app:
nx g @nx-toolkits/firebase:functionsThis will generate a Firebase Functions app in the apps folder.
| Option | alias | Description |
|---|---|---|
--name |
The name of the nx app to create. | |
--firebaseProject |
--project |
The Firebase project to connect to. |
--codebase |
The codebase to use. Learn more about Firebase Codebase. | |
--nodeVersion |
The runtime node version to use on firebase functions (14, 16, 18, 20, or 22). | |
--genkit |
Add Firebase Genkit support with developer UI and required dependencies. | |
--directory |
The directory to create the app in. | |
--tags |
Tags to add to the app. | |
--dry-run |
Run through without making changes. |
You can deploy a Firebase Functions app using the nx run deploy command:
nx run my-functions-app:deployThe above with run linting, building, and then deploy the app to Firebase.
You can also use firebase-tools to deploy the app:
firebase deploy --only functionsYou can lint a Firebase Functions app using the nx run lint command:
nx run my-functions-app:lintYou can build a Firebase Functions app using the nx run build command:
nx run my-functions-app:buildGenerate Firebase Functions with Genkit support for building AI-powered applications:
nx g @nx-toolkits/firebase:functions --genkitLaunch the Genkit Developer UI:
nx run my-functions-app:genkit-uiLearn more in the package documentation.
- Add support for Firebase functions
- Add support for Firebase Genkit
- Add support for Firebase hosting (experimental)
- Add support for Firebase Emulators integration
- Add support for Firebase App Hosting (managed SSR)