A Go web framework with user authentication, CSRF protection, templating, config handling, and simple migrations out of the box
Go to file
2024-02-28 10:06:56 -06:00
app Better alignment for memory 2023-12-19 16:41:31 -06:00
config Prebuild templates (base.html + content) at startup to avoid a file parse every page load 2023-12-22 21:03:15 -06:00
controllers Only show logout (now CSRF protected) if user is authenticated, include relevant authentication logic in GET controllers (this should be moved to middleware) 2024-02-14 13:20:35 -06:00
database Ignore fields that are zero value 2024-01-20 16:32:07 -06:00
middleware Clean up error handling, migrate to log/slog, add todo for flash message system in post controller 2023-09-03 15:45:12 -05:00
models Fix boolean column migration example 2024-02-14 13:16:15 -06:00
restclient Handle errors 2023-08-03 12:13:15 -05:00
routes Add GET verb to static handler 2024-02-14 13:16:52 -06:00
security Make all slog errors uniform (lowercase) 2023-09-03 15:56:35 -05:00
static/css Add default theme and apply to pages 2023-03-06 12:44:20 -06:00
templates Only show logout (now CSRF protected) if user is authenticated, include relevant authentication logic in GET controllers (this should be moved to middleware) 2024-02-14 13:20:35 -06:00
templating Prebuild templates (base.html + content) at startup to avoid a file parse every page load 2023-12-22 21:03:15 -06:00
.gitattributes Add .gitattributes to force LF line endings 2023-05-05 12:19:17 -05:00
.gitignore Add more to .gitignore 2023-03-06 21:23:56 -06:00
env_example.json Prebuild templates (base.html + content) at startup to avoid a file parse every page load 2023-12-22 21:03:15 -06:00
go.mod Update x/crypto 2024-02-28 09:51:26 -06:00
go.sum Update x/crypto 2024-02-28 09:51:26 -06:00
LICENSE Add license 2023-01-07 22:08:25 -06:00
main.go Prebuild templates (base.html + content) at startup to avoid a file parse every page load 2023-12-22 21:03:15 -06:00
README.md Fix wording 2024-02-18 17:23:23 -06:00

GoWeb 🌐

GoWeb is a simple Go web framework that aims to only use the standard library. The overall file structure and development flow is inspired by larger frameworks like Laravel. It is partially ready for smaller projects if you are fine with getting your hands dirty, but I plan on having it ready to go for more serious projects when it hits version 2.0.


Current features 🚀

  • Routing/controllers
  • Templating
  • Simple database migration system
  • Built in REST client
  • CSRF protection
  • Middleware
  • Minimal user login/registration + sessions
  • Config file handling
  • Scheduled tasks
  • Entire website compiles into a single binary (~10mb) (excluding env.json)
  • Minimal dependencies (just standard library, postgres driver, and x/crypto for bcrypt)

When to use 🙂

  • You need to build a dynamic web application with persistent data
  • You need to build a dynamic website using Go and need a good starting point
  • You need to build an API in Go and don't know where to start
  • Pretty much any use-case where you would use Laravel, Django, or Flask

When not to use 🙃

  • You need a static website (see Hugo)
  • You need a simple blog (see Hugo)
  • You need a simple site for your projects' documentation (see Hugo)

How to use 🤔

  1. Clone
  2. Delete the git folder, so you can start tracking in your own repo
  3. Run go get to install dependencies
  4. Copy env_example.json to env.json and fill in the values
  5. Run go run main.go to start the server
  6. Rename the occurences of "GoWeb" to your app name
  7. Start building your app!
  8. When you see useful changes to GoWeb you'd like in your project copy them over

How to contribute 👨‍💻

  • Open an issue on GitHub if you find a bug or have a feature request.
  • Email me a patch if you want to contribute code.
    • Please include a good description of what the patch does and why it is needed, also include how you want to be credited in the commit message.

License and disclaimer 😤

  • You are free to use this project under the terms of the MIT license. See LICENSE for more details.
  • You are responsible for the security and everything else regarding your application.
  • It is not required, but I ask that when you use this project you give me credit by linking to this repository.
  • I also ask that when releasing self-hosted or other end-user applications that you release it under the GPLv3 license. This too is not required, but I would appreciate it.