SlideShare a Scribd company logo
Building a social network
in under 4 weeks with
Serverless and
GraphQL
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
bootstrapped startup: severe constraints on time & money
Building a social network in under 4 weeks with Serverless and GraphQL
speed of development
speed of development
scale to millions of users
speed of development
scale to millions of users
minimal up-keep
speed of development
scale to millions of users
minimal up-keep
cost efficient
@theburningmonk theburningmonk.com
1 fulltime FE developer (mobile app)
1 fulltime FE developer (CMS)
1 partime BE developer (me)
~7 weeks
~3 weeks
~4 weeks
@theburningmonk theburningmonk.com
S3CloudFront
@theburningmonk theburningmonk.com
Cognito User Pool
S3CloudFront
@theburningmonk theburningmonk.com
Cognito User Pool AppSync
S3CloudFront DynamoDB
Lambda
@theburningmonk theburningmonk.com
Cognito User Pool AppSync
DynamoDB
Lambda
S3CloudFront
@theburningmonk theburningmonk.com
Cognito User Pool AppSync
DynamoDB
Lambda
S3
Algolia
CloudFront
@theburningmonk theburningmonk.com
Cognito User Pool AppSync
DynamoDB
Lambda
S3 AlgoliaCloudFront Lambda
Algolia
@theburningmonk theburningmonk.com
Cognito User Pool AppSync
DynamoDB
Lambda
S3
Firehose
Algolia
CloudFront
S3
Lambda Algolia
@theburningmonk theburningmonk.com
Cognito User Pool AppSync
DynamoDB
Lambda
S3
Firehose
AthenaAlgolia
CloudFront
S3
Lambda Algolia
@theburningmonk theburningmonk.com
Cognito User Pool AppSync
DynamoDB
Lambda
S3
Firehose
AthenaAlgolia
CloudFront
S3
Lambda Algolia
@theburningmonk theburningmonk.com
AWS Organization
productionstagingdevshared
root
OU OU OU OU
@theburningmonk theburningmonk.com
AWS Organization
productionstagingdevshared
root
OU OU OU OU
Users
Audit
Dev Staging Production
@theburningmonk theburningmonk.com
AWS Organization
productionstagingdevshared
root
OU OU OU OU
Users
Audit
Dev Staging Production
SCPs
@theburningmonk theburningmonk.com
1 fulltime FE developer (mobile app)
1 fulltime FE developer (CMS)
1 partime BE developer (me)
~7 weeks
~3 weeks
~4 weeks
Building a social network in under 4 weeks with Serverless and GraphQL
Yan Cui
http://theburningmonk.com
@theburningmonk
AWS user for 10 years
http://bit.ly/yubl-serverless
Yan Cui
http://theburningmonk.com
@theburningmonk
Developer Advocate @
Building a social network in under 4 weeks with Serverless and GraphQL
Yan Cui
http://theburningmonk.com
@theburningmonk
Independent Consultant
advisetraining delivery
theburningmonk.com/courses
theburningmonk.com/courses
realworldserverless.com
@theburningmonk theburningmonk.com
What is GraphQL?
@theburningmonk theburningmonk.com
schema
@theburningmonk theburningmonk.com
schema server
@theburningmonk theburningmonk.com
schema server data sources
DynamoDB
RDS
ElasticSearch
@theburningmonk theburningmonk.com
What is AppSync?
@theburningmonk theburningmonk.com
schema server data sources
DynamoDB
RDS
ElasticSearch
AppSync
Lambda
@theburningmonk theburningmonk.com
AppSync
@theburningmonk theburningmonk.com
AppSync
Profile
@theburningmonk theburningmonk.com
AppSync
Profile
@theburningmonk theburningmonk.com
AppSync
Profile
Sport
@theburningmonk theburningmonk.com
AppSync
Profile
Sport
paginated!
@theburningmonk theburningmonk.com
AppSync
Profile
Sport
paginated! Activities
@theburningmonk theburningmonk.com
AppSync
Profile
Sport
paginated! Activities
@theburningmonk theburningmonk.com
AppSync
Profile
Sport
paginated! Activities
@theburningmonk theburningmonk.com
AppSync
Profile
Sport
paginated! Activities
very flexible!
@theburningmonk theburningmonk.com
AppSync
Profile
Sport
paginated! Activities
very flexible!
over-fetching can lead to issues
with performance and cost
@theburningmonk theburningmonk.com
AppSync
Profile
Sport
paginated! Activities
enable caching on
specific resolvers
@theburningmonk theburningmonk.com
AppSync
Profile
Sport
paginated! Activities
PublicProfile !== Profile
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
AWS AppSync
scalable & multi-az out of the box
@theburningmonk theburningmonk.com
AWS AppSync
scalable & multi-az out of the box
pay as you use ($4.00 per Million)
@theburningmonk theburningmonk.com
AWS AppSync
scalable & multi-az out of the box
pay as you use ($4.00 per Million)
built-in caching (extra $)
@theburningmonk theburningmonk.com
AWS AppSync
scalable & multi-az out of the box
pay as you use ($4.00 per Million)
built-in caching (extra $)
built-in metrics through CloudWatch
built-in logging through CloudWatch Logs
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
which resolver is
the problem?
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
AWS AppSync
scalable & multi-az out of the box
pay as you use ($4.00 per Million)
built-in caching (extra $)
built-in metrics through CloudWatch
built-in logging through CloudWatch Logs
no servers to manage
@theburningmonk theburningmonk.com
Why not single-table?
@theburningmonk theburningmonk.com
Use single-table design techniques,
but why force yourself to 1 table?
@theburningmonk theburningmonk.com
CloudFormation can only update 1 GSI at a time
@theburningmonk theburningmonk.com
Access pattern changes are painful
@theburningmonk theburningmonk.com
AppSync stitches related DynamoDB reads just fine
@theburningmonk theburningmonk.com
Using single-table === writing more custom VTL
@theburningmonk theburningmonk.com
What about the cost saving?
@theburningmonk theburningmonk.com
Sensible caching will save you far more than
single-table design ever will
@theburningmonk theburningmonk.com
average 99%
cache hit rate
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
Sometimes, good enough is good enough
@theburningmonk theburningmonk.com
Design your system as if it’ll be run by idiots.
Because one day it’ll be.
@theburningmonk theburningmonk.com
Cognito User Pool
with identity federation
amplify-js
@theburningmonk theburningmonk.com
Cognito User Pool are configured using CloudFormation
NOT Amplify CLI
@theburningmonk theburningmonk.com
already have required expertise with AWS and Cognito
Why not amplify CLI?
@theburningmonk theburningmonk.com
great for bootstrapping but question marks
about how well it copes with changes
Why not amplify CLI?
@theburningmonk theburningmonk.com
not all the decisions it makes are good decisions,
e.g. using DynamoDB scans for list operations
Why not amplify CLI?
@theburningmonk theburningmonk.com
DynamoDB access pattern is a sensitive topic with
potentially huge scalability and cost implications.
Why not amplify CLI?
@theburningmonk theburningmonk.com
Hides too much important details.
Why not amplify CLI?
@theburningmonk theburningmonk.com
Cognito User Pool
amplify-js
@theburningmonk theburningmonk.com
creates a university
admin user
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
any logged in user can
perform this operation
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
Serverless
framework
mature, strong community support
@theburningmonk theburningmonk.com
Serverless
framework
mature, strong community support
extensible & customizable through plugins
rich ecosystem of community plugins
@theburningmonk theburningmonk.com
Serverless
framework
mature, strong community support
extensible & customizable through plugins
rich ecosystem of community plugins
already familiar with it
@theburningmonk theburningmonk.com
Serverless
framework
one repo
one CloudFormation stack
one serverless.yml
one command to deploy
> sls deploy
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
Serverless
framework
custom splitting logic FTW!
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
Serverless
framework
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
Step 1
Step 2
npm ci
npm run sls -- deploy
@theburningmonk theburningmonk.com
not much point with local testing as they’re very
simple and has no dynamic behaviour, once you
figure out the “pattern” they just works
for AppSync resolvers
test integration with other services (e.g. DynamoDB,
Algolia) by executing function locally, but talk to the
real DynamoDB & Algolia
for Lambda
E2E test - execute user stories against
deployed GraphQL endpoints
debugging failed E2E tests is a rehearsal for
debugging real production issues
@theburningmonk theburningmonk.com
AWS Organization
productionstagingdevshared
root
OU OU OU OU
Users
Audit
Dev Staging Production
@theburningmonk theburningmonk.com
org-formation
infrastructure-as-code
CloudFormation-like YML syntax
template landing zones
@theburningmonk theburningmonk.com
org-formation
@theburningmonk theburningmonk.com
org-formation
@theburningmonk theburningmonk.com
org-formation
@theburningmonk theburningmonk.com
org-formation
@theburningmonk theburningmonk.com
org-formation
@theburningmonk theburningmonk.com
org-formation
> org-formation update
@theburningmonk theburningmonk.com
org-formation
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
org-formation
> org-formation perform-tasks
@theburningmonk theburningmonk.com
org-formation
https://github.com/OlafConijn/AwsOrganizationFormation
@theburningmonk theburningmonk.com
Serverless
framework
AppSync org-formation
speed of development
scale to millions of users
minimal up-keep
cost efficient
@theburningmonk theburningmonk.com
1 fulltime FE developer (mobile app)
1 fulltime FE developer (CMS)
1 partime BE developer (me)
~7 weeks
~3 weeks
~4 weeks
speed of development
scale to millions of users
minimal up-keep
cost efficient
speed of development
scale to millions of users
minimal up-keep
cost efficient
@theburningmonk theburningmonk.com
speed of development
scale to millions of users
minimal up-keep
cost efficient
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
speed of development
scale to millions of users
minimal up-keep
cost efficient
@theburningmonk theburningmonk.com
@theburningmonk theburningmonk.com
midnight in Belgium
more Lambda cold starts
Building a social network in under 4 weeks with Serverless and GraphQL
https://theburningmonk.com/hire-me
AdviseTraining Delivery
“Fundamentally, Yan has improved our team by increasing our
ability to derive value from AWS and Lambda in particular.”
Nick Blair
Tech Lead
Learn GraphQL and AppSync by building a
Twitter clone with these technologies
appsyncmasterclass.com
@theburningmonk
theburningmonk.com
github.com/theburningmonk

