gitmyhub

Perfect

Swift ★ 14k updated 2y ago

Server-side Swift. The Perfect core toolset and framework for Swift Developers. (For mobile back-end development, website and API development, and more…)

Perfect is a web framework that lets you build back-end servers and REST APIs in Swift, the language normally used for iPhone apps, so one team can cover both mobile and server code.

SwiftSwift Package Managersetup: moderatecomplexity 3/5

Perfect is a framework and application server that lets developers build web back ends using Swift, the programming language Apple created for iPhone and Mac apps. Normally Swift is used for front-end mobile work, but Perfect puts it on the server side too, so a team can write both the app and the service behind it in one language. It runs on macOS and Linux.

The main use cases listed in the README are mobile back ends, websites, and REST APIs. A REST API is a standard way for programs to ask a remote server for data or actions over the internet, which is how most phone apps fetch content from a service. Perfect handles incoming HTTP and HTTPS requests, routes them to the right pieces of your Swift code, and sends back responses. It can also handle WebSockets, which keep a connection open for real-time updates.

The project is broken into separate repositories so you only download what you need. Alongside the core library there are connectors for several databases including MySQL, PostgreSQL, MongoDB, SQLite, Redis, and FileMaker. Utility modules cover things like XML parsing, Mustache templates for generating HTML pages, ZIP compression, and Apple Push Notifications for sending alerts to iPhones.

To start a new project you can clone a template that compiles into a single runnable HTTP server. The Swift Package Manager, Apple's official tool for building Swift projects, handles the build step. Deployment can target any Swift-compatible Linux server, and a desktop helper app called Perfect Assistant assists with deploying to Amazon Web Services or Google Cloud.

The project is open source under the Apache license and has a documentation repository, a large library of example projects, and a community Slack channel. The README encourages contributions ranging from bug reports and documentation fixes to sharing example code.

Where it fits