News

What’s new in Vapor 3, the popular Swift based web framework

2 min read

Vapor, the popular web framework written in Swift has released its next major update. Vapor 3 is a complete rewrite of the existing versions and all of its related packages. The release is centered around three new features.

  1. Async: Vapor 3 is all ready to handle high levels of concurrency as it is completely non-blocking and runs on Apple’s SwiftNIO.
  2. Services: With Vapor’s new Dependency Injection framework Services, all JSON configuration files are replaced by Swift.
  3. Codable: Codable integration throughout all of Vapor brings type safety and better performance to Parsing and serializing content from HTTP messages, creating database models, and rendering views.

The main focus of this release is on building a foundation for developers to work on based on the growth of Vapor and server-side Swift over the past two years.

The release is updated across four major categories.

Packages

Vapor 3 offers a couple of new packages this release. Most notable are the MySQL and PostgreSQL packages which are now non-blocking and built on SwiftNIO. Some of these packages include:

  • SQLite: SQLite 3 wrapper for Swift.
  • PostgreSQL: Non-blocking, event-driven Swift client for PostgreSQL.
  • MySQL: Pure Swift MySQL client built on non-blocking, event-driven sockets.
  • Fluent: Swift ORM framework (queries, models, and relations) for building NoSQL and SQL database integrations.
  • FluentSQLite: Swift ORM (queries, models, relations, etc) built on SQLite 3.
  • Auth: Authentication and Authorization layer for Fluent.
  • JWT: JSON Web Token signing and verification.
  • Leaf: An expressive, performant, and extensible templating language built for Swift.

A complete list of packages is available in the vapor documentation.

Better updated Documentation

A large part of the release focuses on better documentation. Subsequently, Vapor 3 improves API docs with 100% docblock coverage including:

  • Helpful code samples where possible.
  • Method parameter descriptions.
  • MARK and code re-org to help make things readable in API doc form.

Also, the main docs are moving more toward a guide / tutorial feel. These guide docs cover broad use cases and practices, in contrast to the API docs which heavily focus on particular methods and protocols.

Moving to Discord and introducing Books

Vapor’s official team chat is now moved to Discord. The team has also announced two books (Server Side Swift with Vapor and Server-side Swift (Vapor Edition)) written specifically for Vapor 3.

Benchmarks

Vapor 3 introduces certain benchmarks for this release available on GitHub. The benchmarks were run on two identical Digital Ocean droplets. One for hosting the frameworks and one for running the benchmark. The benchmarker program is small script written in Swift that runs wrk and captures the results. It is capable of doing multiple runs and averaging the results. Vapor achieved state-of-the-art results on both the plaintext benchmarks.

To know further updates and other minor changes, be sure to Check out the updated website.

Read Next

Your First Swift Program [tutorial]

Swift for TensorFlow is now open source [news]

RxSwift Part 1: Where to Start? Beginning with Hot and Cold Observables [tutorial]

Sugandha Lahoti

Content Marketing Editor at Packt Hub. I blog about new and upcoming tech trends ranging from Data science, Web development, Programming, Cloud & Networking, IoT, Security and Game development.

Share
Published by
Sugandha Lahoti

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago