• Stars
    star
    229
  • Rank 170,619 (Top 4 %)
  • Language
    Lua
  • License
    BSD 3-Clause "New...
  • Created over 13 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bamboo is the web framework of Lua based on Mongrel2, ZeroMQ and NoSQL database.

README

Introduction

Bamboo is a powerful web framework, written in lua. It is designed to be the most popular web framework in lua community, like Django in python, ROR in ruby.

Features

  • Bamboo is a MVC framework;
  • cooperates with mongrel2, zeromq and redis;
  • stateless handler;
  • powerful views rendering engine;
  • a strict single inheritance OOP model style;
  • use a lua table as the main URL router;
  • in each module, there can be another URL router related to this module (URL moduled);
  • project init(), finish(); module init(), finish();
  • a whole set of filter system for handler function;
  • flexible ORM wrapper, specific to redis;
  • powerful MVM (model-to-view mapping) function;
  • decorators on database related actions, to reduce manual code;
  • builtin User, Group and Permission models and a set of permission checking procedure;
  • builtin test framework (based on telescope).

What does it look like?

Project Directory Structure

One project										# This project's directory
├── app											# control code directory
│   └── handler_entry.lua						# entry file
├── initial										# place where put db's initial data
├── media										# static files directory
│   ├── css
│   ├── images
│   ├── js
│   ├── plugins
│   └── uploads
├── models										# place where put model defined files
├── plugins										# plugins directory
├── settings.lua								# project setting file
└── views										# place where put views (html) files
	└── index.html

Entry file

In Bamboo's project, file app/handler_entry.lua is the entry of this project. This file can contain the following parts:

  1. require 'bamboo' (MUST)
  2. require other classes and modules (MUST)
  3. register permissions (Optional)
  4. register filters (Optional)
  5. register models used by this project (Optional)
  6. register modules related by this project (Optional)
  7. handlers of this project (Optional)
  8. main URL router (MUST)

This file looks usually like follows:

------------------------------------------------------------------------
-- bamboo import
require 'bamboo'

-- Other Class and module required
local Form = require 'bamboo.form'
local View = require 'bamboo.view'
local Session = require 'bamboo.session'
local registerModel = bamboo.registerModel
local registerModule = bamboo.registerModule

------------------------------------------------------------------------
-- Model Registrations
local User = require 'bamboo.models.user'
registerModel(User)
local IPUser = require 'models.ipuser'
registerModel(IPUser)
local Upload = require 'bamboo.models.upload'
registerModel(Upload)
local Image = require 'bamboo.models.image'
registerModel(Image)
local Permission = require 'bamboo.models.permission'
registerModel(Permission)

------------------------------------------------------------------------
-- Module Registrations
local module1 = require 'app.module1'
registerModule(module1)
local module2 = require 'app.module2'
registerModule(module2)
local upload = require 'app.upload'
registerModule(upload)

------------------------------------------------------------------------
-- Some handlers
local function index(web, req)
   web:page(View("index.html"){})
end

local function get(web, req)
   ...
end

local function put(web, req)
   ...
end

------------------------------------------------------------------------
-- URL router
URLS = { '/',
	['/'] = index,
	['/index/'] = index,
	['/get/'] = get,
	['/put/'] = put,
}

How to start it

  • Start mongrel2;

    cd ~/workspace/monserver
    bamboo startserver main
    If mongrel2 server occupy this terminal, open a new terminal before next step;

  • Start redis server;

    cd ~
    redis-server /etc/redis.conf

  • Start bamboo project;

    cd ~/workspace/your_project
    bamboo start
    If this step goes smoothly, you will see what like follows:
    CONNECTING / 45564ef2-ca84-a0b5-9a60-0592c290ebd0 tcp://127.0.0.1:9999 tcp://127.0.0.1:9998

  • Open the web browser and input http://localhost:6767 and enter, you will see your project page, if everything is OK;

  • END.

Installation

Please download bamboo_installer-v1.1.1.tar.gz.

Some Websites Using Bamboo Now

Mailing List

Bamboo use the following mailing list:

[email protected] # for global world people [email protected] # for Chinese people

Welcome to discuss.

More Repositories

1

sapper

A lightweight web framework built on hyper, implemented in Rust language.
Rust
617
star
2

forustm

A rust forum.
Rust
58
star
3

rusoda

Rusota is a rust implemented Forum/Blog/CMS system.
Rust
39
star
4

jikeshijian

Practice code for the course of jikeshijian 《Rust语言从入门到实战》
Rust
34
star
5

learn-rust

Learn rust works.
Rust
22
star
6

sapper_examples

sapper examples
Rust
22
star
7

lglib

The basic extended lua libraries for legerobot's all products
Lua
11
star
8

superpoll

superpoll - a rust async runtime extends futures strictly, rather than rewrite many things.
Rust
9
star
9

wumn

Wumn is a thin abstract ORM over SQL and Rust types.
Rust
9
star
10