More Related Content

PDF
How to bring chaos engineering to serverless
PDF
Migrating existing monolith to serverless in 8 steps
PDF
Patterns and practices for building resilient Serverless applications
PDF
Patterns and practices for building resilient serverless applications
PDF
Serverless a superpower for frontend developers
PDF
Serverless observability - a hero's perspective
PDF
Patterns and practices for building resilient serverless applications.pdf
PDF
Essential open source tools for serverless developers
How to bring chaos engineering to serverless
Migrating existing monolith to serverless in 8 steps
Patterns and practices for building resilient Serverless applications
Patterns and practices for building resilient serverless applications
Serverless a superpower for frontend developers
Serverless observability - a hero's perspective
Patterns and practices for building resilient serverless applications.pdf
Essential open source tools for serverless developers

What's hot (20)

PDF
Migrating existing monolith to serverless in 8 steps
PDF
Build social network in 4 weeks
PDF
Yan Cui - How to build observability into a serverless application - Codemoti...
PDF
Common mistakes in serverless adoption
PDF
Patterns and Practices for Building Resilient Serverless Applications
PDF
Debugging AWS Lambda Performance Issues
PDF
Serverless Architectural Patterns
PDF
Why your next serverless project should use AWS AppSync
PDF
Troubleshooting serverless applications
PDF
How to build a social network on serverless
PDF
Beware the potholes on the road to serverless
PDF
Serverless in production, an experience report (FullStack 2018)
PDF
Beware the potholes on the road to serverless
PDF
How to build observability into a serverless application
PDF
Serverless in Production, an experience report (AWS UG South Wales)
PDF
Front End Development for Back End Java Developers - West Midlands Java User ...
PDF
Serverless in production, an experience report (London js community)
PDF
Serverless in production, an experience report (microservices london)
PPTX
A. De Biase/C. Quatrini/M. Barsocchi - API Release Process: how to make peopl...
PDF
Serverless in production, an experience report (BuildStuff)
Migrating existing monolith to serverless in 8 steps
Build social network in 4 weeks
Yan Cui - How to build observability into a serverless application - Codemoti...
Common mistakes in serverless adoption
Patterns and Practices for Building Resilient Serverless Applications
Debugging AWS Lambda Performance Issues
Serverless Architectural Patterns
Why your next serverless project should use AWS AppSync
Troubleshooting serverless applications
How to build a social network on serverless
Beware the potholes on the road to serverless
Serverless in production, an experience report (FullStack 2018)
Beware the potholes on the road to serverless
How to build observability into a serverless application
Serverless in Production, an experience report (AWS UG South Wales)
Front End Development for Back End Java Developers - West Midlands Java User ...
Serverless in production, an experience report (London js community)
Serverless in production, an experience report (microservices london)
A. De Biase/C. Quatrini/M. Barsocchi - API Release Process: how to make peopl...
Serverless in production, an experience report (BuildStuff)

