Practical Abstract Syntax Trees

In this course, you'll learn the fundamentals of abstract syntax trees, what they are, how they work, and dive into several practical use cases of abstract syntax trees to maintain a JavaScript codebase.

  • 4.8 / 5 (5 ratings)
  • Published
  • Updated
On demand video

1 hr 47 mins

Video Lessons

16 Videos

Course Instructor
How The Course Works


You can take the course from anywhere in the world, as long as you have a computer and an internet connection.


Learn at your own pace, whenever it's convenient for you. With no rigid schedule to worry about, you can take the course on your own terms.


Join a vibrant community of other students who are also learning with Practical Abstract Syntax Trees. Ask questions, get feedback and collaborate with others to take your skills to the next level.


Learn in a cohesive fashion that's easy to follow. With a clear progression from basic principles to advanced techniques, you'll grow stronger and more skilled with each module.

Course Overview

What you will learn
  • Abstract syntax tree fundamentals

  • JavaScript tools that work with abstract syntax trees

  • How to parse, traverse, and generate abstract syntax trees

  • Practical skill set for maintaining large JavaScript codebases

In this course, we'll start with the fundamentals of abstract syntax trees (ASTs) and learn the basic mental models. This general AST knowledge can be translated to almost any tool that works with ASTs.

Why this course?

Understanding and using ASTs unlocks the ability to make sweeping changes in a safe and reliable way in any size codebase.

Course topics

Throughout this course, we'll have converted source code into ASTs, traversed, mutated, and generated ASTs. With these concepts we'll then explore several practical applications including things like code audits (static analysis), code transformations (codemods), and linting.

Module 1

We'll learn the fundamentals of abstract syntax trees.

  • What is an AST?
  • How to explore an AST
  • Examples of JavaScript tools that work with ASTs

Module 2

We'll learn how to work with ASTs.

  • How to turn code into an AST
  • How to programmatically navigate any AST
  • How to leverage TypeScript to prevent runtime errors

Module 3

We'll learn how to statically analyze, or "audit" code to understand the state of the codebase using abstract syntax trees.

  • An introduction to an example codebase and refactor
  • Understanding the state of the current codebase
  • When to use an AST-based tool versus doing something manually

Module 4

We'll learn how to transform, or "codemod" code from one state to another using abstract syntax trees.

  • How to make changes to an AST
  • How to change ASTs with jscodeshift
  • How to test a code transform

Module 5

We'll learn how to write rules, or "lint" code using abstract syntax trees.

  • How to create rules for code
  • How to create custom rules with ESLint
  • How to test a rule

Our students work at


Sample Course Lessons

Course Syllabus and Content

Module 1


1 Lesson 2 Minutes

Module 2

Understanding Abstract Syntax Trees (AST)

4 Lessons 13 Minutes

Module 3

Working with Abstract Syntax Trees

3 Lessons 23 Minutes

Module 4

Code Audits

4 Lessons 22 Minutes

Module 5


2 Lessons 31 Minutes

Module 6


2 Lessons 14 Minutes

What Students are Saying

        Meet the Course Instructor

        Spencer Miskoviak

        Spencer Miskoviak

        👋 Hi! I'm Spencer, the author of this course. When I first heard about abstract syntax trees I thought they were something reserved for academia. After being faced with many large refactorings and seeking a way to automate it, I stumbled across ASTs. I was surprised by the versatility, practical uses, and everyday tooling that relies on ASTs. I shared one of these practical uses at React Conf in 2019 to remove 4MB of JavaScript.

        This course distills the time I spent struggling through documentation in a way I wish I could have learned about abstract syntax trees and their applications in the frontend web ecosystem.

        Purchase the course today

        One-Time Purchase

        Get lifetime access to this course

        $39$49$10.00 off
        Practical Abstract Syntax Trees
        • Discord Community Access
        • Full Transcripts
        • Money Back Guarantee

        newline Pro Subscription


        Get unlimited access to the course, plus 60+ newline books, guides and courses. Learn More

        Practical Abstract Syntax Trees

        Billed annually or $30/mo billed monthly. Free to cancel anytime.

        • Discord Community Access
        • Full Transcripts
        • Money Back Guarantee


        • Unlimited access to 60+ newline Books, Guides and Courses
        • Interactive, Live Project Demos for Every newline Book, Guide and Course
        • Complete Project Source Code for Every newline Book, Guide and Course
        • Best Value 🏆

        Frequently Asked Questions

        Who is this course for?

        This course is for anybody looking to understand the fundamentals of abstract syntax trees and how to apply them in a practical way to maintain and refactor a JavaScript/TypeScript codebase "at scale."

        What if I need help?

        You can ask us questions anytime through the community Discord channel or by sending us a message.

        Practical Abstract Syntax Trees