Awesome Open Source
Awesome Open Source

Modern Haskell Webserver Boilerplate

  • Graphql API
      type User {
          id: Int!
          email: String!
          name: String!
          updatedAt: String!
          createdAt: String!
      }
    
      type Session {
          token: String!
          user: User!
      }
    
      type Query {
          login(email: String!, password: String!): Session!
          myUserInfo: User!
      }
    
      type Mutation {
          register(email: String!, password: String!, name: String!): Session!
          changePassword(oldPassword: String!, newPassword: String!): Boolean!
      }
    
  • Database:

This boilerplate wires up:

  • Reading .env using envy
  • Database
  • Graphql API
  • Authorization using JWT
  • Monad transformers

Running

Now GraphQL API is at http://localhost:8080/api

You can also access Graphql Playground at http://localhost:8080/graphiql

Playground

Running on Docker

  • Feed in you database & secret in .env:

    $ cp .env.default .env
    
  • (Optional) Edit anything you need in the .env file

  • Create and start docker containers

    $ docker-compose up
    
  • Now you can visit: http://localhost:8080/ in your local machine.

  • Migrations will automatically run, and you can run them manually anytime using

    $ docker-compose up dbmate
    
  • Stack will restart whenever you change any .hs file, thanks to entr

Contributors

PR are more than welcome. The only note is we use ormolu to format codes.

Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Database (92,881
Web (37,475
Postgresql (23,977
Haskell (20,637
Stack (16,044
Graphql (15,986
Jwt (9,985
Migration (9,900
Webserver (8,129
Jwt Authentication (2,089
Dotenv (1,348
Graphql Server (1,128
Type Safe (919
Graphql Api (891
Monad Transformers (110
Scotty (15
Morpheus (6
Webserver Setup (6
Opaleye (3
Dbmate (3