Simple web framework for go, still quite beta at this point

WFDR Framework - Beta Release

New 18/Feb/2012: Updated for go 1.0, new directory layout to take advantage of the go build tool.

Background

There's a million different web frameworks out there, each for a different language. Ruby has rails, java has grails, python has django. However, although each of these frameworks has many merits, they are designed for a single language, and none of them work with go. Regardless, I had a website to write, and go's strengths in that area lead me to chose it as my language of choice. The framework has evolved along with the website, and has been in development for almost a year now. Although the initial builds were not really a framework at all, in the past few months it has evolved to become quite viable for others to use. As a result, I am publishing the source in the hope that others many find it useful, perhaps giving me some constructive feedback and criticism along the way. Expect a few rough edges.

tl;dr: Web framework designed for go, has the ability to work with other languages, not production ready.

Features

  • Serves Files: Static (or dynaically generated!) js, css, and image files are automatically served by the framework for you.
  • Customizable Layouts: Customize as little or as much as you want between mobile and desktop clients, with more to come. (More on layouts)
  • Language Agnostic: Although several features only have bindings for go, implementing them for other languages would be trivial.
  • Encourages Modular Design: Each Module consists of an isolated and functionally independent section of a site. This separation occurs both in the source code (more on modules), and at runtime (more on jails). A bug in one module will leave other modules completely unaffected.
  • Leaves You Alone: Does not force you to write your module as a library, use heavily hacked and customized http libraries, or any other uglyness. The only library that is highly recommended (any only for modules with a UI) is the template library, based on mustache.
  • Customizable: Easy to understand and hack, thanks to a design inspired by UNIX and git.

Getting Started

cd $GOPATH/src
git clone git://github.com/crazy2be/wfdr.git
go install wfdr/...

If all goes well, you've now built the framework. If there is an error while compiling, please let me know by filing a bug report.

Now, you probably want to know how you can actually use this shiny new framework :). First, clone the example repository:

git clone git://github.com/crazy2be/wfdr-example.git
cd wfdr-example

Now, to start the framework, open up two terminals. In both terminals, cd $GOPATH/wfdr-example. In the first terminal, run wfdr-daemon. This daemon process manages your various module processes, as well as starting some other programs to make sure that files are synced automatically when changed (currently Linux only). In the second terminal, you can now use the wfdr command to control modules by communicating with the daemon. Let's start a few of the included example modules:

wfdr start base main auth photos pages news

