Swiftpack.co -  alchemy-swift/alchemy as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
alchemy-swift/alchemy
Elegant, batteries included web framework for Swift.
.package(url: "https://github.com/alchemy-swift/alchemy.git", from: "v0.1.4")

Elegant, batteries included web framework for Swift.

Swift Version Latest Release License

struct App: Application {
    func setup() {
        self.get {
            "Hello World!"
        }
    }
}

App.launch()

Features

  • Fast, trie based routing.
  • Customizable middleware.
  • First class support for Plot, a typesafe HTML DSL.
  • Expressive ORM and query builder with out of the box support for Postgres and MySQL.
  • Database agnostic schema migrations.
  • Cron-like job scheduling.
  • Powerful dependency injection.
  • Typesafe API definitions, sharable between Swift clients & server.
  • Concise, elegant APIs built with the best parts of Swift.
  • Extensive docs and fully featured quickstart projects.

Installation

Quickstart

The Alchemy CLI can help you get started with one of the Quickstart templates. It is installable with Mint.

mint install alchemy-swift/cli@main
alchemy new MyNewProject

You'll be guided through picking a new project template, either Backend or Fullstack.

Swift Package Manager

Alchemy is also installable through the Swift Package Manager. Until 1.0.0 is released, minor version changes might be breaking, so you may want to use upToNextMinor.

dependencies: [
    .package(url: "https://github.com/alchemy-swift/alchemy", .upToNextMinor(from: "0.1.0"))
    ...
],
targets: [
    .target(name: "MySwiftBackend", dependencies: [
        .product(name: "Alchemy", package: "alchemy"),
    ]),
]

Running It

You can run your server from Xcode or with

swift run

Check out the deployment guide for deploying to Linux or Docker.

Documentation

Docs

The Docs provide a step by step walkthrough of everything Alchemy has to offer. They also touch on essential core backend concepts for developers new to server side development.

Note: If something is confusing or difficult to understand please let us know on Discord!

Quickstarts

If you'd rather just jump into reading some code, the projects in Quickstarts/ are contrived apps for the purpose of showing working, documented examples of everything Alchemy can do. You can clone them with alchemy new or browse through their code on Github.

API Reference

The inline comments are extensive and full of examples. You can check them out in the codebase or on the Github wiki.

Why Alchemy?

Alchemy is designed to make your development experience...

  • Smooth. Elegant syntax, heavy documentation, and extensive guides touching on every feature. Alchemy is designed to help you build backends faster, not get in the way.
  • Simple. Context-switch less by writing full stack Swift. Keep the codebase simple with all your iOS, backend, and shared code in a single Xcode workspace.
  • Rapid. Quickly develop full stack features, end to end. Write less code by using supporting libraries (Papyrus, Fusion) to share code & provide type safety between your backend & Swift clients.
  • Safe. Swift is built for safety. Its typing, optionals, value semantics and error handling are leveraged throughout Alchemy to help protect you against thread safety issues, nil values and unexpected program state.
  • Swifty. Concise, expressive APIs built with the best parts of Swift.

Roadmap

Our top priorities right now are:

  1. Conversion of async APIs from EventLoopFuture to async/await as soon as it's released.
  2. Filling in missing core server pieces. Particularly,
    • HTTP/2 support
    • SSL/TLS support
    • Built in support for multipart/form-data & application/x-www-form-urlencoded
  3. Persistent, queued jobs backed by Redis / Memcached.

Contributing

Alchemy was designed to make it easy for you to contribute code. It's a single codebase with special attention given to readable code and documentation, so don't be afraid to dive in and submit PRs for bug fixes, documentation cleanup, forks or tune ups!

GitHub

link
Stars: 123
Last commit: 13 hours ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

v0.1.4
27 weeks ago

Adds grouping of routes by path prefix.

Courtesy of @slashmo

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API