explaingit

perfectlysoft/perfect

13,769SwiftAudience · developerComplexity · 3/5LicenseSetup · moderate

TLDR

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.

Mindmap

mindmap
  root((Perfect))
    What it does
      HTTP server
      REST API routing
      WebSockets
    Tech Stack
      Swift
      Swift Package Manager
    Databases
      MySQL
      PostgreSQL
      SQLite
      MongoDB
    Audience
      iOS developers
      Swift engineers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build the server-side API for an iOS app in Swift so your team does not need to learn a separate backend language.

USE CASE 2

Create a REST API or website back end that runs on Linux servers using Swift.

USE CASE 3

Connect to MySQL, PostgreSQL, MongoDB, or SQLite databases from Swift server-side code.

USE CASE 4

Add Apple Push Notification support to a backend written entirely in Swift.

Tech stack

SwiftSwift Package Manager

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Swift toolchain installed on macOS or Linux, Swift Package Manager downloads all dependencies automatically.

Use freely for any purpose including commercial use, as long as you keep the copyright notice. (Apache 2.0)

In plain English

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.

Copy-paste prompts

Prompt 1
Walk me through starting a new Perfect project, compiling it with Swift Package Manager, and serving my first HTTP endpoint on port 8080.
Prompt 2
Show me how to connect Perfect to a PostgreSQL database and return a JSON list of records from a GET API route.
Prompt 3
How do I add WebSocket support to a Perfect server so my iOS app can receive real-time updates without polling?
Prompt 4
I want to deploy a Perfect app to an Ubuntu Linux server. What do I need to install and how do I run it as a background service?
Open on GitHub → Explain another repo

← perfectlysoft on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.