Following on my review of A Guide to Serverless Microservices, I read the new Serverless Single Page Apps by Ben Rady. It’s available as an e-book or dead tree book right now. You can get it from Pragmatic Press or on Amazon.
The book covers using DynamoDB, Cognito, and Lambda to back a single-page Javascript application. It doesn’t use a framework, so the concepts should apply no matter what frontend you choose. This book’s best audience is programmers that have Javascript experience already, have heard some community chatter about single-page apps, and have dabbled in Amazon Web services before. It doesn’t assume much knowledge of AWS going in, but if you’re new to AWS you may need to reference the external resources mentioned in the book.
Ben walks through just the right mix of Javascript to build client-side logic, Cognito for auth, and Lambda for implementing sensitive features that can’t be trusted to browsers. Javascript developers will find new ways to do typically server-side functions, and finish the book with a working serverless app that costs next-to-nothing to run.
The Good
Right at the start Ben covers a few reader profiles and suggests which sections to pay the most attention to, depending on your goal for reading the book. There are recommendations for people just starting with single-page apps, experienced with single-page apps but new to serverless applications, or readers that want to use their own framework in a serverless context.
What makes it stand out is that all the frontend code for the book is written test-first. For example, when building a hash-change router Ben goes over the tests and goals for the code before getting into the router. It also covers the reason behind test-first development, so the reader gets a bit of portable testing experience along with the more specific single-page app information.
The Less Good
The book only uses jQuery, no single-page frameworks like React or Angular here. That’s good for teaching, but I’d really like to see an appendix or something at the end pointing to resources for users that want to move ahead with building SPA’s. Otherwise they might continue and end up with a kuldge like this.
On the up side, not picking a framework makes the book easier to follow and avoids the “here’s 15 steps to get the framework set up that won’t be explained” problem that afflicts framework-driven books.
Overall Review
For the test-first approach and the great introduction to using third-party identity services like Cognito, Serverless Single Page Apps takes home λλλλ of 5 Greek letters. It’s a great fit for developers wanting to move from template-driven Rails/Django environments to apps with more of a client-side focus.
It covers all the intro-level AWS topics you’d expect: IAM, Cognito, Lambda, DynamoDB, S3, and EC2 (for comparisons to Lambda). Coverage of CloudFront would be we a welcome addition. CDN’s are crucial to site performance, so any substantial SPA would want to take advantage of one.
Disclosure: I received a free ebook copy of this book as a technical reviewer. Other than a free copy, I received no compensation for this review, and none of the links in this post are affiliate links.