Similar to Building a social network in under 4 weeks with Serverless and GraphQL (20)

PDF
Building a social network in under 4 weeks with Serverless and GraphQL
PDF
Build a social network in 4 weeks with Serverless and GraphQL
PDF
How to build a social network on serverless | Yan Cui
PDF
How to build a social network on Serverless (AWS Community Summit)
PDF
How to build a social network on serverless
PDF
What can you do with lambda in 2020
PDF
MongoDB Europe 2016 - Using MongoDB to Build a Fast and Scalable Content Repo...
PDF
How to build a social network on serverless
PDF
How to Build a Big Data Application: Serverless Edition
PDF
What can you do with lambda in 2020
PDF
How to Build a Big Data Application: Serverless Edition
PPTX
RavenDB overview
PPSX
Oded Coster - Stack Overflow behind the scenes - how it's made - Codemotion M...
PDF
Dont try these at home
PPTX
Scaling Stack Overflow (QCon NYC 2015)
PDF
Google Cloud Functions & Firebase Crash Course
PDF
Migrating existing monolith to serverless in 8 steps
PDF
Architecting for the Cloud using NetflixOSS - Codemash Workshop
PPTX
Silicon Valley Code Camp 2010: Social Platforms : What goes on under the hood
PDF
Serverless Culture
Building a social network in under 4 weeks with Serverless and GraphQL
Build a social network in 4 weeks with Serverless and GraphQL
How to build a social network on serverless | Yan Cui
How to build a social network on Serverless (AWS Community Summit)
How to build a social network on serverless
What can you do with lambda in 2020
MongoDB Europe 2016 - Using MongoDB to Build a Fast and Scalable Content Repo...
How to build a social network on serverless
How to Build a Big Data Application: Serverless Edition
What can you do with lambda in 2020
How to Build a Big Data Application: Serverless Edition
RavenDB overview
Oded Coster - Stack Overflow behind the scenes - how it's made - Codemotion M...
Dont try these at home
Scaling Stack Overflow (QCon NYC 2015)
Google Cloud Functions & Firebase Crash Course
Migrating existing monolith to serverless in 8 steps
Architecting for the Cloud using NetflixOSS - Codemash Workshop
Silicon Valley Code Camp 2010: Social Platforms : What goes on under the hood
Serverless Culture

