Abd Alftah Salem
Hire me
←All case studies

Case study · Open source

Thunder API · Build-API-Collection

A Dart CLI that reads simple comments above Node.js controller methods and generates a Postman collection, a web docs page and Express route files.

01Problem

API docs and routes drift from the code

In an Express backend the same endpoint lives in three places: the controller, the route file and the Postman collection the team tests with. Keeping them in sync by hand is slow and they drift. Thunder API makes the controller the single source of truth.

02My role

Creator and maintainer

I built the CLI and its parser and maintain the package on pub.dev (first release March 2025).

03How it works

Comments in, collection and routes out

Annotations such as // @desc, // @route, // @param, // @body and // @access sit above each exported method. The CLI scans the controllers folder (sub-folders too), parses them and writes a Postman v2.1 collection with folders per controller, a static web page documenting every request, and one Express router per controller.

What the CLI generates

What the CLI generatesAnnotated controllers// @desc // @route // @accessthunder_api parserLF / CRLF · nested foldersPostman v2.1{{base_url}} · {{token}}Web docsindex.htmlExpress routesone router per file
$ dart pub global activate thunder_api
# address_controller.js
// @desc     Get all addresses
// @route    GET /api/v1/addresses
// @access   Private (user)
$ thunder_api --build-api-doc
$ thunder_api --build-routes

04Key technical decisions

The choices that shaped it

Comments as the source of truth

Annotations need no build step, no decorators and no runtime dependency in the Node.js project.

Auth only where it belongs

Routes marked Private (...) get bearer auth with {{token}}; public routes get none.

05Hard parts solved

What made it more than a script

Cross-platform paths

Every path was hard-coded with Windows \; on macOS and Linux output files got names like controllers\thunder-output\Demo.json. 1.1.0 builds paths with package:path.

Collections Postman really reads

The generator wrote variables/events where Postman v2.1 expects variable/event, so {{base_url}} was undefined after import; query params are now in both the URL and Postman's query list.

Valid Express output

Generated routers now pass node --check, with correct HTTP methods and module.exports, for LF and CRLF source files alike.

06Outcome

One annotation, three outputs

1.1.0 added an example project, documented API, 10 tests and CI, and gives friendly errors (exit code 64 on an unknown flag).

3outputs per run
10tests (was 0)
160/160pana score on the release branch (was 130)

pana score (pub.dev's scorer)

v1.0.2130
v1.1.0 branch160

Out of 160.

Commits per month · 72 total

202420252026

Source: git history of the main branch (Oct 31, 2026).

07Stack & links

Built with

© 2026 Abd Alftah Salem · Back to portfolio