Web framework in Go focused on simplicity and flexibility.
- Nested structure
- Lose coupled modules
- Pluggable DB layer
- Memcache support
- CLI commands support
- URL reverse
- JWT based sessions
- Pongo2 templates
- Type safe config
After cloning repo you have to rename all github.com/alehano/gobootstrap to
{your project path}. Feel free to modify source code as you want.
Project has a nested structure. Top level parts can be used by many lower level parts.
For example, top level /helpers package should contain more common helpers
than more specific lower level /views/contacts/helpers.go.
Also, files under common dirs considered as upper level's. For example,
/views/common/tmpl dir should contain files using by multiple views, but
/views/admin/tmpl should contain files using only from /admin section.
Complex tasks usually involving multiple models interactions.
Centralized storage of config parameters and some others items using in many parts of the App, like Cache Keys.
Set of App specific helpers methods. Independent from other parts of the App.
For more common helpers use github.com/alehano/gohelpers.
Data structures and data access layer (Manager) with DB persistence layer (Storage). Models are independent from other parts instead of Config. Models can send PubSub messages to communicate with each other and trigger other actions.
Background jobs.
Core components of the App. Used in many others components. Can depend on Config, Helpers and external packages. Often contain stores of some items like URL routes or CLI commands.
Utils more complex than helpers, but also independent from other parts of the App.
Representation layers split by modules. Contains web handlers, templates, static files (img, js, css) and more. Handlers mostly use model Managers to get and save data.
Config file can be loaded either by set environment variable "APP_CONFIG" with full path to .yml config file or by putting config.yml to the app working directory.
debug: true
port: 8000
project_path: "/Users/alehano/Development/go/src/github.com/alehano/gobootstrap"
website_protocol: "https://"
website_domain: "example.com"
admin_login: "admin"
admin_password_hash: "$2a$10$5gCLP.GlOVBVFLtrzhoxfO5wsT0eiH7IsjzupA7ukTyI/znLFotHu" # password is "admin"
jwt_secret: "secret"Framework has several built-in CLI command. To get list of commands, just run it without parameters.
To start server, run go run main.go run_server (you have to have defined APP_CONFIG environment variable with full path to a config file).
Here is a list of used packages. You might have to read their docs to use them.