On this page
Build a server route with the SDK
Use this guide when your application owns the HTTP route and only needs TaxKit for the calculation.
Before you start
- Use a server-side TypeScript runtime.
- Install the SDK with Install the SDK.
- Keep request validation at your application boundary.
Steps
- Parse your application request.
- Convert accepted fields into canonical TaxKit facts.
- Call the SDK helper.
- Return the report fields your application needs.
Example
Verify the result
Request body:
Expected response:
Handle errors
The handler returns an Effect. Your server host owns execution and maps the typed failure channel to its HTTP status and response shape. Invalid JSON, fractional cents and unsupported periods fail request validation before the calculator runs. Provider or request details are not included in the safe request error.