Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


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

Perfect URL Shortener 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

An Example URL Shortener System for Perfect

This project demonstrates the following:

  • Mustache templating
  • URL routing and handlers
  • URL Variables
  • Static file serving
  • SQLite3 database setup, and search.

This package builds with Swift Package Manager and is part of the Perfect project.

Ensure you have installed Xcode 8.0 or later.

Setup - Xcode 8

  • Check out or download the project;
  • In terminal, navigate to the directory and execute
swift package generate-xcodeproj
  • Open PerfectURLShortener.xcodeproj

Due to the complexity of running static file serving from Xcode, we suggest running this project from Terminal.

Optionally, to run from within Xcode, edit the Scheme, Under "Options" for "run", check "Use custom working directory" and choose the project's working directory. After doing this, the project can be run from within Xcode.

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

Setup - Terminal

  • Check out or download the project;
  • In terminal, navigate to the directory
  • Execute swift build
  • Once the project has compiled, execute ./.build/debug/PerfectURLShortener
[INFO] Starting HTTP server on with document root ./webroot



We are transitioning to using JIRA for all bugs and support related issues, therefore the GitHub issues has been disabled.

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 URL Shortener System for Perfect







No releases published


No packages published