Commit 7105024
feat(08): add TypeScript server generator (#121)
* feat(08): add TypeScript server generator (protoc-gen-ts-server)
Extract shared TS type mapping into internal/tscommon/ and add a new
framework-agnostic TypeScript HTTP server generator that uses the Web
Fetch API (Request → Promise<Response>).
- Extract tscommon from tsclientgen (types.go, helpers.go) — zero behavior change
- Add tsservergen with handler interfaces, route descriptors, header validation
- Add 13 golden tests + cross-generator consistency tests vs ts-client
- Update CLAUDE.md with ts-server documentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(08): add path param merge, generation-time validation, and fullstack demo
Path params are now merged into the request body after parsing
(body.id = pathParams["id"]) so handlers receive complete request
objects. Generation fails fast for invalid protos: unmatched path
params and unreachable fields on GET/DELETE methods.
Adds examples/ts-fullstack-demo/ showing TS client + TS server
generated from the same proto, with CRUD, query params, unwrap,
header validation, and custom error handling.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add protoc-gen-ts-server to all project documentation
Update README, architecture, getting-started, client-generation,
examples index, and contributing docs to reflect the new TypeScript
HTTP server generator and the ts-fullstack-demo example.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(08): add interactive browser UI with live server log streaming
Serves an HTML dashboard at / with clickable buttons for all CRUD
operations, query params, unwrap, and error handling scenarios.
Server logs stream to the browser in real-time via SSE so you can
see handler activity as you click.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(08): add proto-defined custom errors and comprehensive request/response logging
Generator: CollectServiceMessages now includes proto messages ending with
"Error", mirroring Go's convention where error messages auto-implement the
error interface. Both ts-server and ts-client generators emit interfaces
for NotFoundError, LoginError, etc.
Demo: proto-defined NotFoundError and LoginError with full round-trip —
server implements generated interfaces, client parses ApiError.body using
generated types. Added Login Error (401) scenario to browser UI.
Server and client now log full request/response details (method, path,
headers, body, status, duration) with colored terminal output.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add TypeScript proto-defined custom error documentation
Update all project docs to cover the new feature where both TS generators
(ts-client, ts-server) emit TypeScript interfaces for proto messages
ending with "Error". Documents the full pattern: proto definition →
generated interfaces → server implements + client parses for type-safe
error handling across the wire.
Updated: CLAUDE.md, architecture.md, client-generation.md, examples
README, http-generation.md, validation.md.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 2ebbcde commit 7105024
58 files changed
Lines changed: 7718 additions & 666 deletions
File tree
- cmd/protoc-gen-ts-server
- docs
- examples
- examples/ts-fullstack-demo
- client
- proto
- server
- public
- internal
- tsclientgen
- tscommon
- tsservergen
- testdata
- golden
- proto
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
37 | | - | |
38 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
| |||
93 | 99 | | |
94 | 100 | | |
95 | 101 | | |
96 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
97 | 105 | | |
98 | 106 | | |
99 | 107 | | |
100 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
101 | 141 | | |
102 | 142 | | |
103 | 143 | | |
| |||
479 | 519 | | |
480 | 520 | | |
481 | 521 | | |
| 522 | + | |
482 | 523 | | |
483 | 524 | | |
484 | 525 | | |
| |||
490 | 531 | | |
491 | 532 | | |
492 | 533 | | |
493 | | - | |
| 534 | + | |
494 | 535 | | |
495 | 536 | | |
496 | 537 | | |
497 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
498 | 545 | | |
499 | 546 | | |
500 | 547 | | |
501 | | - | |
| 548 | + | |
502 | 549 | | |
503 | 550 | | |
504 | 551 | | |
| |||
513 | 560 | | |
514 | 561 | | |
515 | 562 | | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
516 | 576 | | |
517 | 577 | | |
518 | 578 | | |
| |||
544 | 604 | | |
545 | 605 | | |
546 | 606 | | |
| 607 | + | |
547 | 608 | | |
548 | | - | |
| 609 | + | |
549 | 610 | | |
550 | 611 | | |
| 612 | + | |
551 | 613 | | |
| 614 | + | |
552 | 615 | | |
553 | 616 | | |
554 | 617 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
| 187 | + | |
186 | 188 | | |
| 189 | + | |
187 | 190 | | |
188 | 191 | | |
189 | 192 | | |
| |||
395 | 398 | | |
396 | 399 | | |
397 | 400 | | |
| 401 | + | |
398 | 402 | | |
399 | 403 | | |
400 | 404 | | |
| |||
403 | 407 | | |
404 | 408 | | |
405 | 409 | | |
| 410 | + | |
406 | 411 | | |
407 | 412 | | |
408 | 413 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
112 | 117 | | |
113 | 118 | | |
114 | 119 | | |
| |||
119 | 124 | | |
120 | 125 | | |
121 | 126 | | |
| 127 | + | |
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
| |||
136 | 142 | | |
137 | 143 | | |
138 | 144 | | |
| 145 | + | |
139 | 146 | | |
140 | 147 | | |
141 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments