SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
Stitch 101:
App Development in a Serverless World
Nick Larew, Sr Developer Educator, MongoDB
Who Am I?
Live in New York City
Work as a Developer Educator for MongoDB
Started developing web apps six years ago
Love Live Music and Cats
Application Architecture
Modern Application Demands
Serve many users across multiple countries and device types
Scale elastically to meet unexpected or inconsistent demand
Coordinate data from multiple sources
Secure data to prevent malicious actors and ensure privacy
Full-Stack Application Components
➔ Authenticate users and allow
them to use app features.
➔ Handle data requests and
execute business logic.
➔ Provide an interface for users to
interact with your app.
➔ Handle user actions and send
requests to the app server.
Client Applications Application Servers Database Servers
➔ Store and search persisted
application data.
➔ Manage data integrity,
consistency, and availability.
Traditional Applications
➔ You develop and host one or
more secure app servers.
➔ You manage database server
connections and authentication.
➔ You research, develop, and
manage all business logic and
application features.
➔ You authenticate and authorize
incoming user requests.
➔ You develop and distribute one
or more frontend applications.
➔ You write custom client code to
connect your frontend to the
application server.
➔ You host static assets, such as
images or audio, on your server.
➔ You maintain all client features
and fix any bugs.
Client Applications Application Servers Database Servers
➔ You configure, provision, and
spin up one or more servers.
➔ You monitor activity logs,
diagnose performance issues,
and handle network failures.
➔ You develop a system to backup
and restore data.
➔ You ensure data integrity and
security.
Traditional Applications
➔ You develop and host one or
more secure app servers.
➔ You manage database server
connections and authentication.
➔ You research, develop, and
manage all business logic and
application features.
➔ You authenticate and authorize
incoming user requests.
➔ You develop and distribute one
or more frontend applications.
➔ You write custom client code to
connect your frontend to the
application server.
➔ You host static assets, such as
images or audio, on your server.
➔ You maintain all client features
and fix any bugs.
Client Applications Application Servers Database Servers
➔ You configure, provision, and
spin up one or more servers.
➔ You monitor activity logs,
diagnose performance issues,
and handle network failures.
➔ You develop a system to backup
and restore data.
➔ You ensure data integrity and
security.
Third-Party Services and APIs
➔ You develop and host one or
more secure app servers.
➔ You manage database server
connections and authentication.
➔ Third-party services handle
complex or common tasks that
are not unique to your app.
➔ Users can log in through another
service using OAuth or JWT.
➔ You develop and distribute one
or more frontend applications.
➔ You write custom client code to
connect your frontend to the
application server.
➔ You host static assets, such as
images or audio, on your server.
➔ You maintain all client features
and fix any bugs.
Client Applications Application Servers Database Servers
➔ You configure, provision, and
spin up one or more servers.
➔ You monitor activity logs,
diagnose performance issues,
and handle network failures.
➔ You develop a system to backup
and restore data.
➔ You ensure data integrity and
security.
Service-Oriented Architectures
➔ You develop and host one or
more secure app servers.
➔ You manage database service
connections and authentication.
➔ Most features are modeled as a
combination of internal and
third-party services.
➔ Users can log in through another
service using OAuth or JWT.
➔ You develop and distribute one
or more frontend applications.
➔ You write custom client code to
connect your frontend to the
application server.
➔ A hosting service manages and
distributes static assets.
➔ You maintain most client
features and fix most bugs.
Client Applications Application Servers Database Servers
➔ A database service hosts and
manages data infrastructure.
➔ The service monitors activity logs
and automatically handles
network failures.
➔ The service can automatically
backup and restore data.
➔ The service enforces data
security best practices.
Serverless Architectures
➔ Application servers are managed
and deployed as a service.
➔ The serverless platform handles
application requests and
database queries as a service.
➔ Features are a combination of
internal and third-party services.
➔ Users can log in through another
service using OAuth or JWT.
➔ You develop and distribute one
or more frontend applications.
➔ Your frontend connects to the
application platform with a native
SDK, driver, or library.
➔ A hosting service manages and
distributes static assets.
➔ Common “boilerplate” features
are handled by the app platform.
Client Applications Application Servers Database Servers
➔ A database service hosts and
manages data infrastructure.
➔ The service monitors activity logs
and automatically handles
network failures.
➔ The service can automatically
backup and restore data.
➔ The service enforces data
security best practices.
Stitch Application Stack
➔ Authenticate users and allow
them to use app features.
➔ Handle data requests and
execute business logic.
➔ Provide an interface for users to
interact with your app.
➔ Handle user actions and send
requests to the app server.
Client Applications Application Servers Database Servers
➔ Store and search persisted
application data.
➔ Manage data integrity,
consistency, and availability.
Demo: Concert Finder
Demo Application Overview
Functionality
➔ Find concerts happening next week in your neighborhood
➔ Add some favorite venues to your personal list
➔ View other users’ favorite venues
Services
➔ Eventful
◆ Search for upcoming events and venues close to an address
➔ Google Maps
◆ Geocode addresses & locations
Demo Application Overview
Follow Along
concerts.nlarew.com
See the Code
github.com/nlarew/stitch-concert-finder
User Authentication
// Import Stitch Client SDK
import {
Stitch,
UserPasswordCredential
} from "mongodb-stitch-browser-sdk";
// Connect a client to your Stitch app
const appId = "myapp-abcde";
const app = Stitch.initializeAppClient(appId);
// Log in using user-provided credentials
const credential = new UserPasswordCredential(
"SomeUser465@example.com",
"myPassword"
)
// Log in using user-provided credentials
app.auth.loginWithCredential(credential)
.then(user => {
console.log(`Logged in as: ${user}`)
})
Built-In Identity Providers
➔ Anonymous
➔ Email / Password
➔ OAuth 2.0 (Facebook & Google)
➔ API Key (Server & User)
➔ Custom (Bring Your Own Auth)
Application Users
➔ Associated with one or more identities
➔ Must authenticate to send requests
➔ Trigger authentication events
MongoDB Service
// Import MongoDB Service
import {
Stitch,
RemoteMongoClient
} from "mongodb-stitch-browser-sdk";
const app = Stitch.getAppClient("myapp-abcde");
// Instantiate a MongoDB service client
const mongo = app.getServiceClient(
RemoteMongoClient.factory,
"myCluster"
)
const myCollection = mongo
.db("myDb")
.collection("myColl");
// Query MongoDB directly from your application
myCollection.find({}).toArray().then(docs => {
console.log("Found documents:", docs)
})
Query Anywhere
➔ Work with standard MQL queries
➔ Dynamically control what each user sees
Schemas & Filters
➔ Configure the shape and contents of
documents in a collection.
➔ Validate changes to a document
Real-time Change Streams
➔ Watch for changes to documents
External Services
exports = async function() {
// Instantiate an AWS S3 service client
const aws = context.services.get("myAWS");
const s3 = aws.s3("us-east-1");
// Send a GetObject request for a cool image
const result = await s3.GetObject({
"Bucket": "myAppImages",
"Key": "cool-image.png",
})
// Convert the image binary to a string
const imageData = result.Body.text()
return imageData
}
Connect with Service Interfaces
➔ Add credentials to built-in service interfaces
➔ Configure custom HTTP services
Send Requests with Service Actions
➔ Call methods in Functions and SDKs
➔ Authorize actions with dynamic rules
Receive Requests with Webhooks
➔ Receive incoming HTTP payloads
➔ Handle events and requests in a Function
Functions & Triggers
exports = function(changeEvent) {
// Parse values from the insert change event
// changeEvent.operationType === "INSERT"
const insertedDoc = changeEvent.fullDocument
const { _id, name } = insertedDoc;
// Instantiate a MongoDB service client
const cluster = context.services.get("myCluster");
const myDb = cluster.db("myDb");
const myColl = myDb.collection("myColl");
myColl.updateOne({ _id }, {
"$set": { "someField": "$set" }
})
}
Invoke Serverless Functions
➔ Written in JavaScript (ES6+)
➔ Execute dynamically based on context
➔ Run as a specific application user
➔ Connect to your application components
➔ Callable from an SDK or another Function
Trigger Functions on Events
➔ React to changes in a MongoDB collection
➔ Execute logic when users are created or log in
➔ Schedule functions with CRON expressions
Server-Side Rules
// Only return documents where the user’s id
// is the value of the "owner_id" field.
{
"owner_id": "%%user.id",
}
// Run a function to determine if the user is
// authorized to insert a new document.
{ "%%true": {
"%function": {
"name": "isAuthorizedUser",
"arguments": ["%%root._id", "%%user.id"]
}
} }
// Validate service action arguments
{
"%%args.url": "https://www.mongodb.com/",
}
Declarative Expressions
➔ Specify rule conditions with a document
➔ Access specific request/document values.
Dynamic Evaluation
➔ Add complex and/or personalized rules with
expansions and operators.
Secure by Default
➔ If an action does not pass any rule, Stitch
prevents the action
What I Did What I Didn’t Do
Allowed users to create accounts
Retrieved and cached data from
external services
Queried Data from MongoDB
Defined rules to manage user
access to data
Deploy application server
infrastructure
Hassle with cryptography and
complex authentication flows
Configure, host, and manage a
database
Next Steps
Stitch Docs
docs.mongodb.com/stitch
Free Online Courses
university.mongodb.com
Get Started
mongodb.com/cloud/stitch
Thank You!

Más contenido relacionado

La actualidad más candente

Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
維佋 唐
 

La actualidad más candente (20)

Consume Spring Data Rest with Angularjs
Consume Spring Data Rest with AngularjsConsume Spring Data Rest with Angularjs
Consume Spring Data Rest with Angularjs
 
Building Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel AppelBuilding Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel Appel
 
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
 
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDBMongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
 
Exploring an API with Blocks
Exploring an API with BlocksExploring an API with Blocks
Exploring an API with Blocks
 
AWS Lambda, Step Functions & MongoDB Atlas Tutorial
AWS Lambda, Step Functions & MongoDB Atlas TutorialAWS Lambda, Step Functions & MongoDB Atlas Tutorial
AWS Lambda, Step Functions & MongoDB Atlas Tutorial
 
Ajax
AjaxAjax
Ajax
 
Learn AJAX at ASIT
Learn AJAX at ASITLearn AJAX at ASIT
Learn AJAX at ASIT
 
Asp.net server control
Asp.net  server controlAsp.net  server control
Asp.net server control
 
Building Android apps with Parse
Building Android apps with ParseBuilding Android apps with Parse
Building Android apps with Parse
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Overhauling a database engine in 2 months
Overhauling a database engine in 2 monthsOverhauling a database engine in 2 months
Overhauling a database engine in 2 months
 
Making connected apps with BaaS (Droidcon Bangalore 2014)
Making connected apps with BaaS (Droidcon Bangalore 2014)Making connected apps with BaaS (Droidcon Bangalore 2014)
Making connected apps with BaaS (Droidcon Bangalore 2014)
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
 
MongoDB .local Bengaluru 2019: Realm: The Secret Sauce for Better Mobile Apps
MongoDB .local Bengaluru 2019: Realm: The Secret Sauce for Better Mobile AppsMongoDB .local Bengaluru 2019: Realm: The Secret Sauce for Better Mobile Apps
MongoDB .local Bengaluru 2019: Realm: The Secret Sauce for Better Mobile Apps
 
MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...
MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...
MongoDB .local Bengaluru 2019: The Journey of Migration from Oracle to MongoD...
 
A serverless IoT story from design to production and monitoring
A serverless IoT story from design to production and monitoringA serverless IoT story from design to production and monitoring
A serverless IoT story from design to production and monitoring
 
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
 
Ajax Tuturial
Ajax TuturialAjax Tuturial
Ajax Tuturial
 
Google App Engine Developer - Day2
Google App Engine Developer - Day2Google App Engine Developer - Day2
Google App Engine Developer - Day2
 

Similar a MongoDB.local Berlin: App development in a Serverless World

Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecurities
amiable_indian
 
Introduction to Backend Development (1).pptx
Introduction to Backend Development (1).pptxIntroduction to Backend Development (1).pptx
Introduction to Backend Development (1).pptx
OsuGodbless
 
CTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App FabricCTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App Fabric
Spiffy
 
