Skip to content

Cardinal v0.0.1 — Initial Release

Choose a tag to compare

@GraHms GraHms released this 04 Sep 05:58
· 9 commits to master since this release

Cardinal v0.0.1

Initial release — a compass for building USSD applications in Go.


✨ Highlights

  • Minimal Core: Request, Reply, Session, Engine
  • USSD-Native Router: SHOW, INPUT, Redirect semantics (instead of HTTP verbs)
  • Menu Builder: auto-formatted newline menus with 1…N, 0) Back, and 00) Exit
  • Parametric Routes: define paths like /confirm/data/:id and access via c.Param("id")
  • In-Memory Session Store: simple and fast; pluggable architecture for Redis/DB
  • Transport Adapter: HTTP handler normalizes common aggregator fields (sessionId, phoneNumber, text)
  • Test Kit: BDD-style Simulator for step-by-step session testing
  • Examples: working airtime/balance demo under examples/basic

📖 Usage Example

r := router.New("/home")

r.SHOW("/home", func(c *router.Ctx) core.Reply {
    return menu.New("/home").
        Title("Welcome").
        Opt("Check Balance", "/balance").
        Exit("Goodbye").
        Prompt(c)
})
r.INPUT("/home", func(c *router.Ctx) core.Reply {
    return menu.New("/home").
        Opt("Check Balance", "/balance").
        Exit("Goodbye").
        Handle(c)
})

Session flow:

CON Welcome
1) Check Balance
00) Goodbye

CON Balance: 123.45 MZN
0) Back

END Goodbye

📌 Roadmap

  • Redis-backed store (production-grade)
  • Middleware chain (Use(Logging, RateLimit, Metrics))
  • Pagination helper for long menus
  • CLI scaffolding (cardinal new app)
  • Documentation site with interactive flow diagrams

⚖️ License

MIT — free to use, adapt, and contribute.