In order to ensure that they started properly (and didn't fail to register ports or have another fatal failure), you can use the wfdr list command, which shows an asterisk (*) next to running modules.

If all goes well, you should now be able to navigate to http://localhost:8080/ and see these modules running. If not, that's a bug, either in the framework or the documentation. Let me know.

What's Next?

The WFDR framework is designed to be simple to get started with, and should work with whatever your favorite HTTP library is.

Check out the wiki for documentation on how the framework works.

The HelloWorld tutorial is a good place to go if you want to start writing a module.

Comments
  • compile fails

    compile fails

    I've attempted to build (compile) on Snow Leopard with the following result (using Python 2.6):

    rnm-macpro(809)wfdr: ./compile 
    Traceback (most recent call last):
      File "./compile", line 5, in <module>
        import argparse
    ImportError: No module named argparse
    

    And also on CentOS 5.5 (using Python 2.4.3):

    v04(1006)wfdr: ./compile 
      File "./compile", line 34
        extrapad = " " if paddinglen % 2 else ""
                        ^
    SyntaxError: invalid syntax
    
  • What to do With TinyMCE, jQuery?

    What to do With TinyMCE, jQuery?

    As it stands currently, both TinyMCE and jQuery are in the base install of the framework, as some of the modules make use of their functionality. For jQuery, this is not much of an issue, as it is only one reasonably small file, and is commonly used. However, TinyMCE is (ironically) huge, and is used much less frequently. Regardless, these frameworks probably don't belong in a base install of the framework, and should be installable by some other means. Not sure what to do about things like this. How do other frameworks deal with this issue?

  • The Documentation Sucks

    The Documentation Sucks

    There is very little to no documentation about the various aspects of this framework available to the public. However, there is still quite a bit of internal documentation that could be released to the public, bearing a way to convert google docs stuff into a format that github recognizes, and someone with access willing to spend time to remove branding and such.

    Much of even that documentation is outdated, so I'll have to go write some more up when I get a chance (before adding features :P).

  • Switch OpenID Libraries

    Switch OpenID Libraries

    We might want to switch from https://github.com/fduraffourg/go-openid to https://github.com/hokapoka/goauth, as the latter seems to be much more commonly used. However, neither of them seems to be maintained, so we might just have to fork one of them and use the fork...

  • wfdr [re]compile all does not exit nonzero if build fails.

    wfdr [re]compile all does not exit nonzero if build fails.

    Running wfdr recompile all will not exit on the first module that fails with a nonzero exit status. This is problematic because it means that errors are not immediately obvious or as obvious as they should be.

  • Remove base/ and mobile/ subfolders, use _layout instead

    Remove base/ and mobile/ subfolders, use _layout instead

    This issue has been bugging me for some time- the base/ and mobile/ directories within all of the module asset folders (css/, img/, js/, etc) are awkward to work with, and don't really add much in terms of usefulness. Having to navigate an extra directory level should not be required, and adding layout customizations after one of the application versions is developed should be easier. Additionally, created files should be sorted by name then layout by existing user tools.

    The best solution to this problem that I can think of is to name css, js, and template files according to the conventions in the go tree for conditional file inclusions. If you name a file foobar_linux.go, it will only be compiled into the package if the target system is Linux. We could do something similar, although our filter criteria will be different. foobar.css would always be included, foobar_mobile.css would only be included for mobile clients, and foobar_desktop.css would only be included for desktop clients.

    Changing this behavior will require essentially rewriting wfdr-cache-monitor and some of the surrounding scripts. Who knows- perhaps we might get a nicer codebase (the current logic for wfdr-cache-monitor is somewhat convoluted and confusing, despite several rewrites).

  • Optimize Current base Module - Consider nginx

    Optimize Current base Module - Consider nginx

    The base module right now uses an entirely homebrew solution (based on go) in order to achieve the effect of a reverse http proxy. Although it works reasonably well and is fairly reliable, the lack of optimization in both it and the go http methods that it uses means that under heavy loads it will use just as much (or even more!) CPU than the actual modules. A vanilla nginx and plugin-- or, if necessary, a fork/patch--should do the job much more efficiently. However, this not a particularly easy task, and it's not particularly important to the framework in this development stage, so this issue is low priority. Someone can feel free to take this on if they actually want to use this somewhere in production, or are more familiar with nginx.

  • Possible Port Conflicts

    Possible Port Conflicts

    Due to hard-coded listening ports in each of the modules, it's very possible that two modules could end up listening on the same port. The framework should solve this by automatically assigning ports to modules, either by making a config file in each jail upon start like this:

    # Automatically generated module config file
    port=:8081 # One possibility
    listenon=localhost:8081 # Another possibility
    

    Or, alternatively, by passing it as a -port=":8081" command-line argument. Not sure which solution is best at this point.

  • Current RPC Library Causes Random Panics

    Current RPC Library Causes Random Panics

    On my machine, at least, occasionally the wfdr command will panic somewhere in the rpc library when attempting to communicate with the daemon. As far as I know, this is not a bug in the program, but might be a result of using pipes.

    This is not a critical issue, as the crashes are rare, and re-running the command will (almost) always fix the problem. Something certainly worth looking into, however. This does not crash the daemon.

  • Lots of Superfluous Libraries

    Lots of Superfluous Libraries

    The framework right now has lots of libraries that really don't necessarily belong with the framework, but are there as remnants of this being an internal project that started before the days of goinstall. All of the libraries that are not central to the framework should probably be moved to separate repositories if they would be useful on their own, or removed if they are no longer useful.

Golanger Web Framework is a lightweight framework for writing web applications in Go.

/* Copyright 2013 Golanger.com. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except

Nov 14, 2022
An ideally refined web framework for Go.

Air An ideally refined web framework for Go. High-performance? Fastest? Almost all web frameworks are using these words to tell people that they are t

Dec 15, 2022
Web framework for creating apps using Go in Google AppEngine

Welcome to app.go v3.0 app.go is a simple web framework for use in Google AppEngine. Just copy the app folder to your working folder and import it fro

Mar 21, 2021
Eudore is the core of a golang lightweight web framework.

Eudore eudore是一个golang轻量级web框架核心,可以轻松扩展成一个技术栈专用框架,具有完整框架设计体系。 反馈和交流请加群组:QQ群373278915。 Features 易扩展:主要设计目标、核心全部解耦,接口即为逻辑。 简单:对象语义明确,框架代码量少复杂度低,无依赖库。 易用

Nov 7, 2022
Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.
Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.

Gin Web Framework Gin is a web framework written in Go (Golang). It features a martini-like API with performance that is up to 40 times faster thanks

Jan 2, 2023
Goal is a toolkit for high productivity web development in Go language in the spirit of Revel Framework that is built around the concept of code generation.

Goal Goal is a set of tools for high productivity web development in Go language. Goal, being mostly inspired by Revel Framework and its discussions,

Sep 27, 2021
a golang web mvc framework, like asp.net mvc.

goku goku is a Web Mvc Framework for golang, mostly like ASP.NET MVC. doc & api Installation To install goku, simply run go get github.com/QLeelulu/go

Dec 7, 2022
A high level web-framework for Go

go-start is a high level web-framework for Go, like Django for Python or Rails for Ruby. Installation: go get github.com/ungerik/go-start Documentatio

Dec 24, 2022
A lightweight RESTful web framework for Go
A lightweight RESTful web framework for Go

Goweb A lightweight RESTful web framework for Go. For examples and usage, please read the Goweb API Documentation Read our Articles Who uses Goweb? "U

Dec 12, 2022
Fast and Reliable Golang Web Framework
Fast and Reliable Golang Web Framework

Gramework The Good Framework Gramework long-term testing stand metrics screenshot made with Gramework Stats Dashboard and metrics middleware What is i

Dec 18, 2022
Mango is a modular web-application framework for Go, inspired by Rack, and PEP333.

Mango Mango is a modular web-application framework for Go, inspired by Rack and PEP333. Note: Not actively maintained. Overview Mango is most of all a

Nov 17, 2022
Classy web framework for Go

Martini NOTE: The martini framework is no longer maintained. Martini is a powerful package for quickly writing modular web applications/services in Go

Dec 29, 2022
A Go framework for building JSON web services inspired by Dropwizard

Tiger Tonic A Go framework for building JSON web services inspired by Dropwizard. If HTML is your game, this will hurt a little. Like the Go language

Dec 9, 2022
The web framework for Golang
The web framework for Golang

uAdmin the Golang Web Framework Easy to use, blazing fast and secure. Originally open source by IntegrityNet Solutions and Services For Documentation:

Dec 24, 2022
A simple blog framework built with GO. Uses HTML files and a JSON dict to give you more control over your content.

Go-Blog A simple template based blog framework. Instructions Built for GO version: 1 See the Documentation or Getting Started pages in the wiki. Notes

Sep 10, 2022
:bullettrain_side: High-performance web server for Go.
:bullettrain_side: High-performance web server for Go.

Aero is a high-performance web server with a clean API. Installation go get -u github.com/aerogo/aero/... Usage Run this in an empty directory: aero -

Dec 8, 2022
package for building REST-style Web Services using Go

go-restful package for building REST-style Web Services using Google Go Code examples using v3 REST asks developers to use HTTP methods explicitly and

Jan 1, 2023
The easiest way to create web applications with Go

web.go web.go is the simplest way to write web applications in the Go programming language. It's ideal for writing simple, performant backend web serv

Dec 24, 2022
Goldorak GO is a mini framework for the Go programming language. (unfinished dead code)

Goldorak Go =========== > Goldorak GO ! Rétrolaser en action > Goldorak GO !! Va accomplir ta mission > Dans l'infini > Des galaxies > Poursuis ta lu

Apr 29, 2021