MSWD:MERN STACK WEB DEVELOPMENT COURSE CODE
MSWD:MERN STACK WEB DEVELOPMENT COURSE CODEMSWD:MERN STACK WEB DEVELOPMENT COURSE CODE
MSWD:MERN STACK WEB DEVELOPMENT COURSE CODE
annalakshmi35
 

Similar a MongoDB.local Berlin: App development in a Serverless World (20)

Evolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di PalmaEvolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDB
 
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
 
cross-platform-assets-based-front-end-architecture
cross-platform-assets-based-front-end-architecturecross-platform-assets-based-front-end-architecture
cross-platform-assets-based-front-end-architecture
 
MongoDB World 2018: Evolving your Data Access with MongoDB Stitch
MongoDB World 2018: Evolving your Data Access with MongoDB StitchMongoDB World 2018: Evolving your Data Access with MongoDB Stitch
MongoDB World 2018: Evolving your Data Access with MongoDB Stitch
 
Easy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applicationsEasy integration of Bluemix services with your applications
Easy integration of Bluemix services with your applications
 
Webscarab demo @ OWASP Belgium
Webscarab demo @ OWASP BelgiumWebscarab demo @ OWASP Belgium
Webscarab demo @ OWASP Belgium
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecurities
 
Event-Based API Patterns and Practices
Event-Based API Patterns and PracticesEvent-Based API Patterns and Practices
Event-Based API Patterns and Practices
 
Accessing REST & Backend as a Service (BaaS) - Developer Direct - Mobile Summ...
Accessing REST & Backend as a Service (BaaS) - Developer Direct - Mobile Summ...Accessing REST & Backend as a Service (BaaS) - Developer Direct - Mobile Summ...
Accessing REST & Backend as a Service (BaaS) - Developer Direct - Mobile Summ...
 
SRV421 Deep Dive with AWS Mobile Services
SRV421 Deep Dive with AWS Mobile ServicesSRV421 Deep Dive with AWS Mobile Services
SRV421 Deep Dive with AWS Mobile Services
 
Cloud-native Patterns
Cloud-native PatternsCloud-native Patterns
Cloud-native Patterns
 
Cloud-native Patterns (July 4th, 2019)
Cloud-native Patterns (July 4th, 2019)Cloud-native Patterns (July 4th, 2019)
Cloud-native Patterns (July 4th, 2019)
 
Test Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and CucumberTest Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and Cucumber
 
15-factor-apps.pdf
15-factor-apps.pdf15-factor-apps.pdf
15-factor-apps.pdf
 
James Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 PatternsJames Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 Patterns
 
Introduction to Backend Development (1).pptx
Introduction to Backend Development (1).pptxIntroduction to Backend Development (1).pptx
Introduction to Backend Development (1).pptx
 
CTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App FabricCTU June 2011 - Windows Azure App Fabric
CTU June 2011 - Windows Azure App Fabric
 
MSWD:MERN STACK WEB DEVELOPMENT COURSE CODE
MSWD:MERN STACK WEB DEVELOPMENT COURSE CODEMSWD:MERN STACK WEB DEVELOPMENT COURSE CODE
MSWD:MERN STACK WEB DEVELOPMENT COURSE CODE
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB Stitch
 

Más de MongoDB

Más de MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

Último

Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Último (20)

%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 

