small medium large xlarge

Programming Elm: Build Safe and Maintainable Front-End Applications


Cover image for Programming Elm

Programming Elm

Build Safe and Maintainable Front-End Applications


Elm brings the safety and stability of functional programing to front-end development, making it one of the most popular new languages. Elm’s functional nature and static typing means that run-time errors are nearly impossible, and it compiles to JavaScript for easy web deployment. This book helps you take advantage of this new language in your web site development. Learn how the Elm Architecture will help you create fast applications. Discover how to integrate Elm with JavaScript so you can update legacy applications. See how Elm tooling makes deployment quicker and easier.

The majority of this book has been updated to Elm version 0.19, and the sample code will work with that version. However, three chapters require a WebSocket library that has not yet been updated to version 0.19. Once that library is released, we will update those chapters and release them.

Choose Your Format(s)

  • $21.95 In Stock
    • Beta: What do I get?

  • Ebooks are DRM free.

  • Ebook delivery options.

About this Title

Pages: 250 (est)
Published: 2019-02-10
Release: B15.0 (2019-03-19)
ISBN: 978-1-68050-285-5

Functional programming offers safer applications with decreased runtime errors, but functional solutions that are type-safe and easy to use have been hard to find, until the Elm language. Elm has the benefits of functional languages while compiling to JavaScript. This book provides a complete tutorial for the Elm language, starting with a simple static application that introduces Elm syntax, modules, and the virtual DOM, to exploring how to create a UI using functions. See how Elm handles the issues of state in functional languages. You’ll continue to build up larger applications involving HTTP requests for communication. Integrate your Elm applications with JavaScript so you can update legacy applications or take advantage of JavaScript resources.

Elm also provides built-in tooling to alleviate the tooling creep that’s so common in JavaScript. This book covers Elm’s deployment and testing tools that ease development confusion. Dive into advanced concepts including creating single-page applications, and creating performance improvements. Elm expert Jeremy Fairbank brings his years of web development experience to teaching how to use Elm for front-end development.

Your web UIs will be faster, safer, and easier to develop with Elm and this tutorial.

What You Need

You will need the latest version of Elm, 0.18, along with a browser to run the examples in this book.

Contents & Extracts

This book is currently in beta, so the contents and extracts will change as the book is developed.

  • Preface
    • Who Is This Book For?
    • What’s in This Book
    • Online Resources
  • Get Started with Elm
    • Get Started with Functions
    • Use Static Types
    • Build a Static App
    • What You Learned
  • Create Stateful Elm Applications
    • Apply the Elm Architecture excerpt
    • Create the View
    • Handle State Changes
    • The Elm Architecture Lifecyle
    • What You Learned
  • Refactor and Enhance Elm Applications
    • Refactor with Good Practices
    • Comment on Photos
    • What You Learned
  • Communicate with Servers
    • Safely Decode JSON excerpt
    • Fetch from HTTP APIs
    • What You Learned
  • Go Real-time with WebSockets
    • Load Multiple Photos
    • Receive Photos from WebSockets
    • What You Learned
  • Build Larger Applications
  • Develop, Debug, and Deploy with Powerful Tooling
    • Debug Code with the Debug Module
    • Travel through Time excerpt
    • Rapidly Develop and Deploy Elm Applications
    • What You Learned
  • Integrate with JavaScript
    • Embed an Elm Application
    • Upload Images with Ports
    • Display Uploaded Images
    • What You Learned
  • Test Elm Applications
  • Build Single-page Applications
  • Write Fast Applications


Jeremy Fairbank is a web developer with a master’s degree in computer science. He has many years of experience in front-end development and full-stack development, working heavily with JavaScript. He is an avid conference speaker and teacher, presenting on web development topics. He is passionate about front-end development and its future, now taking that passion to the world of Elm.

Upcoming Author Events