Vapor is an open-source web framework written in Swift. It’s built on top of Apple’s SwiftNIO library to provide a powerful, asynchronous framework. Vapor allows you to build back-end applications for iOS apps, front-end web sites and stand-alone server applications.
Apple open-sourced Swift in December 2015, thereby enabling developers to create applications for macOS and Linux written in Swift. Almost immediately, a number of web frameworks written in Swift appeared. Tanner Nelson started Vapor in January 2016, and Logan Wright joined him shortly thereafter. Over time, a large and engaged user community has embraced the framework. Vapor has a Swift-like API and makes heavy use of many powerful language features. As a result, it has become the most popular server-side Swift framework on GitHub.
Vapor consists of a number of packages including Leaf — a templating engine for front-end development — and Fluent, a Swift Object Relational Mapping (ORM) framework with native, asynchronous database drivers. One of its biggest strengths is its community. There’s a very dedicated following on GitHub and an extremely active chat server on Discord.
How to read this book
The chapters in the first three sections build on each other. If you’re new to Vapor, you should read them in sequence. If you’re experienced with Vapor, you can skip from chapter to chapter to learn how to use the latest features and treat this book as a reference.
Each chapter provides starter and final projects. The book is very code heavy and you should follow along with the code to truly understand it all.
The chapters in Section 4 stand alone and you can read them in any order. Written by the core Vapor team, they provide deeper insight into how best to use Vapor.
The best way to learn about Vapor is to roll up your sleeves and start coding. Enjoy the book!
The third edition of this book is a complete rewrite to update it for Vapor 4! This edition also includes a new chapter on how to implement Sign In With Apple.