Architecture

Architecture Overview

How the TLD platform is built — from CLI to API to Docker to validator.

System diagram

TLD CLI Go binary REST FastAPI Backend Python · REST API Lab Worker Orchestrates containers Docker Engine Runs lab containers PostgreSQL Users · Progress · Labs Next.js Frontend Web dashboard

Components

ComponentLanguageRole
CLI (agent)GoUser-facing tool — runs commands, manages labs, calls API
BackendPython / FastAPIREST API — auth, progress, lab metadata, scoring
FrontendNext.js / ReactWeb dashboard — progress tracking, lab browser, profile
DatabasePostgreSQLPersistent storage — users, XP, lab completion history
Lab EngineDocker + BashSpins up lab containers, runs validators
Landing PageNext.jsMarketing site — you're looking at the docs app inside this

Data flow

When you run tld lab start docker-fundamentals:

  1. 1
    CLI authenticates

    The CLI reads your local token and sends a request to the API with the lab ID.

  2. 2
    API validates

    The backend verifies the token, records that the lab was started, and returns lab metadata.

  3. 3
    CLI pulls the lab

    The CLI git-pulls or downloads the lab content to ~/.tld/labs/.

  4. 4
    Lab engine starts containers

    Docker Compose (or plain docker run) spins up the broken environment.

  5. 5
    You work

    The lab environment is running. You investigate and fix.

  6. 6
    Validator runs

    tld check executes validator.sh inside the lab environment and streams results to your terminal.

  7. 7
    Results reported

    On pass, the CLI reports completion to the API. XP is awarded.

Technology choices

ChoiceWhy
Go for the CLISingle static binary, fast startup, no runtime dependencies, great cross-platform support
Python / FastAPI for the APIRapid development, excellent async support, strong typing with Pydantic
Next.js for the frontendReact server components, file-based routing, great DX
PostgreSQLReliable, battle-tested, excellent with complex queries for progress tracking
Docker for labsReproducible, isolated, runs anywhere, standard tooling
Bash for validatorsZero dependencies, universally available, testable with standard tools