Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Web framework for Vala

branch: master

Valum Framework. Relax :)

Valum is a web framework written in [Vala](\)).



sudo apt-get install git-core build-essential valac-0.14 libgee-dev \
     libsoup2.4-dev libjson-glib-dev memcached libmemcached-dev \
     libluajit-5.1-dev libctpl-dev

git clone git://
cd valum && make run

Visit http://localhost:3000/

Search for other routes in ./app/app.vala


Setup application

Somwhere in app/myfile.vala

var app  = new Valum.Router();
app.port = 8080;

Simple GET request

app.get("hello", (req, res) => {
  res.status = 200;
  res.mime = "text/plain";
  res.headers["Hello"] = "Browser";
  res.append("Hello World!");

Route scoping

// GET /admin/user/11
// GET /admin/user/antono
app.scope("admin", (admin) => {
  admin.get("user/:id", (req, res) => {
    var id = req.params["id"];
    res.append(@"User id is $id");

Simple POST request (TODO)"form", (req, res) => {
  req.params["title"]; // NOT YET IMPLEMENTED

Scripting languages!

Embedded Lua

Currently it works this way:

var app = new Valum.Router();
var lua = new Valum.Script.Lua();

// GET /lua
app.get("lua", (req, res) => {
    require "markdown"
    return markdown('## Hello from lua.eval!')


This code works with either Lua or LuaJIT depending on --pkg option in Makefile. See ./vapi/lua[jit].vapi for details.

We are going to implement simplier syntax for lua scripts:

Vala code:

app.get("lua.html", app.lua("hello"));

Lua code:

-- VALUM_ROOT/scripts/hello.lua
require 'markdown'
return markdown("# Hello from Lua!!!")
-- returned value will be appended to response body

Resulted html:

<h1> Hello from Lua!!! </h1>

Embedded scheme! (TODO)

Vala code:

app.get("hello.scm", app.scm("hello"));

Scheme code:

;; VALUM_ROOT/scripts/hello.scm
(+ 1 2 3)
;; returned value will be casted to string
;; and appended to response body



var mc = new Valum.NoSQL.Memcached();

// GET /hello
app.get("hello", (req, res) => {
  var value = mc.get("hello");
  mc.set("hello", @"Updated $value");

Redis (TODO)

We need vapi for hiredis:

var redis = new Valum.NoSQL.Redis();

app.get("hello", (req, res) => {
  var value = redis.get("hello");
  redis.set("hello", @"Updated $value");

MongoDB (TODO)

This is not yet implemented. But mongo client for vala is on the way:

var mongo = new Valum.NoSQL.Mongo();

// GET /hello.json
app.get("hello.json", (req, res) => {
  res.mime = "application/json";


  • fork reository
  • pick one task from
  • and add your name after it in TODO
  • code
  • make pull request
  • enjoy :)

Discussions and help

Something went wrong with that request. Please try again.