Tokamak DI container v2 merged

For those who don’t know, Tokamak is a DI-based web framework. It’s been around for some time but I was not particularly loud about it because it always felt that something was not right and it’s a moving target, basically.

I believe that this PR is a significant step in the right direction. We now have comptime DI-graphs (see the video when I add the tk.hackernews.Client) and I get compile error because there is no *tk.http.Client. Then I add a tk.http.StdClient and the compile error goes away. If you are wondering how is that possible, it’s because the framework now auto-detects presence of the .interface field, and automatically exports that ref for injection. In other words, it’s possible to have different implementations but still only depend on the interface. This is already used in tests.

Now, I don’t think tokamak is ready yet (there’s a ton of work, and I still have some gray areas I need to figure out), on top of that, there is no documentation (which I’m going to add but I’d like to do that together with a proper website - and that sort of implies better support for templating engines)

Anyway, have a look, and if you consider it interesting, keep an eye, I think this might get very interesting in a few months.

BTW: some other features not mentioned in the readme:

  • cli, yaml, csv, sendmail, mustache
  • sax XML parser
  • lightweight dom with html parsing, entity decoding, basic selector support (for simple scraping)
  • PoC clients for reddit, hackers, github (many more coming)
  • WIP cron/queue (might be ready this month)
  • WIP ai package for openai/xxx usage
  • WIP regex engine (do not use!)
  • WIP event bus
1 Like

I’m using it on personal project and I love how clean and modular it is! Thanks a ton for your work :).

1 Like