Defensive programming in TypeScript

Hands-on workshop on building reliable TypeScript APIs with runtime validation

About the workshop

TypeScript’s type system disappears at runtime. Every API response, every JSON.parse, every environment variable is a trust boundary where your types can’t protect you.

This workshop teaches you to identify trust boundaries and validate data at runtime. We’ll start with TypeScript’s strict mode as your first defense, survey the validation library landscape, then build a feature flag evaluation API using Hono and Zod, implementing validation at every layer from environment config to API requests to webhook ingestion.

Audience for this workshop & prerequisites

Frontend developers - with 0–5 years experience - who want to expand into backend development and learn to build type-safe APIs from the ground up.

To attend this workshop, participants must have:

  1. Experience building APIs
  2. Some familiarity with JavaScript
  3. Basic understanding of JSON and REST APIs

Key takeaways from the workshop

  • Identify trust boundaries where runtime validation is critical
  • Configure TypeScript strict mode effectively
  • Evaluate validation libraries and choose the right tool for your context
  • Write Zod schemas confidently
  • Understand end-to-end type safety from server to client

Content which will be covered in this workshop

Trust boundaries & TypeScript’s limits (20 min)

  • Where types can and cannot protect you
  • Live demonstrations: API failures, JSON.parse, environment variables
  • TypeScript strict mode: strictNullChecks, noImplicitAny, unknown vs any

The validation landscape (15 min)

  • Why runtime validation is non-negotiable
  • Survey of libraries: io-ts, Yup, Zod, Valibot, ArkType
  • Trade-offs: bundle size, TypeScript integration, ecosystem
  • Standard Schema: the emerging spec for library interoperability

Schema-based validation with Zod (40 min)

  • Fundamentals: schema definition, parse vs safeParse, type inference
  • Advanced patterns: transforms, refinements, discriminated unions
  • Hands-on exercises

Building a defensive feature flag API (40 min)

  • Introducing Hono & project setup
  • Validating environment variables at startup
  • Request validation with Hono + Zod middleware
  • Consistent error response formatting
  • Generating OpenAPI specs from Zod schemas
  • End-to-end type safety with Hono’s RPC client

Q&A (15 min)

About the instructor

Tushar Choudhari is a software consultant and a solopreneur building fflags.com and llmops.build.
He is a former electrical engineer turned self-taught programmer with experience across multiple startups. Tushar is passionate about developer tooling, TypeScript ecosystem and helping teams ship safer code.

How to attend this workshop

This workshop will be held in-person and is free to attend in-person. Hit register to book your seat. In-person participation is open for 30 participants. Seats will be available on first-come-first-serve basis.

Live stream participation is available for Rootconf and The Fifth Elephant annual members.

Contact information ☎️

For inquiries about the workshop, contact +91-7676332020 or write to info@hasgeek.com