Flutter + Firebase Functions and Hosting recommended folder structure

Viewed 193

As my project grows I'm wanting to setup an elegant and scalable folder structure but I'm unsure what the best practices are.

My project includes a

  • Flutter app
  • Firebase Functions
  • Firebase Hosting with a static landing page and will soon have 2 Angular apps

My current structure is this:

Root flutter app
 |
 +-- README.md
 +-- package.json (with flutter build commands)
 +-- Flutter code (lib, test assets etc)
 |
 +-- Firebase
 |   |
 |   +-- package.json (with firebase build commands)
 |   +-- Functions
 |   |   |
 |   |   +-- src (functions code)
 |   |   |
 |   +-- Firestore
 |   |   |
 |   |   +-- firestore.rules
 |   |   +-- firestore.indexes

Should my root directory look like this:

- Flutter
- Firebase (Functions, hosting, firestore)

Or something more like this:

- Flutter
- Functions
- Hosting (App1, App2, Static landing etc)
- Firestore

But then where is best to keep build files and deploy scripts for each site/service/app?

I haven't implemented CI/CD yet, but I plan to implement it soon, so I'd probably want to take that into consideration.

Thanks for any advice!

0 Answers
Related