Project Setup Get a basic backend project started with Stripe (NodeJS) & Firebase Cloud Functions.

This lesson is available for PRO members or as a single course purchase. Sign-in and choose a plan below.


*Enrollment provides full access to this course (and updates) for life.

Or Signup for Unlimited PRO Access

Git Branch 1

In this section, we accomplish the following tasks

  1. Create a new Firebase Project and make sure to enable billing. Your project will still be free on the Blaze plan.
  2. Initialize Cloud Functions by running firebase init functions. This repo uses TypeScript, but feel free to use vanilla JS and omit the type annotations where applicable.
  3. Signup for Stripe and the API key to the functions environment.
  4. Initialize Firebase Admin & the Stripe Node SDK

command line
firebase init functions

cd functions
npm i stripe
npm i @types/stripe -D

file_type_typescript config.ts
// Initialize Firebase Admin
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
admin.initializeApp();

// Initialize Cloud Firestore Database
export const db = admin.firestore();
const settings = { timestampsInSnapshots: true };
db.settings(settings);

// ENV Variables
export const stripeSecret = functions.config().stripe.secret;

// Export Stripe
import * as Stripe from 'stripe'; 
export const stripe = new Stripe(stripeSecret);

Q&A Chat