

# Examples [#examples]

Use these examples when you want a short, typechecked file that exercises one
public integration path. The files export Effect programs or handlers. Your
application runtime decides how to run them.

## Example files [#example-files]

| Example             | Path                                                                                                                                                                             | Covers                                                                                       |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| Node server route   | [`packages/docs-examples/src/node-server.ts`](https://github.com/crcorbett/taxkit/blob/a151e51e8a30247526fa93412df046955846eca4/packages/docs-examples/src/node-server.ts)       | Returning an Effect that validates requests and calls `calculateReport` from a server route. |
| Browser HTTP caller | [`packages/docs-examples/src/browser-http.ts`](https://github.com/crcorbett/taxkit/blob/a151e51e8a30247526fa93412df046955846eca4/packages/docs-examples/src/browser-http.ts)     | Returning an Effect that calls the typed HTTP client with canonical facts.                   |
| Effect request      | [`packages/docs-examples/src/effect.ts`](https://github.com/crcorbett/taxkit/blob/a151e51e8a30247526fa93412df046955846eca4/packages/docs-examples/src/effect.ts)                 | Constructing a `calculateRunRequest` program for an Effect application.                      |
| Error handling      | [`packages/docs-examples/src/error-handling.ts`](https://github.com/crcorbett/taxkit/blob/a151e51e8a30247526fa93412df046955846eca4/packages/docs-examples/src/error-handling.ts) | Reading a `TaxKit.safe.calculate` failure value.                                             |

The validation, calculator-help, fact-definition, integration-test and raw HTTP error guides also copy their
complete TypeScript fences from checked example files. Authored-content
validation rejects a fence that differs from its source.

* [External input validation](https://github.com/crcorbett/taxkit/blob/a151e51e8a30247526fa93412df046955846eca4/packages/docs-examples/src/validate-external-input.ts)
* [Typed calculator help](https://github.com/crcorbett/taxkit/blob/a151e51e8a30247526fa93412df046955846eca4/packages/docs-examples/src/calculator-help.ts)
* [Raw HTTP error envelope](https://github.com/crcorbett/taxkit/blob/a151e51e8a30247526fa93412df046955846eca4/packages/docs-examples/src/api-error-envelope.ts)
* [Fact definition](https://github.com/crcorbett/taxkit/blob/a151e51e8a30247526fa93412df046955846eca4/packages/docs-examples/src/define-gross-pay-fact.ts)
* [Integration tests](https://github.com/crcorbett/taxkit/blob/a151e51e8a30247526fa93412df046955846eca4/packages/docs-examples/test/integration.example.test.ts)

## Typecheck examples [#typecheck-examples]

Typecheck every checked example:

```sh
bun run --filter=@taxkit/docs-examples check-examples
```

The browser HTTP example takes an explicit `URL` and uses the typed API client
with `FetchHttpClient.layer`. The application host owns Effect execution and
error handling; the example does not start a runtime.

## Related pages [#related-pages]

* [SDK reference](/reference/sdk)
* [API reference](/reference/api)
* [Error reference](/reference/errors)
* [Test your integration](/guides/test-your-integration)