MongoDB.local Berlin: App development in a Serverless World

  • 1. Stitch 101: App Development in a Serverless World Nick Larew, Sr Developer Educator, MongoDB
  • 2. Who Am I? Live in New York City Work as a Developer Educator for MongoDB Started developing web apps six years ago Love Live Music and Cats
  • 4. Modern Application Demands Serve many users across multiple countries and device types Scale elastically to meet unexpected or inconsistent demand Coordinate data from multiple sources Secure data to prevent malicious actors and ensure privacy
  • 5. Full-Stack Application Components ➔ Authenticate users and allow them to use app features. ➔ Handle data requests and execute business logic. ➔ Provide an interface for users to interact with your app. ➔ Handle user actions and send requests to the app server. Client Applications Application Servers Database Servers ➔ Store and search persisted application data. ➔ Manage data integrity, consistency, and availability.
  • 6. Traditional Applications ➔ You develop and host one or more secure app servers. ➔ You manage database server connections and authentication. ➔ You research, develop, and manage all business logic and application features. ➔ You authenticate and authorize incoming user requests. ➔ You develop and distribute one or more frontend applications. ➔ You write custom client code to connect your frontend to the application server. ➔ You host static assets, such as images or audio, on your server. ➔ You maintain all client features and fix any bugs. Client Applications Application Servers Database Servers ➔ You configure, provision, and spin up one or more servers. ➔ You monitor activity logs, diagnose performance issues, and handle network failures. ➔ You develop a system to backup and restore data. ➔ You ensure data integrity and security.
  • 7. Traditional Applications ➔ You develop and host one or more secure app servers. ➔ You manage database server connections and authentication. ➔ You research, develop, and manage all business logic and application features. ➔ You authenticate and authorize incoming user requests. ➔ You develop and distribute one or more frontend applications. ➔ You write custom client code to connect your frontend to the application server. ➔ You host static assets, such as images or audio, on your server. ➔ You maintain all client features and fix any bugs. Client Applications Application Servers Database Servers ➔ You configure, provision, and spin up one or more servers. ➔ You monitor activity logs, diagnose performance issues, and handle network failures. ➔ You develop a system to backup and restore data. ➔ You ensure data integrity and security.
  • 8. Third-Party Services and APIs ➔ You develop and host one or more secure app servers. ➔ You manage database server connections and authentication. ➔ Third-party services handle complex or common tasks that are not unique to your app. ➔ Users can log in through another service using OAuth or JWT. ➔ You develop and distribute one or more frontend applications. ➔ You write custom client code to connect your frontend to the application server. ➔ You host static assets, such as images or audio, on your server. ➔ You maintain all client features and fix any bugs. Client Applications Application Servers Database Servers ➔ You configure, provision, and spin up one or more servers. ➔ You monitor activity logs, diagnose performance issues, and handle network failures. ➔ You develop a system to backup and restore data. ➔ You ensure data integrity and security.
  • 9. Service-Oriented Architectures ➔ You develop and host one or more secure app servers. ➔ You manage database service connections and authentication. ➔ Most features are modeled as a combination of internal and third-party services. ➔ Users can log in through another service using OAuth or JWT. ➔ You develop and distribute one or more frontend applications. ➔ You write custom client code to connect your frontend to the application server. ➔ A hosting service manages and distributes static assets. ➔ You maintain most client features and fix most bugs. Client Applications Application Servers Database Servers ➔ A database service hosts and manages data infrastructure. ➔ The service monitors activity logs and automatically handles network failures. ➔ The service can automatically backup and restore data. ➔ The service enforces data security best practices.
  • 10. Serverless Architectures ➔ Application servers are managed and deployed as a service. ➔ The serverless platform handles application requests and database queries as a service. ➔ Features are a combination of internal and third-party services. ➔ Users can log in through another service using OAuth or JWT. ➔ You develop and distribute one or more frontend applications. ➔ Your frontend connects to the application platform with a native SDK, driver, or library. ➔ A hosting service manages and distributes static assets. ➔ Common “boilerplate” features are handled by the app platform. Client Applications Application Servers Database Servers ➔ A database service hosts and manages data infrastructure. ➔ The service monitors activity logs and automatically handles network failures. ➔ The service can automatically backup and restore data. ➔ The service enforces data security best practices.
  • 11. Stitch Application Stack ➔ Authenticate users and allow them to use app features. ➔ Handle data requests and execute business logic. ➔ Provide an interface for users to interact with your app. ➔ Handle user actions and send requests to the app server. Client Applications Application Servers Database Servers ➔ Store and search persisted application data. ➔ Manage data integrity, consistency, and availability.
  • 13. Demo Application Overview Functionality ➔ Find concerts happening next week in your neighborhood ➔ Add some favorite venues to your personal list ➔ View other users’ favorite venues Services ➔ Eventful ◆ Search for upcoming events and venues close to an address ➔ Google Maps ◆ Geocode addresses & locations
  • 14. Demo Application Overview Follow Along concerts.nlarew.com See the Code github.com/nlarew/stitch-concert-finder
  • 15. User Authentication // Import Stitch Client SDK import { Stitch, UserPasswordCredential } from "mongodb-stitch-browser-sdk"; // Connect a client to your Stitch app const appId = "myapp-abcde"; const app = Stitch.initializeAppClient(appId); // Log in using user-provided credentials const credential = new UserPasswordCredential( "SomeUser465@example.com", "myPassword" ) // Log in using user-provided credentials app.auth.loginWithCredential(credential) .then(user => { console.log(`Logged in as: ${user}`) }) Built-In Identity Providers ➔ Anonymous ➔ Email / Password ➔ OAuth 2.0 (Facebook & Google) ➔ API Key (Server & User) ➔ Custom (Bring Your Own Auth) Application Users ➔ Associated with one or more identities ➔ Must authenticate to send requests ➔ Trigger authentication events
  • 16. MongoDB Service // Import MongoDB Service import { Stitch, RemoteMongoClient } from "mongodb-stitch-browser-sdk"; const app = Stitch.getAppClient("myapp-abcde"); // Instantiate a MongoDB service client const mongo = app.getServiceClient( RemoteMongoClient.factory, "myCluster" ) const myCollection = mongo .db("myDb") .collection("myColl"); // Query MongoDB directly from your application myCollection.find({}).toArray().then(docs => { console.log("Found documents:", docs) }) Query Anywhere ➔ Work with standard MQL queries ➔ Dynamically control what each user sees Schemas & Filters ➔ Configure the shape and contents of documents in a collection. ➔ Validate changes to a document Real-time Change Streams ➔ Watch for changes to documents
  • 17. External Services exports = async function() { // Instantiate an AWS S3 service client const aws = context.services.get("myAWS"); const s3 = aws.s3("us-east-1"); // Send a GetObject request for a cool image const result = await s3.GetObject({ "Bucket": "myAppImages", "Key": "cool-image.png", }) // Convert the image binary to a string const imageData = result.Body.text() return imageData } Connect with Service Interfaces ➔ Add credentials to built-in service interfaces ➔ Configure custom HTTP services Send Requests with Service Actions ➔ Call methods in Functions and SDKs ➔ Authorize actions with dynamic rules Receive Requests with Webhooks ➔ Receive incoming HTTP payloads ➔ Handle events and requests in a Function
  • 18. Functions & Triggers exports = function(changeEvent) { // Parse values from the insert change event // changeEvent.operationType === "INSERT" const insertedDoc = changeEvent.fullDocument const { _id, name } = insertedDoc; // Instantiate a MongoDB service client const cluster = context.services.get("myCluster"); const myDb = cluster.db("myDb"); const myColl = myDb.collection("myColl"); myColl.updateOne({ _id }, { "$set": { "someField": "$set" } }) } Invoke Serverless Functions ➔ Written in JavaScript (ES6+) ➔ Execute dynamically based on context ➔ Run as a specific application user ➔ Connect to your application components ➔ Callable from an SDK or another Function Trigger Functions on Events ➔ React to changes in a MongoDB collection ➔ Execute logic when users are created or log in ➔ Schedule functions with CRON expressions
  • 19. Server-Side Rules // Only return documents where the user’s id // is the value of the "owner_id" field. { "owner_id": "%%user.id", } // Run a function to determine if the user is // authorized to insert a new document. { "%%true": { "%function": { "name": "isAuthorizedUser", "arguments": ["%%root._id", "%%user.id"] } } } // Validate service action arguments { "%%args.url": "https://www.mongodb.com/", } Declarative Expressions ➔ Specify rule conditions with a document ➔ Access specific request/document values. Dynamic Evaluation ➔ Add complex and/or personalized rules with expansions and operators. Secure by Default ➔ If an action does not pass any rule, Stitch prevents the action
  • 20. What I Did What I Didn’t Do Allowed users to create accounts Retrieved and cached data from external services Queried Data from MongoDB Defined rules to manage user access to data Deploy application server infrastructure Hassle with cryptography and complex authentication flows Configure, host, and manage a database
  • 21. Next Steps Stitch Docs docs.mongodb.com/stitch Free Online Courses university.mongodb.com Get Started mongodb.com/cloud/stitch