BeepBeep is a simple web application for Mochiweb inspired by Rails and Merb
Erlang Shell
Switch branches/tags
Nothing to show
Pull request Compare This branch is 2 commits behind dmitriid:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Also see BeepBeep demo/documentation site

BeepBeep a simple web application for Erlang

BeepBeep is a simple Web Application framework for Erlang inspired by Rails and Merb. It follows the
principle of convention over configuration – meaning if you follow the code structure layout and a few
rules when building your app, it’ll require no extra work on you behalf to map Url requests to your
Controllers and Views.

BeepBeep is built on MochiWeb and ErlyDTL,
providing a super fast web server and the abiity to define your templates with the Django template language.


  • A script to generate a new web application (based on mochiweb’s approach)
  • Session Server to store your application state
  • Before filter on your controllers for things like authentication
  • Django templates for the view

Getting Started

  1. download the code
  2. CD into the beepbeep directory
  3. run make
  4. generate a new web application by running ./script/new_beep.erl YouAppName "DestinationDirectory

This will create a web app with everything you need. It includes a Sample controller (main_controller.erl).
To run the sample:

  1. cd into the new application’s directory you created above
  2. Run make to compile the new project
  3. Start the server: ./
  4. Open a browser and visit "http://localhost:8000

How it works:

You write a controller with a set of methods that look like this:


where Action is a string that will match to the request in the Url and
Params is an Array of optional parameters that will be passed to variables
in your controller.

BeepBeep will automatically map Url requests to controller and functions (or actions). For example a request to “/hello/show” would map to the “hello_controller” and invoke the “handle_request(”show",[])" function.

Here’s an example:

%% hello_controller.erl

-export([handle_request/2, before_filter/0]).

%% Maps to http://localhost:8000/hello/show
handle_request("show",[]) ->
    {render, "hello/show.html",[{name,"BeepBeep"}]};

%% Maps to http://localhost:8000/hello/feed/2007
handle_request("feed",[Year]) ->
    %% Now Year contains the value 2007

%% Callback filter hook
before_filter(Params) ->


From “handle_request” we return a tuple that tells the framework what view to use. Views
are located in the views directory. In our example we’ll use the view located in the
subdirectory “hello” and the file “show.html”

Here’s an example of the “show.html” template:

<h2>Hello from {{ name }} </h2>

Which will result in:

<h2>Hello from BeepBeep</h2>

The “name” key set in the controller is passed to the template and expanded using the Django format
via erlyDTL.

This approach provides a clean separation of the erlang logic in the controller and the html code in
the template.

You can also implement the before_filter to check requests before the matching “handle_request” is
called. Filters that pass should simply return the atom ok, otherwise they should return one
of the request responses such as {render…} or {redirect…"

More to come…