Skip to content
/ mango Public

Simple, modern, opinionated Web Server in Golang

Notifications You must be signed in to change notification settings

kefniark/mango

Repository files navigation

🥭 Mango

Simple, modern, opinionated Web Server in Golang.

Focus on building web services, we take care of the dev tools.

!! WIP Under construction, use at your own risk 😸 !!

Goals

Over time, modern Web Frameworks are becoming more and more complex (tech stack, build time, frontend framework, graphql, ...), this comes with a cost in development time and developer sanity.

The idea behind Mango is take the opposite direction, keep the simplicity of static website generator like Hugo or Vitepress, and add the bare minimum on top to build dynamic websites and api.

Avoid abstraction all over the place, embrace KISS fully and get things done!

Features

  • ❄️ Unified commands (Mango CLI) and configuration (.mango.yaml)
  • ⏳ Mango is pure development tools, zero runtime overhead
  • ⛄ Multi Usage Web Server (pick the part you need):
    • API Endpoints based on Connect (Support GRPC, Restful, OpenAPI, Swagger, ...)
    • Database Access based on SQLC (Support sqlite, postgres, mysql)
    • Support static content (Markdown)
    • Support dynamic HTML content with Templ/Htmx
    • Modern UI based on BeerCSS (Material Design)
  • ✨ Smooth Dev Experience:
  • 🎖 Code generation to reduce boilerplate:
    • Network queries based on Protobuf (Schema First)
    • SQL data structure autogenerated from SQL queries (SQL Schema First)
    • Templ to generate HTML code (HTML First)

Getting Started

Step 1. Setup Environment

devenv shell # not required if you use direnv

Step 2. Use the Mango CLI

  • mango create: Bootstrap new app
  • mango dev: Start the server in development mode
  • mango build: Create Binaries in ./dist (Multi-platform)
  • mango lint: Run Linting (Golangci-lint, Sqlc vet, ...)
  • mango generate: Run all the code generators

App Folder Structure

  • <app>/api: API Schema + Handlers
  • <app>/assets: Static Assets (image, css, js)
  • <app>/codegen: Auto-generated code (DB, Networking, Mocks, ...)
  • <app>/contents: Static Contents (markdown)
  • <app>/db: SQL Schema for SQLC (.sql)
  • <app>/tools: 3rd party tooling (Tailwind, ...)
  • <app>/views: HTMLTemplating
  • <app>/routes.go: HTTP Router
  • <app>/main.go: Server Creation

TODO Progress

  • CLI
    • Bootstrap templates
    • Better CLI logging
  • DB
    • DB Migration Tools
    • SQLC Crud Queries Auto-generated (Insert/InsertAll/Get/List/Delete)
  • Project
    • Web UI (HTMX/Templ)
    • Handle assets/public folder
    • Markdown -> Templ auto-generation (icon, mermaid, code, ...)
    • Background Task (queue)
    • Doc generation
    • Tests / 2e2
  • Dev Tool
    • Support Nix/Devenv
    • Support .env
    • Build
    • Docker compose integration
    • Infra dev tools (graphana)
  • Infra
    • Make it compatible with devenv container
    • Deploy & Document (auto build docker images / binaries) for (Self-hosted, Heroku, Fly.io, GCP, ...)
  • Mango itself
    • Use Mango to generate the static docs of mango
    • Publish docs on github pages