Outline updated November 2026

Foundation35 hours delivered over 5-10 daysLive, online or on-site

Request this course

Rust for JavaScript and TypeScript Programmers

Class Duration

35 hours of live training delivered over 5-10 days to accommodate your scheduling needs.

Student Prerequisites

  • Strong working proficiency in JavaScript or TypeScript
  • Comfort with Node.js, npm/pnpm, and modern bundlers
  • Familiarity with TypeScript's structural type system is helpful
  • No prior Rust experience required

Target Audience

JavaScript and TypeScript engineers adding Rust for fast Node services, WebAssembly modules, CLIs, or full-stack web apps. It fits full-stack teams that want one language in the browser and on the server. Teams continuing on can move to Memory-Safe Programming with Rust and then Rust Parallel Programming. For the web stack, see Web APIs with Rust and Actix-web and Full-Stack Web Apps with Rust and Leptos.

Description

This course teaches production Rust to experienced JavaScript and TypeScript developers. Each concept is taught against its JS or TS equivalent, such as ownership against garbage collection and enums against discriminated unions. Students compare lazy Tokio futures with eager Promises, and sized numeric types with number. The course also covers where Rust already runs in the JavaScript world: build tools, native Node.js addons, and WebAssembly. It ends with a REST API on Actix-web and a Leptos front end, built with help from AI coding assistants.

Learning Outcomes

  • Write idiomatic Rust using ownership, borrowing, and lifetimes.
  • Map common JavaScript and TypeScript idioms to Rust.
  • Build CLIs, library crates, and async services on Tokio.
  • Use traits and generics where TypeScript uses interfaces.
  • Query PostgreSQL from Rust with sqlx.
  • Build a REST API on Actix-web.
  • Build a client-side WebAssembly app with Leptos.
  • Call Rust from JavaScript through WebAssembly or napi-rs.
  • Check AI-generated Rust with the compiler, clippy, and tests.

Training Materials

All students receive comprehensive courseware covering all topics in the course. Courseware is distributed via GitHub in the form of documentation and extensive code samples.

Software Requirements

A free GitHub account, the current stable Rust toolchain via rustup (2024 edition), with examples on Actix-web 4 and Leptos 0.8, Node.js 22+, Visual Studio Code or another supported editor with the rust-analyzer extension, Docker for the local PostgreSQL instance used in the database module, and an AI coding assistant of choice (GitHub Copilot, Cursor, or Claude Code). A cloud-based environment can be provided if local installation is restricted.

Training Topics

Introduction: Rust from a JS/TS Perspective

  • Where Rust fits next to JS and TS
  • What the current edition changed
  • Rust vs. JavaScript at a glance
  • Nominal vs. structural typing
  • The Rust ecosystem

Toolchain and Editor Setup

  • Installing Rust with rustup
  • cargo vs. npm, pnpm, and yarn
  • rust-analyzer in VS Code, RustRover, and Zed
  • AI assistants for Rust
  • The Rust Playground

Cargo and Crates

  • cargo new, cargo run, cargo build, cargo test
  • Cargo.toml vs. package.json
  • Workspaces and cargo publish --workspace
  • Popular crates such as serde and tokio

Rust vs. JS/TS: A Working Map

  • Static vs. dynamic typing
  • Runtime types vs. erased TypeScript types
  • Ownership vs. garbage collection
  • Option<T> vs. null and undefined
  • Result vs. thrown errors and rejected Promises
  • Sized integers vs. number and bigint
  • UTF-8 vs. UTF-16 strings
  • Immutable bindings vs. const
  • Iterators vs. generators
  • Enums vs. discriminated unions
  • Traits vs. interfaces and duck typing
  • Monomorphized vs. erased generics
  • Multi-threaded futures vs. the event loop

Scalar Types, Control Flow, and Functions

  • Integers, floats, booleans, and characters
  • Constants, statics, and const fn
  • if/else as expressions
  • loop, while, and for
  • let chains in if and while
  • Closures and capture modes

Modules and Built-In Macros

  • mod and use
  • Importing from crates.io
  • Visibility and re-exports
  • Common built-in macros

Memory Management and Ownership

  • Ownership, moves, and copies
  • Borrowing with &T and &mut T
  • Lifetimes and the borrow checker
  • Box, Rc, and Arc
  • JS closure capture vs. move
  • Callbacks that outlive their data
  • Cloning to silence the borrow checker

Strings, Tuples, Enums, Structs, Collections

  • String vs. &str
  • Tuples and tuple structs
  • Enums with data
  • Option<T> and Result<T, E>
  • Compiler-owned tags vs. hand-written tags
  • Structs, methods, and constructors
  • Collections vs. arrays, Map, and Set
  • Lazy iterators vs. eager array methods
  • serde vs. JSON.parse and Zod

Pattern Matching

  • match vs. TypeScript narrowing
  • Exhaustiveness vs. never checks
  • if let, while let, and let chains
  • Destructuring nested data
  • Guards, bindings, and @ patterns

Traits and Generics

  • Defining and implementing traits
  • Default methods and dyn Trait
  • Bounds and where clauses
  • Static vs. dynamic dispatch
  • Async fn in traits

Async/Await with Tokio

  • Async/await from a Promise perspective
  • Lazy futures vs. eager Promises
  • Multi-threaded scheduling and Send bounds
  • Async closures
  • tokio::select! vs. Promise.race
  • JoinSet vs. Promise.all
  • Cancellation vs. AbortController
  • HTTP with reqwest and serde

Concurrent Programming

  • Threads, async tasks, and Node.js workers
  • Send, Sync, and data races
  • Arc, Mutex, RwLock, and channels
  • Data parallelism with rayon

Rust in the JavaScript Ecosystem

  • Rust-based JavaScript build tools
  • SWC, Rspack, Rolldown, Oxc, and Biome
  • Native Node.js addons with napi-rs
  • WebAssembly modules with wasm-bindgen
  • Sharing types with TypeScript
  • Addon vs. WebAssembly vs. service

Database Programming with sqlx

  • Connecting to PostgreSQL
  • Compile-time-checked queries
  • Inserts, updates, and transactions
  • Database error handling

Web APIs with Actix-web

  • Actix-web vs. Express, Fastify, and NestJS
  • Projects, routes, and handlers
  • Extractors, JSON, and forms
  • Logging and session middleware
  • Error handling
  • Connecting to the database

Client-Side Rust with Leptos

  • WebAssembly today
  • Fine-grained reactivity vs. virtual DOM
  • Similarities with SolidJS signals
  • Components, signals, and effects
  • Server functions
  • The islands router
  • CSR, SSR, and hydration
  • Calling the Actix-web API

AI-Assisted Rust Development for JS/TS Engineers

  • AI tools for Rust work
  • Prompts for ownership and trait design
  • Catching AI mistakes with the compiler
  • Reviewing AI-generated unsafe and unwrap
  • Reflexive Arc<Mutex<T>> in AI code
  • AI-assisted refactors and code review

Private team training

Bring this course to your team

Tell us about your team and we will tailor this outline to your tools, stack, and schedule. Courses can also be combined into a longer program.

  1. Tell us what you needYour tools, stack, team size, and timeline.
  2. We send a proposalA course or program, an outline adjusted to your team, and possible dates.
  3. Your team trains liveOnline or on-site, with courseware for every student.

Prefer to talk? Call +1 434-509-6890 or email help@cloudcontraptions.com.

We reply within 1 business day.

Training partner?