Welcome to the typia tutorial
This tutorial walks you from “I just heard of typia” to “I have a small typia-powered service that an LLM can drive.” It’s seven short steps. The full project takes about 30 minutes if you copy-paste, an hour or so if you experiment along the way.
What you’ll build
A tiny Bookmark service:
- A
Bookmarkinterface with constraints (URL format, max-length tags, an optional description) - A validator that rejects bad inputs with helpful error paths
- A JSON loader that reads
bookmarks.jsonfrom disk and refuses to start if the data is corrupt - An HTTP endpoint (via Hono ) that accepts new bookmarks
- An LLM tool that turns a user message like “save https://typia.io for me, tag it as docs” into a real bookmark, with self-correction when the LLM gets the schema wrong
Every piece of typia we cover is something you’d actually reach for in a production project. We won’t touch features just to mention them.
What you should already know
- TypeScript basics — interfaces, type intersections, generics
- npm / pnpm / bun, whichever you prefer
- A terminal you can run commands in
You don’t need to know about JSON Schema, OpenAPI, LLM function calling, or the typia internals. We’ll introduce them as they come up.
If you’d rather try typia before setting up a project locally, head to the browser playground. It compiles in-browser and shows the emitted JavaScript next to your TypeScript — useful for the “should I bother installing this?” decision.
The seven steps
- Install — set up
ttscand write a one-line smoke test - First validator — the
Bookmarkinterface andtypia.assert - Refining types —
tags.Format,tags.MaxLength, and friends - JSON parse & stringify —
assertParseandassertStringify - LLM function calling — turn a TypeScript class into LLM tools
- Plug into a framework — a real Hono endpoint
- Next steps — what to read next
Each step is a separate page. You can read straight through, or skip ahead — but the running code example is the same across all of them, so it’s easier the first time if you do them in order.
If something doesn’t behave the way the tutorial says, the most common cause is a build tool that doesn’t run the typia transform. See the verification step at the end of Install. It catches 95% of “why isn’t this working?” moments.
Ready? → Step 1: Install