minimal webdev toolkit in go
Find a file
2024-11-28 10:00:03 -07:00
auth IndentalUserDB: use RWMutex; update test file; gofmt 2023-07-13 17:31:20 -06:00
cookie use TTL with LastSeen instead of hard expiry time 2022-08-02 20:46:34 -06:00
indentalUserDB IndentalUserDB: use RWMutex; update test file; gofmt 2023-07-13 17:31:20 -06:00
middleware add rateLimiters and Throttle middleware 2024-11-28 09:54:35 -07:00
rateLimiter add rateLimiters and Throttle middleware 2024-11-28 09:54:35 -07:00
renderer add subtree renderer, fix static routing for index pages, don't log sessionId when authenticating, and add token auth 2022-07-31 18:08:05 -06:00
router add subtree renderer, fix static routing for index pages, don't log sessionId when authenticating, and add token auth 2022-07-31 18:08:05 -06:00
testData fine tune existing and add more middleware 2022-05-20 21:36:54 -06:00
util add subtree renderer, fix static routing for index pages, don't log sessionId when authenticating, and add token auth 2022-07-31 18:08:05 -06:00
.gitignore remove ServerTask in router 2022-01-08 13:51:25 -07:00
go.mod update package URL; v0.3.0 2023-01-30 20:44:38 -07:00
go.sum add Protected and Authorize middleware, fix cookie bug, gofmt 2022-05-16 00:15:09 -06:00
LICENSE update LICENSE 2024-11-28 10:00:03 -07:00
quartzgun.png add README and LICENSE, and refactor IndentalUserDB to support Data map 2022-01-09 20:16:30 -07:00
quartzgun_test.go add rateLimiters and Throttle middleware 2024-11-28 09:54:35 -07:00
README.md add rateLimiters and Throttle middleware 2024-11-28 09:54:35 -07:00

quartzgun

A lightweight web framework for Go

Quartz Gun effect from Eureka Seven AO, showing a tree of light spanning down to the earth with its root in low orbit

philosophy/design

quartzgun is designed to enable speedy development of efficient web sites and APIs in Go. There are no dependencies outside of the standard library except for bcrypt, and the library is modular -- you can use any part of it independently. The router uses the func(http.Handler) http.Handler middleware pattern so that you can plug and play existing middleware.

There are pre-made renderers which are designed as plug and play endpoints in your middleware chains. They are used for providing the basic functionality of the route, rendering an HTML template in the case of a normal page, or JSON or XML for API endpoints.

The auth system is designed from scratch to provide a modular system where new authentication/authorization backends can be added easily by satisfying the auth.UserStore interface.

about the name

Thinking about URL routes reminded me of the tree of light the fictional Quartz Gun emits when fired, so I named the library quartzgun.

usage

You can check out the quartzgun_test.go file for an overview of how to use it, or see projects like nirvash and felt which use quartzgun extensively.

roadmap/features

Features may be added here at any time as things are in early stages right now:

core functionality

  • router (static service trees, paramaterized routes, and per-method handlers on routes)
  • basic renderers (HTML template, JSON, XML)
  • rate limiters (one by IP and one that is indiscriminate)

auth

  • top-level wrapper for attaching UserStore backends to cookie handler
  • POC indental UserStore implementation
  • both cookie- and token-based authentication (use one but not both together)

etc

  • middleware for easing auth flow:
    • Protected: require login
    • Authorize: login and redirect
    • Bunt: logout and redirect
    • Fortify: setup CSRF protection (use on the form)
    • Defend: enact CSRF protection (use on the endpoint)
    • Provision: use BASIC authentication to provision an access token
    • Validate: valiate the bearer token against the UserStore
    • Throttle: rate limit using a func(*http.Request)bool

license

quartzgun is licensed under the MIT license -- see the LICENSE file for details but the long and short of it is you can use/modify it for any reason, but give me (and other authors where applicable) credit for writing it.

contributing

Send patches to nilix@nilfm.cc using git format-patch -s HEAD~<however many commits>. The -s flag ensures that your name makes it into the commit log.