🎬 The source for Point-Free, a video series on functional programming and the Swift programming language.
mbrandonw Fix RSS order (#364)
* Fix RSS order.

* better
Latest commit 23af60f Dec 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.bin Upgrade Sourcery to 0.15.0 (#311) Oct 1, 2018
.circleci Swift 4.2 (#316) Oct 3, 2018
.github Update README Screen Shot (#288) Jul 25, 2018
.sourcery-templates Upgrade Sourcery to 0.15.0 (#311) Oct 1, 2018
PointFree.playground Hello World (#325) Oct 10, 2018
PointFree.xcworkspace Small SQL fixes for owners (#210) Apr 16, 2018
Sources Fix RSS order (#364) Dec 14, 2018
Tests Use upcoming invoice for next billing info (#361) Dec 11, 2018
database Database tests (#61) Dec 20, 2017
.PointFree.xccolortheme Add custom Xcode color theme (#175) Mar 9, 2018
.env.example Move server code into this repo! (#164) Feb 25, 2018
.gitignore Fix transcript references (#233) Apr 21, 2018
.gitmodules Fix transcript references (#233) Apr 21, 2018
.swift-version Update to Swift 4.2 Nov 8, 2018
.travis.yml OSS Onboarding (#251) May 25, 2018
CC-LICENSE.md Rename CC-LICENSE to CC-LICENSE.md Mar 6, 2018
Development.xcconfig Swift 4.2 / Xcode 10 (#262) Jul 1, 2018
Dockerfile Deploy to Swift 4.2.1 (#344) Nov 8, 2018
Dockerfile.local Deploy to Swift 4.2.1 (#344) Nov 8, 2018
LICENSE 2018 bump Mar 6, 2018
Makefile Migrate to use swift-html (#326) Oct 21, 2018
OSS.xcconfig Move public episodes to this repo (#190) Mar 25, 2018
Package.swift Upgrade swift-web for new NIO runner. (#363) Dec 12, 2018
README.md Add swift-html to readme (#333) Oct 28, 2018
docker-compose.yml Move server code into this repo! (#164) Feb 25, 2018

README.md

🎬 www.pointfree.co

Swift 4.1 iOS/macOS CI Linux CI @pointfreeco

This repo contains the full source code for the Point-Free website, a video series exploring Swift and functional programming. The codebase is split into 3 pieces:

  • PointFree: This is the core application, and is responsible for routing requests, loading data and rendering HTML and CSS.
  • Styleguide: This library contains functions and data types for creating a consistent style across the entire website.
  • Server: This is the actual executable server. It uses NIO to handle the low-level server responsibilities, and hands everything else over to the PointFree package.

Point-Free Homepage

Getting Started

Interested in a video tour of the code base?

video poster image

The repo contains an extensive test suite and some playgrounds to explore. To get things running:

  • Make sure Xcode is installed!

  • Make sure cmark is installed. You can install it with Homebrew:

    brew install cmark # or your preferred installation method
  • Make sure Postgres is installed and running. It's our database of choice. You can install it with Homebrew:

    brew install postgres # or your preferred installation method
    brew services start postgresql # or your preferred launch method

    (If you use Postgres.app, EnterpriseDB, or another installation method, please follow some additional instructions in the CPostgreSQL README.)

  • Open up a terminal window and grab the code:

    git clone https://github.com/pointfreeco/pointfreeco.git
    cd pointfreeco
  • Bootstrap! If you want us to take care of the details for you, we need to install a few module maps in your SDK path to make sure CommonCrypto, Postgres, cmark, and other modules are available to our libraries, playgrounds, and tests. We also need to set up a pointfreeco user and database in Postgres. You can read our Makefile for more info, and run:

    make bootstrap-oss

With everything bootstrapped and the project open in Xcode, you can:

  • Run the server locally
    • Select the Server target
    • Run: Command+R
    • Visit http://localhost:8080
  • Explore our playgrounds
    • Select the PointFree-Package target
    • Build: Command+B
    • Open a playground!

Some fun things to explore

There're a lot of fun things to explore in this repo. For example:

  • We develop web pages in playgrounds for a continuous feedback loop. This is made possible by the fact that the entire server stack is composed of pure functions with side-effects pushed to the boundaries of the application. It allows us to load up any request in isolation, including POST requests, all without ever worrying about doing a side-effect. Server side Swift in a playground

  • We use snapshot testing to capture full data structures in order to verify their correctness. Not only do we do this in the traditional way of taking screenshots of web pages at various break points (e.g. on iPhone and desktop), but we can also snapshot any entire request-to-response lifecycle (e.g. the POST to a signup page does the correct redirect).

▿ Step
  ResponseEnded

▿ Request
  POST http://localhost:8080/launch-signup

  email=hello@pointfree.co

▿ Response
  Status 302 FOUND
  Location: /?success=true

Xcode Color Theme

Like the color theme we use in our episodes? Run make colortheme to install locally!

Related projects

Point-Free uses a bunch of interesting open-source software:

  • 🗺 swift-html: A Swift DSL for type-safe, extensible, and transformable HTML documents.
  • 🕸 swift-web: A collection of types and functions for dealing with common web server concerns, such as HTML render, CSS preprocessing, middleware and more.
  • 🎶 swift-prelude: Offers a standard library for experimental functional programming in Swift.
  • 🏷 swift-tagged: Helps us create strong contracts with our data boundaries, like JSON from GitHub and Stripe, and our PostgreSQL data.
  • 📸 swift-snapshot-testing: Powers our testing infrastructure by taking snapshots of various data structures to guarantee the correctness of their output. We use this on everything from middleware to ensure requests are correctly transformed into responses, and even entire web pages to make sure the site looks correct at a variety of sizes (e.g. on iPhone and desktop).

Explore more of our open-source on the Point-Free organization.

Learn More

Brandon gave a talk about most of the core ideas that went into this project at Swift Summit 2017.

The two sides of writing testable code

Find this interesting?

Then check out Point-Free!

License

The content of this project itself is licensed under the CC BY-NC-SA 4.0 license, and the underlying source code used to format and display that content is licensed under the MIT license.