Mobile backends with Google Cloud Platform (MBLTDev'14)
1. Google confidential │ Do not distributeGoogle confidential │ Do not distribute
Building mobile app backend
with Google Cloud Platform
Dmitry Nefedkin
Google Cloud Platform Solutions Engineer
Natalia Efimtseva
Developer Relations Program Manager
2. Google confidential │ Do not distribute
Agenda
Google Cloud Platform - why should I care?
“API-first” backend development with Google Cloud endpoints
“Frontend-first” approach and how Firebase can help
1
2
3
3. Google confidential │ Do not distribute
Agenda
Google Cloud Platform - why should I care?
“API-first” backend development with Google Cloud endpoints
“Frontend-first” approach and how Firebase can help
1
2
3
7. Developers target
2.2platform on average
Source: http://www.techtimes.com/articles/13106/20140815/android-ios-combined-market-share-swells-leaving-2-5-percent-for-windows-phone.htm
Source: Developer Economics Q3 2014: State of the Developer Nation
8. Google confidential │ Do not distribute
For the past 15 years, Google
has been building out the
world’s fastest, most powerful,
highest quality cloud
infrastructure on the planet.
Images by Connie Zhou
11. Google confidential │ Do not distribute
Continue to Innovate & Improve our Tooling
SpannerDremelMapReduce
Big Table Colossus
Compute
Engine
2012 2014+2002 2004 2006 2008 2010
GFS
2013
More!
12. Google confidential │ Do not distribute
Storage
Cloud Storage Cloud SQL
Cloud
Datastore
Compute
Compute
Engine
App Engine
App Services
BigQuery
Cloud
Endpoints
Google Cloud Platform
13. Google confidential │ Do not distribute
Mobile Gaming Storage
Big Data Highly Scalable Apps Digital Marketing
Yes, We Can Power That
14. Google confidential │ Do not distribute
Agenda
Google Cloud Platform - why should I care?
“API-first” backend development with Google Cloud endpoints
“Frontend-first” approach and how Firebase can help
1
2
3
15. API-First development: What & Why
Image from “How API-First Development Boosts Productivity”
full story - http://goo.gl/o3WBIq
What:
every piece of shared
functionality for your
organization it should be
exposed as a RESTful HTTP API
to all of your other developers
Why:
● Enforcing separation of
concerns;
● Hiding complexity
“API Economy” is coming
16. Pretty old & well-deserved Horse...
Image source: http://www.ehow.com/way_5475563_feed-three-year-old-horse.html
17. Google App Engine: easy to build, scale, maintain
● Java, Python, PHP, Go Support
● Rapid application development
● Scale infinitely
● Replicated data storage
● Versioning and Traffic Splitting
● Familiar development tools
18. … but with the new carriage
Image source: http://www.today.com/news/history-wheels-5-things-know-about-queens-new-carriage-2D79756846
19. Google Cloud Endpoints
Extremely simple way to expose server side logic on full
power, management free Google App Engine platform
• Uses App Engine’s auto-scaling and high-availability
• Exposes standards based REST interfaces with built-in
authorization
• Auto-generates strongly typed, mobile optimized client libraries
for Android, iOS and web.
• Makes you more productive!
20. Taking the plumbing out of API programming
Mobile Backend Running on
Google App Engine Instances
Mobile Backend Running on
Google App Engine Instances
Mobile Backend Running on
Google App Engine Instances
Cloud
Endpoints
Clients
21. Android Studio + Cloud Endpoints
Easiest way for mobile
developers to connect to
Google Cloud Platform
• Create Google App Engine
backends in Android Studio
• Generate Java-specific bindings
for use in Android app
• Benefit from as-you-type
validations and quick-fixes when
defining the backend API
• Use App Engine-specific Gradle
tooling that allows for a unified
client/backend build
22. Call Cloud Endpoints API from iOS
● Generate RPC Discovery documents in AndroidStudio using
appengineEndpointsGetDiscoveryDocs Gradle task
● Download and build ServiceGenerator
● Use ServiceGenerator command line utility to generate Objective-C code from
RPC Discovery document
● Include generated Objective-C files to your XCode project
● Add code to call Cloud Endpoints API from the UI of the app
For more info: http://goo.gl/JhdaVW
23. Call Cloud Endpoints API from Javascript
• Use the Google Javascript Client Library
<script src="https://apis.google.com/js/client.js?onload=init"></script>
• Load the endpoint
var ROOT = 'https://your_app_id.appspot.com/_ah/api';
gapi.client.load('your_api_name', 'v1', function() { doSomethingAfterLoading();}, ROOT);
• Use the endpoint:
gapi.client.tictactoe.scores.insert({'outcome':
'WON'}).execute(function(resp) {
console.log(resp);
});
More info: http://goo.gl/5ynKEb
24. Google confidential | Do not distribute
Demo: a case management app for mobile workers
26. Google confidential | Do not distribute
● Delivers > 700 million photos &
videos per day (May, 2014)
● Heavy user of App Engine services
● 3 M DAU
● Started to use Compute Engine for
some services
Snapchat
27. Google confidential | Do not distribute
● Angry Birds for Chrome, FB
● Using the Datastore to store
game data
● Memcache API
● Task Queues for Background
Operations
● Users API for Authentication
Rovio
28. Google confidential | Do not distribute
● SongPop - “guess a song
application”
● Serves 18TB a day with 80
million users
● Fetching media from Google
Cloud Storage
● Just 3-4 developers per
project
FreshPlanet
29. Google confidential │ Do not distribute
Ok, I wanna try!
cloud.google.com/free-trial
● 300$ - Google Cloud Platform Credits
● 60 days
● all products (max 2 concurrent cores for
Google Compute Engine)
● still have to enter credit card details
during the registration
30. Google confidential │ Do not distribute
Agenda
Google Cloud Platform - why should I care?
“API-first” backend development with Google Cloud endpoints
“Frontend-first” approach and how Firebase can help
1
2
3
31. Google confidential │ Do not distribute
API-first is cool but...
● we do not have dedicated
backend developers;
● we want to prototype quickly;
● we just need to store the data
and sync them between the
connected clients;
● we need offline support;
Image source: https://beingsakin.files.wordpress.com/2011/11/yesbut.jpg
32. Google confidential │ Do not distribute
Firebase
“Over the past three years,
we’ve gone from a crazy
idea that ‘just might work’ to
a proven product used by
110,000 developers. Today,
I couldn’t be happier to
announce that we’ve joined
Google.”
33. Google confidential │ Do not distribute
Firebase
● Server and NoSQL database to
interact with through API calls
● Sync data from multiple applications
● Simple Login Service with several
types of built-in authentication
● Security: SSL encryption & security
rules
● Support offline mode
34. Google confidential │ Do not distribute
Firebase Forge
The Firebase Forge
provides a
convenient GUI for
visualizing and
manipulating your
data in real-time.
35. Google confidential │ Do not distribute
Firebase demo: image drawing application
https://github.com/Dnefedkin/Firebase-Drawing-Demo-Android
36. Google confidential │ Do not distribute
cloud.google.com
Dmitry Nefedkin (nda@google.com)
Google Cloud Platform Solutions Engineer
Natalia Efimtseva (nataliae@google.com)
Developer Relations Program Manager
Images by Connie Zhou