All work

Open Cloud

Cloud drive across your own Firebase projects

Year
2022
Kind
Apps
Status
Finished

A Flutter cloud drive over your own Firebase projects. Add as many as you like; each brings its own free Storage quota, and you browse, upload, stream and share files in any of them.

Open Cloud has no backend of its own. You import a google-services.json for each Firebase project at runtime; the first one hosts sign-in and a Firestore list of the others. Each project appears as its own drive, with uploads and progress, folders, a built-in audio and video player, and share links from Firebase download URLs. More projects means more total space, but each file lives in one project.

The problem

Every Firebase project comes with its own free Storage quota, which the README puts at 5 GB stored and 1 GB of downloads a day. Open Cloud is a Flutter app that lets you connect as many of your own Firebase projects as you like, then browse, upload, stream and share files in each one. There is no shared backend: the app talks straight to your projects.

How it works

  1. 01

    Point the app at a base project

    On first launch you pick a google-services.json, the config file Firebase generates for an Android app. The app parses it into FirebaseOptions and starts Firebase with it at runtime, so no project is compiled into the build. You then create an account on that base project, or sign in to one, with your own email and password, and Firebase Auth's on-device session keeps you signed in. Earlier versions signed in with an account derived from the project's API key, which isn't secret, so those installs get a one-time step that sets a real password and moves the account to your email once you click the verification link.

  2. 02

    Keep the project list in Firestore

    Each extra project's config is saved as a document in a projects collection in the base project's Firestore. Each document records the uid of the account that added it, and the app reads back only your own. At startup it starts every entry as its own named Firebase app, and a config whose API key is already registered is refused. Point a second phone at the same base project, sign in, and the whole list comes back.

  3. 03

    Browse and upload per project

    Each project's Storage bucket shows up as its own drive. The browser lists one path at a time, and uploads run as Firebase UploadTasks, tracked on an uploads page with live progress. Firebase Storage has no real folders, only paths, so making a folder writes an empty placeholder file inside it.

  4. 04

    Stream or share by link

    For a file, the app asks Storage for its download URL, a link with an access token built in. Tapping an mp3, opus, mp4 or jpg plays it from that URL in the built-in player, with the rest of the folder queued, so nothing is downloaded first. Copy Link puts the same URL on the clipboard, and anyone with it can open the file.

Decisions

  • Bring your own projects

    There is no server of mine in between, so there's nothing to host or pay for, and each project you add brings its own quota. The trade-off is setup: you create the Firebase projects, turn on Storage in each, and turn on Firestore and email sign-in in the first.

  • Configs at runtime, not build time

    Everyone installs the same release APK and imports their own configs in the app. The parser checks every field it reads and names the one that's missing, instead of failing on a null.

  • Projects stay isolated

    Each project is a separate Firebase app with its own bucket and its own quota. A full or broken project doesn't affect the others.

Known issues

  • The extra projects' Storage buckets are opened without signing in, so their Security Rules can't yet be limited to the owner.