substrate-highlevel-course

substrate-highlevel-course
Rust
9
star
11

sporm

An easy orm for rust.
Rust
8
star
12

bamboo_doc_cn

The documents of Bamboo web framework for Chinese.
7
star
13

candle_demo_openchat_35

candle_demo_openchat_35
Rust
7
star
14

bamboo-redis

bamboo redis is the combination of redis-lua and lua-hiredis
Lua
6
star
15

eightfish

A framework for openweb
Rust
5
star
16

monserver

a web server based on mongrel2.
C
5
star
17

sapper_std

sapper macro helpers
Rust
4
star
18

learn-async-tokio

learn-async-tokio
Rust
4
star
19

subforum

A Web3.0 forum implemented based on Substrate
Rust
4
star
20

axumapp_stepbystep

axumapp_stepbystep
Rust
3
star
21

jedrc

my .jedrc
3
star
22

mttester-rs

Rust http logic tester, easy to use.
Rust
2
star
23

oneblockplus_offchain_lesson

oneblockplus_offchain_lesson
Rust
2
star
24

event_listener

listen event from substrate
Rust
2
star
25

attendmqtt

Rust
2
star
26

learn-libp2p

libp2p learning and examples
Rust
2
star
27

openforum-subnode

openforum substrate node component
Rust
2
star
28

bevy_snake_stepbystep

bevy_snake_stepbystep
Rust
2
star
29

spcodegen

Sporm code generator.
Rust
2
star
30

panda-rs

The GUI toolkit for rust based on Servo.
2
star
31

discux

A frontend app for forums, connecting to the GUTP data backend.
Rust
2
star
32

tauriapp_stepbystep

tauriapp_stepbystep
Rust
1
star
33

bamboo-plugin-pagination

pagination plugin for bamboo framework.
Lua
1
star
34

mongol

lua driver to mongodb, prototype.
Lua
1
star
35

slint-chatbot-demo

rust+slint+candle+openchat3.5 demo
Rust
1
star
36

sapper_auth

plugin for implement http basic auth
1
star
37

sptool

a tool for communicate via serial port.
Rust
1
star
38

my-first-substrate-test

my-first-substrate-test
Rust
1
star
39

cryptopals

exercises
Rust
1
star
40

lgcms

LegeCMS is a cms lib on top of the bamboo framework.
Lua
1
star
41

blogrs

A Rust blog framework (based on rusoda).
Rust
1
star
42

tryew

The first yew project.
Rust
1
star
43

download_tool

A download tool for tasks.
Rust
1
star
44

bamboo-plugin-board

board plugin for bamboo.
Lua
1
star
45

bamboo-plugin-slide

slide plugin for bamboo.
Lua
1
star
46

ta_config

Textadept's configurations
Lua
1
star
47

lgstring

lglib's string part's C implementation
C
1
star
48

monserver-lua

the lua driver for monserver
Lua
1
star
49

lgcron

lgcron is a cron like daemon tool.
Lua
1
star
50

sapper_tmpl

sapper template view module.
Rust
1
star
51

lgserver-node

a simplified lgserver implementation using node.
JavaScript
1
star
52

subpub_dispatcher

sub and pub dispatcher.
Lua
1
star
53

jmacs_config

My jmacs editor configurations
Ruby
1
star
54

bamboo-plugin-rapidupload

rapid upload plugin for bamboo framework.
Lua
1
star
55

bamboo-the-best-practice

The best practice for bamboo MVC web framework.
1
star
56

st-rs

Simple Terminal written by Rust, for general and embeded board usage.
Rust
1
star
57

bamboo-plugin-managetable

manage table plugin for bamboo framework.
Lua
1
star
58

bamboo_plugins

plugins for bamboo web framework
JavaScript
1
star
59

openforum

An open web forum program
Rust
1
star
60

sapper_logger

sapper request basic logger
Rust
1
star
61

yewapp_stepbystep

yewapp_stepbystep
Rust
1
star
62

sapper_session

sapper cookie plugin
Rust
1
star
63

misctools

some misc tools collection
C
1
star
64

bamvit

Bamboo on luvit.
1
star
65

candle_demo_yolov8

candle_demo_yolov8
Rust
1
star
66

bamboo-plugin-levelink

levelink plugin for bamboo framework.
Lua
1
star
67

sapper_body

body params plugin for sapper web framework.
Rust
1
star
68

bamboo-plugin-xheditor

xheditor plugin for bamboo framework.
JavaScript
1
star
69

learn-rust-lib

learn rust lib usages.
Rust
1
star
70

bamboo-log

a simple daemon and log tool, reload the print function.
Lua
1
star
71

jui

A modified version of dwz-ria, a web base front RIA js framework, clone from http://code.google.com/p/dwz/
JavaScript
1
star
72

sapper_query

sappers urlencoded plugin to parse query string.
Rust
1
star
73

bamboo-plugin-navigator

navigator plugin for bamboo
Lua
1
star