News (via Twitter)

Follow us on Twitter

What is Happstack?

Happstack is a fast and flexible Haskell web framework. Happstack is designed so that developers can prototype quickly, deploy painlessly, scale massively, operate reliably, and change easily. Happstack is supported on GNU/Linux, OS X, FreeBSD, and Windows environments.

happstack-server

At the core of Happstack is happstack-server. happstack-server is a fast and simple HTTP server with built-in support for templating (via blaze-html), request routing, form-decoding, cookies, file-uploads, etc. happstack-server is all you need to create a simple website.

happstack-server is database agnostic and can be used with any of your favorite database libraries from hackage. happstack-server is extensively documented in The Happstack Crashcourse.

happstack-lite

happstack-lite is a streamlined version of Happstack designed to make it quick and easy to start developing web applications. For more information check out the happstack-lite tutorial.

Extensions

Happstack provides a wide range of extensions including:

acid-state
acid-state is a native Haskell, in-memory, transactional ACID, noSQL database. acid-state is a cleaner, faster, and more robust rewrite of the classic happstack-state system. It can easily store complex Haskell datatypes, queries are written in Haskell, and it uses safecopy for automatic version migration.
ixset
ixset is a set-like datatype with support for multiple indexes. It is similar to a table in a traditional SQL database. ixset is often used with the acid-state library.
happstack-plugins
happstack-plugins provides on-the-fly recompilation and dynamic loading of code into running servers. This is especially useful for reloading compiled HTML templates (such as blaze-html). Check out a demonstration here.
jmacro
jmacro is a Javascript templating library. It supports splicing Haskell values into Javascript, static syntax checking, hygienic naming, and more. Documentation on using it with Happstack can be found here.
happstack-hsp
happstack-hsp leverages the HSX and HSP libraries to provide powerful XML and HTML templates. HSX allows literal XML markup to be embedded in Haskell code. This means that you have the full power of Haskell at your disposal in your templates, not some weak, limited templating language.
happstack-heist
happstack-heist brings the power of heist templates to Happstack. heist aims to keep the presentation and business logic well separated. Because heist uses external .xml files for the templates, the templates can be easily edited by non-programmers and modifications do not require the server to be recompiled or restarted. Using heist with Happstack is documented here.
happstack-hamlet
happstack-hamlet brings hamlet templates to Happstack.
happstack-hstringtemplate
happstack-hstringtemplate allows the use of templates which are similar to the Java StringTemplate engine.
web-routes
web-routes is a family of libraries which provide type-safe URL routing. URLs can be mapped to types and back via a number of methods including invertible-syntax descriptions, parsec, template-haskell, quasi-quotation, and more. Documenation can be found here.
digestive-functors
The digestive-functors library provides type-safe, composable HTML form generation and processing. The digestive-functors-happstack library provides Happstack support. The digestive-functors-hsp library includes combinators for using digestive-functors with HSP templates.
happstack-authenticate
happstack-authenticate is a high-level authentication library for Happstack built on top of the authenticate library. It provides support for authentication via OpenId, Facebook, or a username/password. It includes support for multiple authentication methods per account, as well as multiple personalities per account. It includes themeable templates that can easily be integrated into your site.
Other
Happstack can also be used with a wide variety of packages on hackage with no special support. You can use database libraries like, HDBC, Takusen, CouchDB, etc. You can use libraries like aeson for JSON support. Happstack is designed to be open and flexible.

Getting Started

The fastest way to get started is to install happstack from hackage using cabal.

$ export PATH=~/.cabal/bin:$PATH
$ cabal update
$ cabal install happstack-server

Simple App

Here is a simple app to test out your installation. The application will run on port 8000 by default. If you are reading this website on the same machine you are running the app on, just click here to see it.

module Main where

import Happstack.Server

main = simpleHTTP nullConf $ ok "Hello, World!"

Next, head over to the Happstack Crash Course and start hacking!