Skip to main content

Introduction

Goffee is a Go-based web framework designed for developing applications, ideally suited for small to medium-sized projects and microservices. Its streamlined architecture and developer-centric design enhance productivity, enabling developers to work more efficiently and effectively.

Features

  • Routing
  • Controllers
  • Templates (html/template integrated)
  • Hooks
  • Data Validation
  • Databases ORM (GORM integrated)
  • Events
  • Queue system
  • Emails
  • JWT tokens
  • Cache (Redis)
  • Session
  • Secure cookies
  • HTTPS (TLS)

Architecture

Goffee's architecture is MVC, it has a routes file ./routes.go in which you can map all your app routes to their controllers, Controllers are located in the directory ./controllers, and they are simply functions that gets called whenever a requests (GET, POST, ... etc) to the matching route is received.

The request journey:

Request -> Router -> Optional Middleware -> Handler -> Optional Middleware -> Response

Directory structure

├── goffee
│ ├── config/ --------------------------> main configs
│ ├── events/ --------------------------> contains events
│ │ ├── jobs/ ------------------------> contains the event jobs
│ ├── controllers/ ---------------------> route's controllers
│ ├── logs/ ----------------------------> app log files
│ ├── hooks/ ---------------------------> app hooks
│ ├── models/ --------------------------> database models
│ ├── storage/ -------------------------> a place to store files,
│ │ ├── templates/ -------------------> custom templates
│ │ ├── public/ ----------------------> public files without routing system
│ ├── tls/ -----------------------------> tls certificates
│ ├── .env -----------------------------> environment variables
│ ├── .gitignore -----------------------> .gitignore
│ ├── go.mod ---------------------------> Go modules
│ ├── LICENSE --------------------------> license
│ ├── main.go --------------------------> go main file
│ ├── README.md ------------------------> readme file
│ ├── register-events.go ---------------> register events and jobs
│ ├── register-global-hooks.go ---------> register global hooks
│ ├── routes.go ------------------------> app routes
│ ├── run-auto-migrations.go -----------> database migrations

The public files only works if templates is enabled in the environment settings.