Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

0

Share

Build social network in 4 weeks

Download to read offline

Serverless technologies drastically simplify the task of building modern, scalable APIs in the cloud, and GraphQL makes it easy for frontend teams to consume these APIs and to iterate quickly on your product idea. Together, they are a perfect combination for a product-focused, full-stack team to deliver customer values quickly.

In this talk, see how we built a new social network mobile app in under 4 weeks using Lambda, AppSync, DynamoDB and Algolia. How we approached CI/CD, testing, authentication and lessons we learnt along the way.

Real-world serverless podcast: https://realworldserverless.com
Learn Lambda best practices: https://lambdabestpractice.com
Blog: https://theburningmonk.com
Consulting services: https://theburningmonk.com/hire-me
Production-Ready Serverless workshop: https://productionreadyserverless.com

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

Build social network in 4 weeks

  1. 1. Building a social network in under 4 weeks with Serverless and GraphQL
  2. 2. @theburningmonk theburningmonk.com
  3. 3. @theburningmonk theburningmonk.com bootstrapped startup: severe constraints on time & money
  4. 4. speed of development
  5. 5. speed of development scale to millions of users
  6. 6. speed of development scale to millions of users minimal up-keep
  7. 7. speed of development scale to millions of users minimal up-keep cost efficient
  8. 8. @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
  9. 9. @theburningmonk theburningmonk.com S3CloudFront
  10. 10. @theburningmonk theburningmonk.com Cognito User Pool S3CloudFront
  11. 11. @theburningmonk theburningmonk.com Cognito User Pool AppSync S3CloudFront DynamoDB Lambda
  12. 12. @theburningmonk theburningmonk.com Cognito User Pool AppSync DynamoDB Lambda S3CloudFront
  13. 13. @theburningmonk theburningmonk.com Cognito User Pool AppSync DynamoDB Lambda S3 Algolia CloudFront
  14. 14. @theburningmonk theburningmonk.com Cognito User Pool AppSync DynamoDB Lambda S3 AlgoliaCloudFront Lambda Algolia
  15. 15. @theburningmonk theburningmonk.com Cognito User Pool AppSync DynamoDB Lambda S3 Firehose Algolia CloudFront S3 Lambda Algolia
  16. 16. @theburningmonk theburningmonk.com Cognito User Pool AppSync DynamoDB Lambda S3 Firehose AthenaAlgolia CloudFront S3 Lambda Algolia
  17. 17. @theburningmonk theburningmonk.com Cognito User Pool AppSync DynamoDB Lambda S3 Firehose AthenaAlgolia CloudFront S3 Lambda Algolia
  18. 18. @theburningmonk theburningmonk.com AWS Organization productionstagingdevshared root OU OU OU OU
  19. 19. @theburningmonk theburningmonk.com AWS Organization productionstagingdevshared root OU OU OU OU Users Audit Dev Staging Production
  20. 20. @theburningmonk theburningmonk.com AWS Organization productionstagingdevshared root OU OU OU OU Users Audit Dev Staging Production SCPs
  21. 21. @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
  22. 22. Yan Cui http://theburningmonk.com @theburningmonk AWS user for 10 years
  23. 23. http://bit.ly/yubl-serverless
  24. 24. Yan Cui http://theburningmonk.com @theburningmonk Developer Advocate @
  25. 25. Yan Cui http://theburningmonk.com @theburningmonk Independent Consultant advisetraining delivery
  26. 26. theburningmonk.com/courses
  27. 27. Learn GraphQL and AppSync by building a Twitter clone with these technologies appsyncmasterclass.com
  28. 28. realworldserverless.com
  29. 29. @theburningmonk theburningmonk.com What is GraphQL?
  30. 30. @theburningmonk theburningmonk.com schema
  31. 31. @theburningmonk theburningmonk.com schema server
  32. 32. @theburningmonk theburningmonk.com schema server data sources DynamoDB RDS ElasticSearch
  33. 33. @theburningmonk theburningmonk.com What is AppSync?
  34. 34. @theburningmonk theburningmonk.com schema server data sources DynamoDB RDS ElasticSearch AppSync Lambda
  35. 35. @theburningmonk theburningmonk.com AppSync
  36. 36. @theburningmonk theburningmonk.com AppSync Profile
  37. 37. @theburningmonk theburningmonk.com AppSync Profile
  38. 38. @theburningmonk theburningmonk.com AppSync Profile Sport
  39. 39. @theburningmonk theburningmonk.com AppSync Profile Sport paginated!
  40. 40. @theburningmonk theburningmonk.com AppSync Profile Sport paginated! Activities
  41. 41. @theburningmonk theburningmonk.com AppSync Profile Sport paginated! Activities
  42. 42. @theburningmonk theburningmonk.com AppSync Profile Sport paginated! Activities
  43. 43. @theburningmonk theburningmonk.com AppSync Profile Sport paginated! Activities very flexible!
  44. 44. @theburningmonk theburningmonk.com AppSync Profile Sport paginated! Activities very flexible! over-fetching can lead to issues with performance and cost
  45. 45. @theburningmonk theburningmonk.com AppSync Profile Sport paginated! Activities enable caching on specific resolvers
  46. 46. @theburningmonk theburningmonk.com AppSync Profile Sport paginated! Activities PublicProfile !== Profile
  47. 47. @theburningmonk theburningmonk.com
  48. 48. @theburningmonk theburningmonk.com
  49. 49. @theburningmonk theburningmonk.com AWS AppSync scalable & multi-az out of the box
  50. 50. @theburningmonk theburningmonk.com AWS AppSync scalable & multi-az out of the box pay as you use ($4.00 per Million)
  51. 51. @theburningmonk theburningmonk.com AWS AppSync scalable & multi-az out of the box pay as you use ($4.00 per Million) built-in caching (extra $)
  52. 52. @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
  53. 53. @theburningmonk theburningmonk.com
  54. 54. @theburningmonk theburningmonk.com which resolver is the problem?
  55. 55. @theburningmonk theburningmonk.com
  56. 56. @theburningmonk theburningmonk.com
  57. 57. @theburningmonk theburningmonk.com
  58. 58. @theburningmonk theburningmonk.com
  59. 59. @theburningmonk theburningmonk.com
  60. 60. @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
  61. 61. @theburningmonk theburningmonk.com Why not single-table?
  62. 62. @theburningmonk theburningmonk.com Use single-table design techniques, but why force yourself to 1 table?
  63. 63. @theburningmonk theburningmonk.com CloudFormation can only update 1 GSI at a time
  64. 64. @theburningmonk theburningmonk.com Access pattern changes are painful
  65. 65. @theburningmonk theburningmonk.com AppSync stitches related DynamoDB reads just fine
  66. 66. @theburningmonk theburningmonk.com Using single-table === writing more custom VTL
  67. 67. @theburningmonk theburningmonk.com What about the cost saving?
  68. 68. @theburningmonk theburningmonk.com Sensible caching will save you far more than single-table design ever will
  69. 69. @theburningmonk theburningmonk.com average 99% cache hit rate
  70. 70. @theburningmonk theburningmonk.com
  71. 71. @theburningmonk theburningmonk.com
  72. 72. @theburningmonk theburningmonk.com Sometimes, good enough is good enough
  73. 73. @theburningmonk theburningmonk.com Design your system as if it’ll be run by idiots. Because one day it’ll be.
  74. 74. @theburningmonk theburningmonk.com Cognito User Pool with identity federation amplify-js
  75. 75. @theburningmonk theburningmonk.com Cognito User Pool are configured using CloudFormation NOT Amplify CLI
  76. 76. @theburningmonk theburningmonk.com already have required expertise with AWS and Cognito Why not amplify CLI?
  77. 77. @theburningmonk theburningmonk.com great for bootstrapping but question marks about how well it copes with changes Why not amplify CLI?
  78. 78. @theburningmonk theburningmonk.com not all the decisions it makes are good decisions, e.g. using DynamoDB scans for list operations Why not amplify CLI?
  79. 79. @theburningmonk theburningmonk.com DynamoDB access pattern is a sensitive topic with potentially huge scalability and cost implications. Why not amplify CLI?
  80. 80. @theburningmonk theburningmonk.com Hides too much important details. Why not amplify CLI?
  81. 81. @theburningmonk theburningmonk.com Cognito User Pool amplify-js
  82. 82. @theburningmonk theburningmonk.com creates a university admin user
  83. 83. @theburningmonk theburningmonk.com
  84. 84. @theburningmonk theburningmonk.com
  85. 85. @theburningmonk theburningmonk.com
  86. 86. @theburningmonk theburningmonk.com
  87. 87. @theburningmonk theburningmonk.com
  88. 88. @theburningmonk theburningmonk.com
  89. 89. @theburningmonk theburningmonk.com
  90. 90. @theburningmonk theburningmonk.com
  91. 91. @theburningmonk theburningmonk.com any logged in user can perform this operation
  92. 92. @theburningmonk theburningmonk.com Serverless framework
  93. 93. @theburningmonk theburningmonk.com Serverless framework mature, strong community support
  94. 94. @theburningmonk theburningmonk.com Serverless framework mature, strong community support extensible & customizable through plugins rich ecosystem of community plugins
  95. 95. @theburningmonk theburningmonk.com Serverless framework mature, strong community support extensible & customizable through plugins rich ecosystem of community plugins already familiar with it
  96. 96. @theburningmonk theburningmonk.com Serverless framework one repo one CloudFormation stack one serverless.yml one command to deploy > sls deploy
  97. 97. @theburningmonk theburningmonk.com Serverless framework
  98. 98. @theburningmonk theburningmonk.com Serverless framework
  99. 99. @theburningmonk theburningmonk.com Serverless framework
  100. 100. @theburningmonk theburningmonk.com Serverless framework
  101. 101. @theburningmonk theburningmonk.com Serverless framework
  102. 102. @theburningmonk theburningmonk.com Serverless framework
  103. 103. @theburningmonk theburningmonk.com Serverless framework
  104. 104. @theburningmonk theburningmonk.com
  105. 105. @theburningmonk theburningmonk.com Serverless framework
  106. 106. @theburningmonk theburningmonk.com Serverless framework custom splitting logic FTW!
  107. 107. @theburningmonk theburningmonk.com Serverless framework
  108. 108. @theburningmonk theburningmonk.com Serverless framework
  109. 109. @theburningmonk theburningmonk.com Serverless framework
  110. 110. @theburningmonk theburningmonk.com Serverless framework
  111. 111. @theburningmonk theburningmonk.com
  112. 112. @theburningmonk theburningmonk.com
  113. 113. @theburningmonk theburningmonk.com
  114. 114. @theburningmonk theburningmonk.com
  115. 115. @theburningmonk theburningmonk.com Step 1 Step 2 npm ci npm run sls -- deploy
  116. 116. @theburningmonk theburningmonk.com
  117. 117. 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
  118. 118. test integration with other services (e.g. DynamoDB, Algolia) by executing function locally, but talk to the real DynamoDB & Algolia for Lambda
  119. 119. E2E test - execute user stories against deployed GraphQL endpoints
  120. 120. debugging failed E2E tests is a rehearsal for debugging real production issues
  121. 121. @theburningmonk theburningmonk.com AWS Organization productionstagingdevshared root OU OU OU OU Users Audit Dev Staging Production
  122. 122. @theburningmonk theburningmonk.com org-formation infrastructure-as-code CloudFormation-like YML syntax template landing zones
  123. 123. @theburningmonk theburningmonk.com org-formation
  124. 124. @theburningmonk theburningmonk.com org-formation
  125. 125. @theburningmonk theburningmonk.com org-formation
  126. 126. @theburningmonk theburningmonk.com org-formation
  127. 127. @theburningmonk theburningmonk.com org-formation
  128. 128. @theburningmonk theburningmonk.com org-formation > org-formation update
  129. 129. @theburningmonk theburningmonk.com org-formation
  130. 130. @theburningmonk theburningmonk.com
  131. 131. @theburningmonk theburningmonk.com
  132. 132. @theburningmonk theburningmonk.com
  133. 133. @theburningmonk theburningmonk.com org-formation > org-formation perform-tasks
  134. 134. @theburningmonk theburningmonk.com org-formation https://github.com/OlafConijn/AwsOrganizationFormation
  135. 135. @theburningmonk theburningmonk.com Serverless framework AppSync org-formation
  136. 136. speed of development scale to millions of users minimal up-keep cost efficient
  137. 137. @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
  138. 138. speed of development scale to millions of users minimal up-keep cost efficient
  139. 139. speed of development scale to millions of users minimal up-keep cost efficient
  140. 140. @theburningmonk theburningmonk.com
  141. 141. speed of development scale to millions of users minimal up-keep cost efficient
  142. 142. @theburningmonk theburningmonk.com
  143. 143. @theburningmonk theburningmonk.com
  144. 144. speed of development scale to millions of users minimal up-keep cost efficient
  145. 145. @theburningmonk theburningmonk.com
  146. 146. @theburningmonk theburningmonk.com midnight in Belgium more Lambda cold starts
  147. 147. 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
  148. 148. Learn GraphQL and AppSync by building a Twitter clone with these technologies appsyncmasterclass.com
  149. 149. @theburningmonk theburningmonk.com github.com/theburningmonk

Serverless technologies drastically simplify the task of building modern, scalable APIs in the cloud, and GraphQL makes it easy for frontend teams to consume these APIs and to iterate quickly on your product idea. Together, they are a perfect combination for a product-focused, full-stack team to deliver customer values quickly. In this talk, see how we built a new social network mobile app in under 4 weeks using Lambda, AppSync, DynamoDB and Algolia. How we approached CI/CD, testing, authentication and lessons we learnt along the way. Real-world serverless podcast: https://realworldserverless.com Learn Lambda best practices: https://lambdabestpractice.com Blog: https://theburningmonk.com Consulting services: https://theburningmonk.com/hire-me Production-Ready Serverless workshop: https://productionreadyserverless.com

Views

Total views

574

On Slideshare

0

From embeds

0

Number of embeds

2

Actions

Downloads

2

Shares

0

Comments

0

Likes

0

×