# Advent of Code, Day 10: Setting up Firebase

- Link: https://cagrimmett.com/2019/12/11/advent-day-10/
- Published: 2019-12-11T02:46:00-05:00
- Author: Chuck Grimmett

Day 10!

I had a [conversation on Twitter](https://twitter.com/cagrimmett/status/1204393278755528704)
with Sam Selikoff and Ilya Radchenko, then later on Slack with Ilya and Dave Wasmer
about using Firebase + EmberFire + Ember Data vs GraphQL + Hasura (Sam’s suggestion)
vs GraphQL + Fauna (Ilya’s suggestion) for my data needs. I appreciate their inputs
and arguments, but I ultimately went with Firebase + EmberFire for two reasons:

 1. I don’t want to set up and maintain an API server for this project. That knocks
    out Hasura.
 2. Fauna looks cool, but I don’t know either Ember Data or GraphQL that well, so I’ll
    have to learn one. Firebase + EmberFire + Ember Data is a little more battle tested
    and there is more documentation and search results for it vs Fauna, so I’m going
    to stick with that. I don’t want to be stuck in the dark on this project or constantly
    bug Ilya or Dave about stuff I don’t know. I do that enough at work.

So that means I set up Firebase and [EmberFire](https://firebaseopensource.com/projects/firebase/emberfire/)
today. It was surprisingly easy! The quickstart guide was solid. I was saving Ember
Data to Firebase and retrieving it in my routes in no time.

I modified my Add a Garden form to save to Firebase, then transitioned to the Edit
route where I passed along the ID of the garden I just created an retrieved the 
garden record’s data in the route. Then I read the [Ember Data relationships docs](https://guides.emberjs.com/release/models/relationships/)
and was able to both save and retrieve a garden’s related plants.

Then I got stuck: I tried to pass the plant data to the calendar component to render
the chart and I can’t get it to work. The data isn’t coming through as I expect.
I assume it has something to do with [relationships in Ember data as promises](https://guides.emberjs.com/release/models/relationships/),
but haven’t quite figured the solution out yet. So that will be tomorrow’s project.

I feel like I’m making progress, though! It was super satisfying to see my collections
and documents appear in Firebase.
