small medium large xlarge

Serverless Single Page Apps: Fast, Scalable, and Available

by

Cover image for Serverless Single Page Apps

Serverless Single Page Apps

Fast, Scalable, and Available

by

Don’t waste your time building an application server. See how to build low-cost, low-maintenance, highly available, serverless single page web applications that scale into the millions of users at the click of a button. Quickly build reliable, well-tested single page apps that stay up and running 24/7 using Amazon Web Services. Avoid messing around with middle-tier infrastructure and get right to the web app your customers want.

Customer Reviews

The software industry is the ultimate meritocracy—millions of developers individually deciding which technologies and trends lead to better, more testable code; simpler solutions; more reliable outcomes; and less burdensome maintenance. Ben is one of the visionaries who has looked forward, seen the future in the form of serverless designs, and then come back to teach the rest of us how to build the next generation of applications. Like having a software coach by your side, his book makes serverless design patterns easy to understand and leads you naturally into following best practices for deploying and testing.

- Tim Wagner

@timallenwagner

Serverless Single Page Apps is a comprehensive, approachable guide for developers of all backgrounds. Whether or not you use AWS, you will find the lessons on everything from security and identity to data access indispensable.

- Will Gaul

Ben walks through just the right mix of JavaScript to build client-side logic, Cognito for authentication and authorization, and Lambda for more sensitive features that can’t be trusted to browsers. JavaScript developers will find new ways to do typically server-side functions and will finish the book with a working serverless app that costs next to nothing to run.

- Ryan Scott Brown

Author at serverlesscode.com and Serverless Framework contributor

Your dream app will no longer be on the application server, inside of a big computer stored in your company’s closet. It is on the cloud—secure, and managed by a fleet of services with excellent uptime. Let this book start your new development journey.

- Daniel Hinojosa

Author of _Testing in Scala_

This book is a great introduction to the bleeding-edge concept of building a serverless web application. It will take you from having zero knowledge to deploying serverless applications.

- Jake McCrary

Lead software developer, Outpace Systems

I read a lot of technical books. This one is the best I’ve read this year, and one of the best of all time. Ben Rady has an authorial voice that is both relaxed and assuring. I never get the sense that he’s bragging about his knowledge or needlessly padding his material. He switches fluently between “here’s what we’re doing” and “here’s why we’re doing it” without relying too heavily on one approach over the other. His opinions and his technical choices are well founded and sound. Read this book.

- David Rupp

, RuppWorks LLC

See All Reviews

Choose Your Format(s)

  • $30.00 In Stock

    Save $9.00 on the combo pack.

  • $24.00 In Stock
  • $15.00 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

About this Title

Skill-meter-1-4
Pages: 212
Published: 2016-06-20
Release: P1.0 (2016-06-28)
ISBN: 978-1-68050-149-0

You don’t need to manage your own servers to build powerful web applications. This book will show you how to create a single page app that runs entirely on web services, scales to millions of users, and costs less per day than a cup of coffee.

Using a web browser, a prepared workspace, and your favorite editor, you’ll build a complete single page web application, step by step. Learn the fundamental technologies behind modern single page apps, and use web standards to create lean web applications that can take advantage of the newest technologies. Deploy your application quickly using Amazon S3. Use Amazon Cognito to connect with providers like Google and Facebook to manage user identities. Read and write user data directly from the browser using DynamoDB, and build your own scalable custom microservices with Amazon Lambda.

Whether you’ve never built a web application before or you’re a seasoned web developer who’s just looking for an alternative to complex server-side web frameworks, this book describes a simple approach to building serverless web applications that you can easily apply or adapt for your own projects.


Q&A with author Ben Rady

Q: What does “serverless” mean?
A: Serverless means you, as an application developer, don’t need to worry about managing servers. Your applications can be built on top of web services, instead of running on servers that you have to configure and maintain.

Q: So the only benefit to a serverless app is that I don’t have to be a part-time sysadmin?
A: Scalability, reliability, and cost are other enormous benefits to serverless apps. When building on top of Amazon Web Services, you can build apps that will scale into the millions of users, but cost just a few pennies per day to run. As your application grows, you can simply allocate more resources via AWS, without having to re-architect for scale. And if your app only ever has a handful of users, you’ll only pay for what you need. In many cases, the cost of running these kinds of apps is literally nothing.

Q: How do serverless apps compare to traditional web apps?
A: Traditional web applications, built using MVC frameworks and an application server, put most of the application logic in the server. The web app is often just an interface on top of this server, which is responsible for all the essential functions of the app: storing and processing data, issuing security credentials, and hosting the core application logic. With a serverless single page app, you can move the majority of this logic into the browser. This not only unifies the application, but makes it easier to integrate with the highly scalable and reliable services provided by vendors such as Amazon Web Services. Instead of trying to horizontally scale load-balanced application servers, you can rely on the engineers at AWS to scale most of your application for you.

Q: What about logic that can’t run in the browser?
A: Many applications will have some logic that can’t run in a browser, whether for security reasons, performance reasons, or to protect intellectual property. In those cases, you can use services like Amazon Lambda to build services that can be accessed directly from the browser. Whether you choose to structure your application using isolated microservices, or build a more integrated service layer, Lambda is a great way to host application logic that can’t be run on the client.

What You Need

To follow the tutorial in this book, you’ll need a computer with a web browser. You’ll also need a text editor, a git client, and Amazon’s command line interface tool, which requires Python 2.6.5 or later. While you won’t need an application server, building this web app will require some sort of development web server to serve the static files you create. You can use your own, or you can use the one included with the tutorial’s prepared workspace.

Contents & Extracts

Introduction
  • Guiding Principles
  • How To Read This Book
  • Online Resources
  • Starting Simple extract
    • Serverless Web Applications
    • Using Your Workspace
    • Deploying to Amazon S3
    • First Deployment
  • Routing Views with Hash Events
  • Essentials of Single Page Apps
    • Creating a View
    • Defining the Data Model
    • Handling User Input
    • Creating an Application Shell
    • Using Custom Events
    • Deploy Again
  • Identity as a Service with Amazon Cognito
    • Connecting to External Identity Providers
    • Creating an Identity Pool
    • Fetching a Google Identity
    • Requesting AWS Credentials
    • Creating a Profile View
    • Deploy Again
  • Storing Data in DynamoDB
    • Working With DynamoDB
    • Creating a Table
    • Authorizing DynamoDB Access
    • Saving Documents
    • Fetching Documents
    • Data Access and Validation
    • Deploy Again
  • Building (Micro)Services with Lambda
    • Understanding Amazon Lambda
    • Deploy First
    • Writing Lambda Functions
    • Invoking Lambda Functions
    • Using the Amazon API Gateway
    • Deploy Again
  • Serverless Security
    • Securing Your AWS Account
    • Query Injection Attacks
    • Cross Site Scripting Attacks
    • Cross Site Request Forgery
    • Wire Attacks and Transport Layer Security
    • Denial of Service Attacks
    • Deploy Again
  • Scaling Up
    • Monitor Web Services
    • Analyze S3 Web Traffic
    • Optimize for Growth
    • Costs of the Cloud
    • Deploy Again (and Again, and Again…)
  • Installing Node.js
  • Assigning a Domain Name

Author

As an entrepreneur and programmer, Ben Rady has been building successful commercial and open source software for over 15 years. Through his efforts as a technical advisor, author, and teacher, he’s educated people at organizations large and small in the art of building better software. You can follow Ben on Twitter @benrady, or at his blog at benrady.com.