About This Title

Pages: 212
Published: June 2016
ISBN: 9781680501490
In Print

Skill Level Meter

Serverless Single Page Apps

Fast, Scalable, and Available

by Ben Rady

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.

eBook Formats:

  • PDF for desktop/tablets

  • epub for Apple Books, e-readers

  • mobi for Kindle readers

Get all eBook formats here for $17.95 (USD)

Add to Cart we accept visa, mastercard, amex, discover, paypal


Paperback Formats:

Please support indie bookstores!
Find indie bookstores in the U.S. Find indie bookstores around the world.


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.

Resources

Releases:

  • P1.0 2016/06/28
  • B5.0 2016/06/07
  • B4.0 2016/03/10
  • B3.0 2016/02/12

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.

eBook Formats:

  • PDF for desktop/tablets

  • epub for Apple Books, e-readers

  • mobi for Kindle readers

Get all eBook formats here for $17.95 (USD)

Add to Cart we accept visa, mastercard, amex, discover, paypal


Paperback Formats:

Please support indie bookstores!
Find indie bookstores in the U.S. Find indie bookstores around the world.

Related Titles:

Skill Level Meter

About This Title

Pages: 212
Published: June 2016
ISBN: 9781680501490
Edition: 1
In Print