Skip to content

hughdbrown/bootdev-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bootdev-rs

Build and Test License: MIT Rust

An unofficial Rust port of the Boot.dev CLI, providing interactive command-line learning experiences for Boot.dev courses.

Table of Contents

Purpose

This project is a complete rewrite of the Boot.dev CLI in Rust, maintaining feature parity with the original Go implementation while leveraging Rust's performance and safety guarantees. It allows users to:

  • Run and test Boot.dev lessons locally
  • Execute CLI commands and HTTP requests as part of interactive learning
  • Submit lesson results to the Boot.dev platform
  • Validate lesson completion with real-time feedback
  • Configure custom settings for enhanced learning experience

Note: This is an unauthorized port created as a learning exercise and is not officially affiliated with or endorsed by Boot.dev. For the official CLI, please visit the original repository.

Installation

Prerequisites

  • Rust 1.70 or later (install from rustup.rs)
  • Supported platforms: Linux, macOS, or Windows via WSL

Install from source

git clone https://github.com/hughdbrown/bootdev-rs
cd bootdev-rs
cargo install --path .

Install from crates.io (once published)

cargo install bootdev-rs

Usage

The CLI provides several commands for interacting with Boot.dev lessons:

Authentication

# Login to Boot.dev
bootdev-rs login

# Logout and clear stored credentials
bootdev-rs logout

Running Lessons

# Test a lesson without submitting results
bootdev-rs run <LESSON_UUID>

# Run and submit a lesson
bootdev-rs submit <LESSON_UUID>

# Alternative: use the -s flag with run
bootdev-rs run -s <LESSON_UUID>

Configuration

# Override the base URL for HTTP tests (useful for local development)
bootdev-rs config base_url <URL>

# Customize terminal colors
bootdev-rs config colors --red #FF0000 --green #00FF00 --gray #808080

# Reset configuration
bootdev-rs config reset

Version Management

# Check current version
bootdev-rs --version

# Check for updates
bootdev-rs upgrade

Configuration File

The CLI reads configuration from ~/.bootdev.yaml or ~/.config/bootdev/config.yaml, maintaining compatibility with the Go version's config format.

Configuration options:

  • access_token / refresh_token: Authentication JWT tokens
  • override_base_url: Override lesson default base URL for HTTP tests
  • color.green, color.red, color.gray: Customizable terminal colors
  • api_url: Boot.dev API endpoint (default: https://api.boot.dev)
  • frontend_url: Boot.dev frontend URL (default: https://boot.dev)

Development

Building

Build the project in development mode:

cargo build

Build optimized release binary:

cargo build --release

The release build is configured for minimal binary size with aggressive optimizations enabled in Cargo.toml.

Testing

Run the test suite:

cargo test

Run tests with output:

cargo test -- --nocapture

Running in Development

# Run directly with cargo
cargo run -- <command> <args>

# Example: test login flow
cargo run -- login

# Example: run a lesson
cargo run -- run <UUID>

Code Quality

# Run linter
cargo clippy

# Format code
cargo fmt

# Check formatting without modifying files
cargo fmt -- --check

Deployment

For local installation from source:

cargo install --path .

For publishing to crates.io:

# Ensure version is updated in Cargo.toml
cargo publish

Architecture

The project follows a modular architecture inspired by the original Go implementation:

  • src/main.rs: Entry point and CLI initialization
  • src/cmd/: Command handlers (login, logout, run, submit, config, upgrade)
  • src/client/: API client and authentication logic
  • src/checks/: Lesson execution engine (CLI commands and HTTP requests)
  • src/render/: Terminal UI rendering with Ratatui
  • src/config/: Configuration file management
  • src/models/: Data structures and API models
  • src/version/: Version checking and update logic
  • src/messages/: UI message types for TUI updates

Key Technologies

  • clap: Command-line argument parsing (replaces Cobra)
  • tokio: Async runtime for concurrent operations
  • reqwest: HTTP client with async support
  • serde: JSON serialization and deserialization
  • ratatui: Terminal UI framework (replaces Bubble Tea)
  • crossterm: Cross-platform terminal manipulation
  • semver: Semantic version comparison

Differences from Go Version

While maintaining feature parity, there are a few notable differences:

  • Binary name: bootdev-rs instead of bootdev
  • Version checking: Uses crates.io or GitHub releases instead of Go proxy
  • Installation method: cargo install instead of go install
  • Async architecture: Tokio-based async runtime for better performance
  • Binary size: Smaller optimized binaries with LTO and stripping enabled

Migration from Go Version

The Rust version is designed to be compatible with existing configurations. Both versions can coexist and share the same config file at ~/.bootdev.yaml.

Inspiration

This project is inspired by and aims to replicate the functionality of the official Boot.dev CLI written in Go. All credit for the original design and implementation goes to the Boot.dev team.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

Before contributing:

  1. Ensure code passes cargo clippy without warnings
  2. Run cargo fmt to format code
  3. Add tests for new functionality
  4. Update documentation as needed

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

This is an unofficial, unauthorized port of the Boot.dev CLI created for educational purposes. It is not affiliated with, endorsed by, or supported by Boot.dev. For the official CLI and Boot.dev platform, please visit boot.dev.

About

No description, website, or topics provided.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages