Skip to content

3️⃣ 🍰 Architecture of the Haskell web applications

License

Notifications You must be signed in to change notification settings

iupii/three-layer

This branch is up to date with Holmusk/three-layer:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2molDmitrii Kovanikov
and
Dmitrii Kovanikov
Jul 15, 2019
1b58ec1 · Jul 15, 2019

History

44 Commits
May 11, 2019
Aug 7, 2018
May 10, 2019
May 10, 2019
May 10, 2019
Aug 7, 2018
Jul 12, 2019
Jul 12, 2019
Jul 2, 2019
Jul 12, 2019
May 11, 2018
Jul 12, 2019
Apr 25, 2018
May 10, 2019
May 10, 2019
May 11, 2019
Jul 15, 2019
May 10, 2019
May 21, 2019
Jul 12, 2019
Jul 12, 2019

Repository files navigation

Logo CircleCI

three-layer

This package is aimed at being a modern, production-level, batteries-included starting template for writing web servers with Haskell on backend and Elm on frontend. It follows the Three Layer Cake. architecture pattern.

Haskell libraries used in here:

Detailed approach description

This section contains more detailed description of the chosen architecture and our particular implementation of it.

Application environment

Data type for the runtime environment for the whole application is defined in the Lib/App/Env.hs module. It contains various fields required for the application processing, like database pool, JWT secret, logger, etc. It also has instance of custom Has typeclass which tells how to extract different parts of the application. This is done to achieve the following purposes:

  1. Specify in the constraints what parts of the environment you need.
  2. Introduce more modularity when multiple different environments are implemented.

Environment initialisation is happening in the Lib.hs module.

Application errors

Module Lib/App/Error.hs contains exhaustive list of all errors that application can throw. This module provides convenient layer between human-readable error names and HTTP error codes. It also contains useful utilities for throwing errors and for formatting CallStack of errors.

Application monad

Main application monad can be found in the Lib/App/Monad.hs module.

Database

This template uses PostgreSQL database and contains helper wrappers around functions from the postgresql-simple library to integrate smoother with our own monad. See Lib/Db/Functions.hs for more details.

Effects

All new effects (like sending an email. storing the file, etc.) should be added to the Lib/Effects/ directory.

About

3️⃣ 🍰 Architecture of the Haskell web applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Haskell 93.0%
  • Elm 4.8%
  • Other 2.2%