bradparker / servant-beam-realworld-example-app

Exemplary fullstack Medium.com clone powered by Servant and Beam

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RealWorld Example App

Build Status

A Servant and Beam codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged fullstack application built with Servant and Beam including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the Haskell community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

Status

With the caveat that the Authorization header format is slightly different, this is done:

┌─────────────────────────┬──────────┬──────────┐
│                         │ executed │   failed │
├─────────────────────────┼──────────┼──────────┤
│              iterations │        1 │        0 │
├─────────────────────────┼──────────┼──────────┤
│                requests │       31 │        0 │
├─────────────────────────┼──────────┼──────────┤
│            test-scripts │       46 │        0 │
├─────────────────────────┼──────────┼──────────┤
│      prerequest-scripts │       17 │        0 │
├─────────────────────────┼──────────┼──────────┤
│              assertions │      280 │        0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 18s                       │
├───────────────────────────────────────────────┤
│ total data received: 5.77KB (approx)          │
├───────────────────────────────────────────────┤
│ average response time: 25ms                   │
└───────────────────────────────────────────────┘

TODO

  • I'm not thrilled by that average response time, this is over localhost ... working with quite empty tables.

Getting started

  1. Use Nix to get all the Haskell package and application dependencies you need.
$ nix-shell
  1. Create .envrc from example and allow contents
$ cp .envrc.example .envrc
$ direnv allow
  1. Setup the database.
$ database/scripts/setup
  1. Run the test suite.
$ cabal new-test

You can run these in a watch mode using ghcid:

$ dev/watch-tests

Which might look something like this:

asciicast

  1. Run the app.
$ cabal new-run exe:realworld-conduit

About

Exemplary fullstack Medium.com clone powered by Servant and Beam

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Haskell 92.8%Language:Nix 3.3%Language:PLpgSQL 2.0%Language:Shell 1.8%