Perfect is a set of focused Swift packages for building servers and talking to the services behind them: an HTTP(S) server, database drivers, sessions and sign-in, email, push notifications, FileMaker, payments and everyday utilities. Every package is written for Swift 6 and strict concurrency, runs on macOS and Linux, keeps its dependencies to a minimum, and is released and tested on its own.
This repository used to hold PerfectLib, the original all-in-one Perfect framework (Swift 3
to 5). PerfectLib is no longer maintained. Its code is preserved on the
legacy branch, and its tags (the last
is 4.0.1) still resolve. This repository is now the map to the Perfect packages.
- PerfectTemplate: a small web app that wires the pieces together (Perfect-NIO, Perfect-CRUD, Perfect-MySQL and Perfect-Logger). Clone it to start a project.
- Perfect-NIO: the HTTP(S) server. Typed, composable routes with async handlers, WebSockets, TLS with per-domain certificates, and graceful restarts, built on SwiftNIO.
.package(url: "https://github.com/PerfectlySoft/Perfect-NIO.git", from: "0.2.0"),| Package | What it does |
|---|---|
| Perfect-NIO | HTTP(S) server on SwiftNIO: typed routes, async handlers, WebSockets, multi-domain TLS, optional admin console |
| Perfect-Session | Sessions with MySQL, PostgreSQL, SQLite, Redis, MongoDB or in-memory storage, plus CSRF, CORS and cookie helpers |
| Perfect-Authentication | OAuth 2.0 sign-in with PKCE for Google, GitHub, Facebook, Slack, LinkedIn and Salesforce |
| Perfect-SMTP | SMTP client on SwiftNIO: relay or direct-to-MX delivery, DKIM signing, MTA-STS |
| Perfect-Notifications | Apple Push Notification service (APNs) provider client over HTTP/2 |
| Package | What it does |
|---|---|
| Perfect-CRUD | Codable object-relational mapping: create tables, insert, update, select and join with type-safe queries |
| Perfect-MySQL | MySQL client and Perfect-CRUD driver |
| Perfect-MariaDB | MariaDB client and Perfect-CRUD driver |
| Perfect-PostgreSQL | PostgreSQL client (libpq) and Perfect-CRUD driver |
| Perfect-SQLite | SQLite client and Perfect-CRUD driver |
| Perfect-MongoDB | MongoDB client: connection pools, collections, cursors, BSON and GridFS |
| Perfect-Redis | Async Redis client |
| Package | What it does |
|---|---|
| Perfect-FileMaker | Client for FileMaker Server's XML Custom Web Publishing interface |
| Perfect-FileMaker-DataAPI | Client for the FileMaker Data API (REST/JSON) |
| Perfect-FileMaker-AdminAPI | Client for the FileMaker Server Admin API, with a janitor that clears stale web-publishing sessions |
| Package | What it does |
|---|---|
| Perfect-AuthNet | Authorize.net client: charge, authorize, capture, refund and void, including Accept.js nonces |
| Package | What it does |
|---|---|
| Perfect-Logger | File and remote log handlers for swift-log |
| Perfect-XML | XML and HTML parsing with XPath, on libxml2 |
| Perfect-Zip | Create and safely extract zip archives |
| Perfect-INIParser | INI configuration file parser |
Each package's README lists its requirements, its current release and how to add it to
Package.swift. All of them need Swift 6.2 or later and run on macOS 12 or later and Linux.
Perfect-CRUD, Perfect-SQLite, Perfect-Redis, Perfect-FileMaker and Perfect-XML also support iOS.
The packages that PerfectLib and its companions provided have been replaced like this:
| Before | Now |
|---|---|
| Perfect-HTTP, Perfect-HTTPServer, Perfect-Net, Perfect-FastCGI | Perfect-NIO |
| Perfect-WebSockets | WebSocket routes in Perfect-NIO |
| Perfect-Session-MySQL, -PostgreSQL, -SQLite, -Redis | Perfect-Session |
| Perfect-OAuth2, Perfect-Turnstile-*, Perfect-LocalAuthentication-* | Perfect-Authentication with Perfect-Session |
| Perfect-CURL | Foundation's URLSession |
| Perfect-Crypto | swift-crypto |
| Perfect-Thread | Swift concurrency (async/await, tasks and actors) |
PerfectLib's File and Dir |
Foundation's FileManager and FileHandle |
PerfectLib's JSONConvertible |
Codable with JSONEncoder and JSONDecoder |
PerfectLib's SysProcess |
Foundation's Process |
PerfectLib's Log |
Perfect-Logger on swift-log |
The old repositories are archived: they stay readable and their tags still resolve, but they don't
get updates. Every package that existed before Swift 6 keeps its old code on a legacy branch,
and its README has a migration section.
Some older packages are still being reviewed before they're brought up to date, including Perfect-Mustache, Perfect-Markdown and Perfect-LDAP. Until then they stay as they are.
Issues and pull requests are welcome on each package's own repository. Please follow the Code of Conduct.
Apache 2.0. See LICENSE.