mobile backends with google cloud platform (mbltdev'14)
TRANSCRIPT
Google confidential │ Do not distribute
Google confidential │ Do not distribute
Building mobile app backendwith Google Cloud PlatformDmitry NefedkinGoogle Cloud Platform Solutions Engineer
Natalia Efimtseva Developer Relations Program Manager
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
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
Source: http://blogs.telerik.com/platform/posts/14-05-13/introducing-telerik-platform-developer-edition-for-just-$39-monthSource: Developer Economics Q3 2014: State of the Developer Nation
`
2.9Mmobile developers worldwide
2Mapps alreadydeveloped
Source: http://fraudforthought.com/index.php/its-an-apps-world/Source: Developer Economics Q3 2014: State of the Developer Nation
Source: http://41mag.fr/wp-content/themes/channel/images/menuHtml5.pngSource: Developer Economics Q3 2014: State of the Developer Nation
HTML5 is used by
42%of developers as a technology for app development
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.htmSource: Developer Economics Q3 2014: State of the Developer Nation
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
Google confidential │ Do not distribute
A Network that Spans the Globe
Google confidential │ Do not distribute
A Network that Spans the Globe
Google confidential │ Do not distribute
Continue to Innovate & Improve our Tooling
SpannerDremelMapReduce
Big Table ColossusCompute
Engine
2012 2014+2002 2004 2006 2008 2010
GFS
2013
More!
Google confidential │ Do not distribute
Storage
Cloud Storage Cloud SQL Cloud Datastore
Compute
Compute EngineApp Engine
App Services
BigQuery Cloud Endpoints
Google Cloud Platform
Google confidential │ Do not distribute
Mobile Gaming Storage
Big Data Highly Scalable Apps Digital Marketing
Yes, We Can Power That
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
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
Pretty old & well-deserved Horse...
Image source: http://www.ehow.com/way_5475563_feed-three-year-old-horse.html
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
… but with the new carriage
Image source: http://www.today.com/news/history-wheels-5-things-know-about-queens-new-carriage-2D79756846
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!
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
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
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
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
Google confidential | Do not distribute
Demo: a case management app for mobile workers
getTask().execute()
Cloud Datastore
App Engine backend
Clou
d En
dpoi
nts
Cases app
Clie
nt L
ibra
ries
Demo Architecture
pullFromRemote
pushToRemotestoreTask().execute()
query.get() transaction.commit()
Chrome Mgmt Extension
getAllCases().execute()
updateCases().execute()
Java
scri
pt L
ibra
ries
Cloud Endpoints Tutorial for Android: github.com/GoogleCloudPlatform/endpoints-codelab-android
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
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
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
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
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
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
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.”
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
Google confidential │ Do not distribute
Firebase Forge
The Firebase Forge provides a convenient GUI for visualizing and manipulating your data in real-time.
Google confidential │ Do not distribute
Firebase demo: image drawing application
https://github.com/Dnefedkin/Firebase-Drawing-Demo-Android
Google confidential │ Do not distribute
cloud.google.com
Dmitry Nefedkin ([email protected])Google Cloud Platform Solutions Engineer
Natalia Efimtseva ([email protected])Developer Relations Program Manager
Images by Connie Zhou