00 β Start Here β The Zero-to-Hero Path
Level: Beginner Β· Time: 10 min to read, 8β12 weeks to finish Β· Prerequisites: none beyond basic computer use
This is a complete, ordered path from never having written TypeScript to shipping a console application and a small web application that read files, call an API and store data in a database. Every lesson is short enough to finish in one sitting, builds on the previous one, and ends with an exercise you can actually run.
The course is written for a reader who already knows a little programming (variables, loops, functions in any language) β but not JavaScript and certainly not TypeScript. If you have never programmed at all, do Lesson 1 slowly and expect to re-read it once; it is written to be readable without prior JavaScript experience.
What you will be able to do at the end
By the last lesson you will have built, and be able to explain, the same application twice:
- A console application that reads a configuration file, calls a public API, validates the response, stores it in a database, and prints a report β with proper error handling, logging and exit codes, packaged so someone else can run it.
- A web application: a TypeScript backend exposing a validated JSON API over a database, and a typed browser front end that consumes it, with the build and deployment steps done by hand once so the magic is gone.
The running example throughout is a small solar production tracker for a household installation in Senegal: real public data (NASA POWER irradiance, PVGIS yields), a real schema, real API calls. You do not need any interest in solar power β the domain is just a credible excuse to exercise files, HTTP, validation and SQL together rather than in isolated toy snippets.
How to use this course
| Rule | Why |
|---|---|
| Go in order. | Each lesson assumes the vocabulary of the previous ones. The numbering is the syllabus. |
| Type every example by hand. | Reading TypeScript feels easy and teaches almost nothing; typing it makes the compiler your teacher. |
Do the Try it exercise before the next lesson. |
It is one small task, designed to be finished in 10β20 minutes. |
| Expect the compiler to shout. | A red squiggle is the feature, not a failure. Lesson 3 teaches you to read the messages. |
| Keep one repository for the whole course. | Create ts-zero-to-hero/ on day one and let it grow: fewer setup surprises, and you finish with a real project. |
| Never move on with a broken build. | npm run typecheck must pass before you continue. Discipline here pays for itself ten times over. |
What you need: a computer with Node.js 20 LTS or newer, VS Code (or any editor with a TypeScript language server), and a terminal. Everything else in this course is free and open source. No cloud account is required until Lesson 41, and even there a local machine is enough.
The curriculum map
01 β Foundations
The language and the toolchain β enough to write and run real programs
| # | Lesson | What it covers |
|---|---|---|
| 1 | What TypeScript Is, and Why It Exists | What a type system buys you, why JavaScript fails silently, and the one mental model (types are erased at runtime) the whole course rests on |
| 2 | Your Toolchain β Node, npm, VS Code and the Compiler | Node, npm, VS Code and the compiler installed properly, tsconfig.json read line by line, and the npm scripts every project needs |
| 3 | Your First TypeScript Program | Compile and run your first program, read a compiler error like a professional, and see the difference between a type error and a runtime crash |
| 4 | Primitive Types and Type Inference | string, number, boolean, null and undefined, plus any, unknown and never β and why unknown is the safe type at every boundary |
| 5 | Variables, Functions and Parameters | Functions done properly: optional and default parameters, rest arguments, return types, callbacks and overloads |
| 6 | Arrays, Tuples and Objects | Arrays, tuples and objects: the collection methods you use daily, readonly discipline, spread, destructuring and safe copying |
02 β Modelling with Types
Types stop being decoration and start describing your domain precisely
| # | Lesson | What it covers |
|---|---|---|
| 7 | Unions, Intersections and Discriminated Unions | Unions and discriminated unions β the single most useful TypeScript pattern, used to model state machines instead of booleans |
| 8 | Narrowing and Type Guards | Narrowing and type guards: typeof, instanceof, in, custom predicates, assertion functions and exhaustiveness with never |
| 9 | Generics | Generics from first principles: keep the caller's type, constrain with keyof, and know when a generic is over-engineering |
| 10 | Interfaces and Type Aliases | Interfaces versus type aliases: what each can do that the other cannot, and the convention that ends the argument |
| 11 | Utility Types and Template Literal Types | Utility types (Partial, Pick, Omit, Record, ReturnType, Awaited) and template literal types for string-shaped contracts |
| 12 | Modules, Imports and Project Structure | ES modules versus CommonJS, how Node resolves imports, path aliases, and a project structure that scales past ten files |
03 β Classes and Object-Oriented Design
Objects, contracts, dependency injection and a domain model that survives growth
| # | Lesson | What it covers |
|---|---|---|
| 13 | Classes β Fields, Constructors and Methods | Classes: fields, constructors, parameter properties, readonly, static members, and how a class really behaves at runtime |
| 14 | Access Modifiers, Encapsulation and Getters | public, private, protected and #private, getters and setters, encapsulation as a design choice rather than a keyword |
| 15 | Inheritance and Polymorphism | Inheritance and polymorphism: extends, super, overriding, the Liskov rule, and the fragile-base-class problem |
| 16 | Abstract Classes, Interfaces and Dependency Injection | Abstract classes, interfaces as contracts, and constructor dependency injection that makes storage and APIs swappable and testable |
| 17 | Composition, Domain Modelling and Custom Errors | Composition, value objects, domain modelling and a real error hierarchy β the design lesson that makes bigger programs survive |
04 β Async, Errors and the Runtime
What Node really does, how to wait without blocking, and how to fail gracefully
| # | Lesson | What it covers |
|---|---|---|
| 18 | The Node.js Runtime and the Event Loop | What Node actually is: V8, libuv, microtasks and macrotasks, why a synchronous loop freezes everything, and the platform modules you use daily |
| 19 | Promises and async/await | Promises and async/await: what an async function returns, the accidental serialisation trap, and running work in parallel on purpose |
| 20 | Error Handling Done Properly | Errors in TypeScript: catch (e: unknown), custom error classes with codes, fail-fast versus recover, and the Result pattern |
| 21 | Concurrency β Parallel Work, Timeouts and Cancellation | Promise.all and friends, concurrency limits, timeouts and cancellation with AbortController, retry with backoff, partial success |
05 β Files, Configuration and Console Apps
The file system, JSON, CSV, configuration, and a complete CLI application
| # | Lesson | What it covers |
|---|---|---|
| 22 | Reading and Writing Files | Files with node:fs/promises: reading, writing, atomic writes, paths done right, streams for large files and safe directory handling |
| 23 | JSON, Validation and Environment Configuration | JSON and validation: JSON.parse returns any, zod schemas at the boundary, and typed configuration validated at startup |
| 24 | CSV and Tabular Data | CSV parsing and writing done correctly, locale and number traps, plus the spreadsheet-to-SQLite migration exercise |
| 25 | Building a Real Console Application | A real command-line application: arguments, subcommands, interactive prompts, structured logs and exit codes that scripts can trust |
| 26 | HTTP Without Magic | HTTP without magic: methods and idempotency, status codes worth memorising, headers, cookies, CORS and pagination shapes |
06 β Talking to APIs
HTTP, authentication, resilience, validation at the boundary, and the start of data storage
| # | Lesson | What it covers |
|---|---|---|
| 27 | fetch in Practice | fetch in Node and the browser: query parameters, JSON bodies, consuming responses, and one typed request helper you will reuse everywhere |
| 28 | Authentication, Secrets and Local Mock Servers | API keys, Bearer tokens and secrets management, what never belongs in a URL or in git, and a local mock server for offline development |
| 29 | Resilience β Timeouts, Retries, Rate Limits and Pagination | Timeouts, retry policy, exponential backoff with jitter, rate limits, idempotency keys, pagination and cheap caching |
| 30 | Typing API Responses at the Boundary | The boundary rule: everything from the network is unknown until validated β zod at the edge, DTO to domain mapping, contract tests |
| 31 | Databases and SQL Fundamentals | Relational versus document storage, and the SQL you actually need: SELECT, JOIN, GROUP BY, indexes, transactions and injection prevention |
07 β Databases and Persistence
SQLite and PostgreSQL, a real schema, repositories, transactions and operations
| # | Lesson | What it covers |
|---|---|---|
| 32 | SQLite in TypeScript with better-sqlite3 | SQLite with better-sqlite3: schema, a minimal migration mechanism, repositories, transactions and testing against an in-memory database |
| 33 | PostgreSQL with Prisma and Migrations | PostgreSQL and Prisma: schema.prisma, migrations, typed queries, relations and connection configuration in one coherent workflow |
| 34 | Repositories, Transactions and Data Modelling | Repositories and mapping, unit of work, transactions across repositories, safe filtering and pagination, idempotent imports |
| 35 | Running Databases in Practice β Docker, Seeds, Backups and Pools | Postgres in Docker Compose, seeding without accidents, backups you have actually restored, pools and graceful shutdown |
08 β From Console to Web
The browser, the DOM, your own API, a TypeScript backend, and deployment
| # | Lesson | What it covers |
|---|---|---|
| 36 | How the Browser Runs Your Code | How the browser runs your code: DOM, CSSOM, modules, bundlers, Vite, and the developer tools you will live in |
| 37 | Your First TypeScript Web App with Vite | Your first web app with Vite and TypeScript: project structure, the two tsconfigs, environment variables, build and preview |
| 38 | The DOM and Events, Typed | Typed DOM access and events, safe element creation, forms and validation, plain-TypeScript state, and accessibility basics |
| 39 | Calling Your Own API from the Browser | Calling your own API from the browser: CORS in practice, the loading/error/empty union, aborting stale requests, optimistic updates |
| 40 | A Backend in TypeScript | A backend in TypeScript: routes, zod validation, service and repository layers, middleware, logging, CORS and a shared typed API client |
| 41 | The Full-Stack Project β Build, Configuration and Deployment | Shipping it: build pipeline, Docker image, reverse proxy with HTTPS, migrations in deployment order, health checks and an end-to-end checklist |
09 β Testing, Quality and What Comes Next
Tests, type-safety discipline, publishing, and where to go from here
| # | Lesson | What it covers |
|---|---|---|
| 42 | Testing with Vitest | Vitest from setup to habit: unit tests of domain logic, async and fake timers, isolation with in-memory storage, coverage and CI |
| 43 | Type-Safety Discipline and Common Traps | any, as, ! and @ts-ignore β the escapes that quietly break your safety net, the strict flags that catch them, and the migration path from JavaScript |
| 44 | Libraries, Publishing and What to Learn Next | Reading library types, the advanced patterns worth knowing, publishing a package, the ecosystem map and a 50-term glossary |
Click the diagram to open it full size.
A realistic pace
| Weeks | Modules | What you can do at the end |
|---|---|---|
| 1 | 01β02 | Write and run typed programs; express shapes, unions and generics; read compiler errors |
| 2 | 03β04 | Design classes and contracts; handle async work and failures properly |
| 3 | 05β06 | Build a CLI that touches files, calls an API and validates what comes back |
| 4 | 07 | Design a schema, store data in SQLite, then PostgreSQL through Prisma |
| 5 | 08 | Build, wire and deploy a small full-stack TypeScript application |
| 6 | 09 | Test it, tighten the types, publish something, know what to learn next |
One lesson a day (20β40 minutes) finishes the course in about six weeks. Three lessons a day turns it into a two-week sprint β the material supports both, because every lesson is self-contained.
Two habits that make the difference
Type at the boundaries, infer inside. You will hear this repeatedly: annotate what enters and leaves a function (parameters, return types), let the compiler infer everything in the middle. Types at the edges catch real bugs; types in the middle are just noise you have to maintain.
Let the types describe the domain, not the database. A User from the outside world, a User
row in a table and a User sent to the browser are three different things that will drift apart.
Lesson 30 gives you the vocabulary to keep them separate without ceremony.
Reference material that ships with the course
- The solar dataset: the course reuses public data β daily photovoltaic yield per region from PVGIS and hourly irradiance from NASA POWER. Download scripts are given in Lesson 27; you may also substitute your own CSV.
- Cheat sheets: the last lesson contains a 50-term glossary and a syntax cheat sheet of the twenty forms you will use every day.
- Companion articles: the data-science articles in this knowledge base show the same data used for modelling instead of engineering, if you want to see where the data comes from.
Next
Start with the first lesson β it assumes nothing.
