Repository navigation
Cardinal v0.0.1 — Initial 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,Redirectsemantics (instead of HTTP verbs) - Menu Builder: auto-formatted newline menus with
1…N,0) Back, and00) Exit - Parametric Routes: define paths like
/confirm/data/:idand access viac.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
Simulatorfor 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.