More from Yan Cui (16)

PDF
How to win the game of trade-offs
PDF
How to choose the right messaging service
PDF
How to choose the right messaging service for your workload
PDF
Lambda and DynamoDB best practices
PDF
Lessons from running AppSync in prod
PDF
How to ship customer value faster with step functions
PDF
How serverless changes the cost paradigm
PDF
FinDev as a business advantage in the post covid19 economy
PDF
How to improve lambda cold starts
PDF
What can you do with lambda in 2020
PDF
A chaos experiment a day, keeping the outage away
PDF
How to debug slow lambda response times
PDF
How to ship customer value faster with step functions
PDF
Debugging Lambda timeouts
PDF
Serverless Security: Defence Against the Dark Arts
PDF
Mastering AWS Organizations with Infrastructure as code
How to win the game of trade-offs
How to choose the right messaging service
How to choose the right messaging service for your workload
Lambda and DynamoDB best practices
Lessons from running AppSync in prod
How to ship customer value faster with step functions
How serverless changes the cost paradigm
FinDev as a business advantage in the post covid19 economy
How to improve lambda cold starts
What can you do with lambda in 2020
A chaos experiment a day, keeping the outage away
How to debug slow lambda response times
How to ship customer value faster with step functions
Debugging Lambda timeouts
Serverless Security: Defence Against the Dark Arts
Mastering AWS Organizations with Infrastructure as code

Recently uploaded (20)

PPTX
Spectroscopy.pptx food analysis technology
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
A Presentation on Artificial Intelligence
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
TLE Review Electricity (Electricity).pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Unlocking AI with Model Context Protocol (MCP)
PPT
Teaching material agriculture food technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
Spectroscopy.pptx food analysis technology
Assigned Numbers - 2025 - Bluetooth® Document
A Presentation on Artificial Intelligence
Mobile App Security Testing_ A Comprehensive Guide.pdf
TLE Review Electricity (Electricity).pptx
A comparative analysis of optical character recognition models for extracting...
Network Security Unit 5.pdf for BCA BBA.
SOPHOS-XG Firewall Administrator PPT.pptx
Group 1 Presentation -Planning and Decision Making .pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Unlocking AI with Model Context Protocol (MCP)
Teaching material agriculture food technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Approach and Philosophy of On baking technology
Encapsulation_ Review paper, used for researhc scholars
Spectral efficient network and resource selection model in 5G networks
OMC Textile Division Presentation 2021.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Heart disease approach using modified random forest and particle swarm optimi...

Building a social network in under 4 weeks with Serverless and GraphQL