8. When I joined
BOM almost finalised
iOS prototype (built by contractor)
Firmware prototype (built by Charlie)
⚡ Bluetooth proof-of-concept (Android)
First tech hire
9. The big
challenge
● 3 months
● Android and iOS
● Bluetooth Low Energy
● User accounts
● Data storage
● Analytics
23. Test your rules!
Targaryen is a former Great House of Westeros and
was the ruling royal House of the Seven Kingdoms
for three centuries, before it was deposed during
Robert's Rebellion and House Baratheon replaced it
as the new royal House. The few surviving
Targaryens fled into exile. Currently based in Essos,
House Targaryen seeks to retake the Seven
Kingdoms from House Lannister, who formally
replaced House Baratheon as the royal House
following the destruction of the Great Sept of Baelor.
http://gameofthrones.wikia.com/wiki/House_Targaryen
24. Test your rules!
targaryen = require 'targaryen'
rules = require 'rules.json'
describe 'Destinations', ->
beforeEach ->
targaryen.setFirebaseRules rules
targaryen.setFirebaseData
destinations:
queen:
buckingham_palace:
latitude: 51.5013021
longitude: -0.148308
it 'cannot be read publicly', ->
expect targaryen.users.unauthenticated
.cannotRead '/destinations'
25. Test your rules!
it 'can be read by owner', ->
expect uid: 'queen'
.canRead '/destinations/queen'
it 'cannot be read by others', ->
expect {}
.cannotRead '/destinations/queen'
expect uid: 'mayor'
.cannotRead '/destinations/queen'
26. Test your rules!
it 'can be created by owner', ->
expect uid: 'queen'
.canWrite '/destinations/queen/trafalgar_square',
latitude: 51.5069249
longitude: -0.1297893
it 'cannot be created by others', ->
[{}, uid: 'peasant']
.forEach (user) ->
expect user
.cannotWrite '/destinations/queen/trafalgar_square',
latitude: 51.5069249
longitude: -0.1297893
27. Test your rules!
it 'can be re-named by owner', ->
expect uid: 'queen'
.canWrite '/destinations/queen/buckingham_palace/name',
'Home'
28. Test your rules!
$ firebase-bolt rules.bolt
$ node node_modules/jasmine/bin/jasmine.js
// package.json
{
"scripts": {
"test": "..."
}
}
$ npm test
29. Test your rules!
language: node_js
node_js: "6"
before_script:
- npm install
script:
- npm test
- ./deploy
30. Automatic
deployment
#!/bin/bash
set -e
if [ "$TRAVIS_PULL_REQUEST" == "false" ] ; then
if [ "$TRAVIS_BRANCH" == "master" ] ; then
FIREBASE_PROJECT="my-staging-project"
fi
if [ "$TRAVIS_BRANCH" == "release" ] ; then
FIREBASE_PROJECT="my-production-project"
fi
fi
if [ -n "$FIREBASE_PROJECT" ] ; then
node "node_modules/firebase-tools/bin/firebase"
--project "$FIREBASE_PROJECT"
--token "$FIREBASE_TOKEN"
deploy
--message "$TRAVIS_COMMIT")
fi
31. Automatic
deployment
$ npm test
bolt: Generating rules.json...
Started
...............................................................
...............................................................
...............................................................
..........................
215 specs, 0 failures
Finished in 0.5 seconds
The command "npm test" exited with 0.
$ ./deploy
Deploying to 'master' beeline-test-e7288
=== Deploying to 'beeline-test-e7288'...
i deploying database, functions
✔ database: rules ready to deploy.
i starting release process (may take several minutes)...
✔ Deploy complete!
46. How did it go?
● Android + iOS
○ Worked in parallel
○ Integration/migration in a few weeks
○ Offline “just works” (but a bit slow)
● rules.json
○ A bit of a learning curve
○ No servers to manage
○ Querying the data is not straightforward
59. What we like
so far
● Easy to set up
● Use as much as you like
● Realtime DB updates
● Minimal backend code
● Detailed docs
60. What we like
less so far
● A bit of a learning curve
● Lacking examples
● Limited querying
● Testing functions is slow
● Slow to load lots of data
● In flux
61. What’s next
● More in-depth stats
● Large data → Long term (cheaper)
storage
● Functions error logging
● Statically typed functions
● Emails/push for in-app events