Bike

Bike is the easiest web application framework ever. You can make various apps such like blog, forum, contact form by putting single (or several) HTML file with a bit of special markups. The view rules. There is no model definition, no server restart, and no coding at all.

Sites

Features

  • Model / View / Controller defined dynamically by good old HTML.

  • Any block tags (<ul>, <table> etc.) can be an “app”, by adding a workflow class like “app-blog”.

  • The contents inside the app tag will be the “model”.

  • The model is defined by special tags, like “$(foo = text 1..32)” or “$(bar = select a,b,c)”.

  • You can make nested apps inside an app (e.g. blog comments inside a blog entry).

  • Authentication / Authorization / User admin are built in by default.

  • Storage can be plain YAML files (default), or any RDB via Sequel.

  • Bike can be deployed anywhere as it is a simple Rack application.

Quick Start

This is a quick tutorial for making a simple web application using Bike.

Step 1 - Install Bike

Open a command line terminal. Type:

gem install bike

Step 2 - Initialize a Bike Directory

In a command line terminal, go to an empty directory where you want to build Bike projects. Then type:

bike init

This will create a “bike” directory, which includes:

bike/
  config.ru
  skin/

Step 3 - Start a Test Server

Type:

bike run

Step 4 - Try some examples

Now open this URL with your browser.

localhost:9292/

You will see the default homepage of Bike. There is some links to examples such like Blog, Contact Form, Forum, etc. See what can be done by plain HTML files.

Step 5 - Create Your Own App

Create a new directory under bike/skin/:

mkdir skin/myapp/

Then create a new HTML file with your favorite editor:

edit skin/myapp/index.html

The content is: (You can just copy & paste, of course)

<html>
  <head>
    <title>fab forum</title>
    <link rel="stylesheet" href="/css/base.css" type="text/css" media="screen" />
  </head>

  <body>
    <h1><a href=".">fab forum</a></h1>

    <ul id="main" class="app-forum">
      <!-- 1..5 desc may_preview -->
      <li>
        <h2>$(title = text 32 1..32)</h2>
        <div>
          $(content = textarea-pre 60*10 1..)
          <div>by $(_owner) @ $(_timestamp)</div>
        </div>
      </li>
    </ul>

    <p>$(.action_signup)$(.me)</p>
  </body>
</html>

Step 6 - That’s it!

localhost:9292/myapp/index.html

You have just created your first app. Log in with root/root to try it out. Have a nice ride!

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 Akira FUNAI <akira -at- funai -dot- com>. See LICENSE for details.