Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Arcade API Example

Get Involed with Perfect!

Star Perfect On Github Stack Overflow Follow Perfect on Twitter Join the Perfect Slack

Swift 3.0 Platforms OS X | Linux License Apache PerfectlySoft Twitter Slack Status

Arcade API backend example

Using Perfect, this example demonstrates JSON API interactions with GET and POST methods, storing and retrieving data via the SQLite3 version of StORM (a Swift ORM). HTTP Requests are logged using Perfect-RequestLogger by David Fleming.

###Compatibility with Swift

This project works only with the Swift 3.0 toolchain available with Xcode 8.0+ or on Linux via

Swift version note:

Due to a late-breaking bug in Xcode 8, if you wish to run directly within Xcode, we recommend installing swiftenv and installing the Swift 3.0.1 preview toolchain.

# after installing swiftenv from
swiftenv install

Alternatively, add to the "Library Search Paths" in "Project Settings" $(PROJECT_DIR), recursive.

Building & Running

The following will clone and build an empty starter project and launch the server on port 8181.

git clone
cd PerfectArcade
swift build

If you see a build error concerning OpenSSL, please see the swift version or Library Search Paths recommendations above.

You should see the following output:

Starting HTTP server on with document root ./webroot

This means the server is running and waiting for connections.

Building the Xcode Project

To build the Xcode project, run the following in Terminal with the working directory being PerfectArcade as above.

swift package generate-xcodeproj

The output:

generated: ./PerfectArcade.xcodeproj

Available Routes

POST http://localhost:8181/api/v1/save
	user, ideally 3 letters, i.e. AAA
	score, an integer.

The save method returns a status of the action.

GET http://localhost:8181/api/v1/highscores

The highscores method returns the top 10 high scores, and the associated user.


If you find a mistake, bug, or any other helpful suggestion you'd like to make on the docs please head over to and raise it.

A comprehensive list of open issues can be found at

Further Information

For more information on the Perfect project, please visit


An example Arcade game backend using Perfect





No releases published


No packages published


You can’t perform that action at this time.