Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.

Project structure · Backend

Firebase (Cloud Functions and security rules) project structure

Opens with credits

For students building an app on Firebase who need a real backend: Cloud Functions (2nd gen) in TypeScript, Firestore and Storage security rules with tests, and the Local Emulator Suite. The tree starts from firebase init and grows into feature folders of callables, triggers and scheduled jobs, then adds CI deploys, environments, contract tests and runbooks.

Curated by Tauseef FayyazIntermediate137 files and foldersFirebase CLI 15.32, firebase-functions 7.4, firebase-admin 14.5Checked October 2026
Explore the filesPick any file to see what it is, why it exists and when you add it.

How it grows

Each stage opens the explorer there

  1. 1Day 1What the scaffold and your first hour give you21 files and folders
  2. 2GrowingWhat a real app with features and tests adds+59 files and folders
  3. ProductionWhat running it for real users adds+25 files and foldersOpens with credits
  4. ExpertWhat a team needs to keep it healthy for years+32 files and foldersOpens with credits

How it is organised

  • Security rules are your real backend for anything the app reads or writes directly. Write them deny-first, and test every rule with the emulator before it ships.
  • Clients write only what the user owns. Anything that involves money, roles, counts or other users goes through a callable function, where the server decides.
  • functions/src/index.ts is a list of exports; code lives in feature folders (orders, users, notifications) with shared helpers in shared/. A feature never imports another feature.
  • Every trigger is idempotent: events can arrive twice or out of order, so check whether the work was done before doing it.
  • Configuration comes from params: plain values in functions/.env files per project, secrets in Secret Manager through defineSecret. Nothing secret is committed.
  • Develop and test against the Local Emulator Suite with a demo- project id, so tests never touch real data and cost nothing.
  • Set cost guards from day 1: maxInstances, a region close to your database, and a budget alert on the Google Cloud project.
  • Only CI deploys, and always with --only, so each deploy changes exactly what the pull request changed.

At the top of the project

Open one in the explorer for the full story

Learn more on Sefism

Roadmaps, cheat sheets and projects that go with Firebase (Cloud Functions and security rules).

See 7 more
Checked against 18 official sources, October 2026. If something has changed, the docs win.Show sources

Picked from the other libraries by shared topics.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.

  • 1:1 Mentorship
  • Fresh Graduate Mentorship
  • Career Guidance

Brand deals, promos and partnerships: tauseeffayyaz@gmail.com