Going serverless with Firebase


Ephemeral Exchange is a cross platform cache that allows you share transient data across a range of platforms without the need for authentication, but by sharing access keys between participants. The code is open source, but I also run a hosted version which I use myself, but have also opened up freely to others.  The initial platform was a mash up of AppEngine, Node, Redis and Firebase, Docker, Compute Engine with a React/Redux console. But it was becoming a problem
  • Monthly costs were running at $150 as Appengine and compute engine don't have appropriate free tiers.
  • Although in the cloud, I still had to worry a little about firewalls, load balancing and managing servers.
  • I would need to maintain SSL certificates - another cost. 
Last month I decide to move the whole thing to Cloud functions and Firebase/Firestore and Google Analytics because
  • The free tier for Firebase is good enough for the majority of current usage
  • I no longer have to care about infrastructure complications
  • You get a free SSL certificate for custom domain with Firebase hosting
  • Storing historical analytics can get expensive (and ironic since they apply to ephemeral data) 

Going serverless

Normally apps such as these, you'd need a server on which to run the API and a database to act as a store. The servers role would be to interpret the requests, deal with the data base and serve up responses. It might also do things like authorization,  analytics,  optimization and push notification. This means you need quite a few moving parts, all of which have to be configured to know about each other and talk to each other.

Cloud functions could be thought of as dormant, stateless server instances that spring to life when provoked, do a little bit of work, then go away again. The event driven capabilities of real time databases such as Firebase and Firestore do away with the need of servers to manage state, and their push notification capability remove the need for a server instance to manage communication. The combination of these is what makes going serverless a possibility. 


This series of articles will walk through the various things that I needed to figure out to make the transition, and wish that I had known when I started - hopefully some of it will be of help to others doing the same thing. 


Code repositories

All the code is open source, and can be found at