Skip to content

podipo/skellago

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skella Back End by Podipo

The Skella back end is a skeleton for web API back ends. It is designed to work with projects based on the Skella front end.

Technologies

The Skella back end compiles go code to produce a web server binary.

The Skella back end is designed to produce fantastic web APIs at great speed. It does not handle the user experience side of things other than to serve up static files. You will want to use one of the many excellent front end toolkits to produce your HTML, Javascript, and CSS, which the skella back end will then happily serve.

The web API is written on top of the Negroni framework. Negroni has the nice property that it plays nicely with go's net/http, so mixing the Skella back end with other go web packages (e.g. a websocket event server) is not hard.

Skella's web API provides a JSON description of itself which is used to automatically create a Backbone.js wrapper. It is through Backbone Models and Collections that the Skella front end connects to the Skella back end. The JSON description is language and framework agnostic, so users of other client frameworks should have no problem using Skella.

Features

  • API resource library
  • Persistence layer using QBS and PostgreSQL
  • User records and authentication
  • API description resource
  • Backbone.js wrapper
  • Go API client
  • Integration with the Skella front end

Installation

If you don't already have git then follow the git download instructions.

If you don't already have make then you'll need to install it. On OS X, that usually means installing X Code.

You'll also need a PostgreSQL server running somethere the code can reach it.

Now open up a terminal to check out the code:

git clone https://github.com/podipo/skellago.git
cd skellago

Edit the Makefile and fix up the POSTGRES_ variables.

Now build, test, and run the service:

make
make test
make install_demo
make run_api

Now point your browser at 127.0.0.1:9000/api/0.1.0/schema and you should see JSON describing the API endpoints.

Development

If this is your first time using the Skella back end and you just want to see it in action, the easiest thing to do is to set up the Skella front end in a directory next to the skellago directory. Go follow the instructions on the Skella front end readme to build the Skella front end and then use make cycle_api to rebuild the Skella back end. The Skella back end assumes that the skella and skellago directories are next to each other and it serves skella/dist/index.html when you hit 127.0.0.1:9000.

So, assuming that the Skella front end is now being served by the back end and that you ran the make install_demo target listed above, you should be able to authenticate with the back end from 127.0.0.1:9000/login/ using the email alice@example.com and the password 1234.

To connect directly to the database with psql:

make psql

Adding API resources

This skeleton project assumes that you're going to add your own API endpoints and fire up your own special API. The easiest way to get started is to modify api.go with a few example resources, using the user and schema resources as examples.

Testing

The Skella back end uses the normal go testing system and includes several handy features for setting up a test DB, a test web API, and a client to exercise the API. To see how that's done, check out *_test.go files like user_test.go.

To run the tests:

make test

Cleaning up

make clean

Todo

  • vendor our go depenencies, perhaps with godep
  • figure out a file persistence story on AWS
  • figure out QBS migrations

Possible future features

  • unified logging (syslogd, papertrail, riemann, heka, sensu, nagios)
  • cross machine file storage (S3, nfs, etc)
  • backup and restoration
  • example project
  • websocket resource pubsub and rpc, perhaps wamp
  • rate limiting
  • brute force auth delays
  • monitoring
  • CDN

License

This project is an effort of Podipo but depends on a HUGE ecosystem of open source code. So, what kind of people would we be if we kept Skella all to ourselves?

This project is licensed under the MIT open source license.

See the included LICENSE for details.

About

A Go back end to go with the Skella front end

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published