System Design Trainer

System Design Trainer is a free, open-source Visual Studio Code extension for
learning object-oriented low-level design (LLD) by writing real Java code. It
turns all 22 classic Gang-of-Four design patterns — Creational, Structural, and
Behavioural — into short, self-contained coding exercises with instant feedback:
implement the TODOs, run the tests, and the next pattern unlocks. Built for
students, self-taught developers, and anyone preparing for a system design or
low-level design (LLD) interview who wants to practice design patterns instead
of just reading about them, right inside the editor they already use.
Tech stack
| Layer |
What it uses |
Why |
| Extension host |
TypeScript, VS Code Extension API (^1.96) |
Type-safe, first-party integration with commands, the activity bar, and webviews |
| Bundler |
esbuild |
Single-file, fast production bundle for dist/extension.js |
| Exercise language |
Java (JDK 11+) |
Real javac/java compile-and-run per exercise — no simulation |
| UI |
VS Code Webview API, markdown-it |
Themed lesson panel that renders each pattern's brief and live test results |
| Progress |
VS Code globalState API |
Per-user completion state, synced via Settings Sync |
| Linting |
ESLint + typescript-eslint |
Consistent, type-aware static analysis of the extension source |
| Packaging |
@vscode/vsce |
Builds the installable .vsix |
| CI / content checks |
Custom Node.js scripts (scripts/*.js) |
Compiles and runs every pattern's solution against a real JDK before release |
Requirements
A JDK (11+) on your machine, with javac and java available — either on
your PATH, or pointed to via the systemDesignTrainer.javaHome setting.
How it works
- Open the System Design Trainer view from the activity bar.
- Pick an unlocked pattern. A panel opens with the brief, the requirements, and a
button to create your exercise file.
- Implement the
TODOs in the exercise file.
- Hit Run tests. Results appear inline, assertion by assertion.
- All green → the pattern is marked complete and the next one unlocks.
Tests run by compiling your exercise with javac alongside the pattern's spec and
a small shared assertion harness, then running it with java in a scratch
directory — no terminal, no build file to write, no network.
The path
22 patterns, ordered so each builds on the last.
| Category |
Patterns |
| Creational |
Singleton · Factory Method · Abstract Factory · Builder · Prototype |
| Structural |
Adapter · Bridge · Composite · Decorator · Facade · Flyweight · Proxy |
| Behavioural |
Strategy · Observer · Command · Template Method · Iterator · State · Mediator · Memento · Chain of Responsibility · Visitor |
Each exercise ships with:
instruction.md — the scenario, the requirements table, one hint.
Starter.java — types and scaffolding with the pattern's core left as
TODO (each throws UnsupportedOperationException until implemented).
Solution.java — one idiomatic reference solution (revealable after you
finish, or on demand with a confirm).
Verify.java — the assertion spec that gates completion. It references
your classes directly — no imports needed, since everything compiles together.
Commands
| Command |
What it does |
System Design Trainer: Open Patterns |
Focus the activity-bar view |
System Design Trainer: Run Tests |
Run the current exercise's tests |
System Design Trainer: Open Exercise File |
Create / open your working copy |
System Design Trainer: Reveal Reference Solution |
Show Solution.java |
System Design Trainer: Reset This Exercise |
Restore the starter code |
System Design Trainer: Reset All Progress |
Clear completion state (keeps your files) |
Settings
| Setting |
Default |
Description |
systemDesignTrainer.unlockAll |
false |
Unlock every pattern for free browsing / review |
systemDesignTrainer.exerciseLocation |
workspace |
workspace writes exercises to system-design-trainer/ in your first workspace folder; globalStorage keeps them in the extension's private storage |
systemDesignTrainer.javaHome |
(empty) |
Path to a JDK install directory (the folder containing bin/javac). Leave empty to use javac/java from your PATH |
Progress & storage
Completion is stored in VS Code's globalState, so it follows you across
workspaces and Settings Sync. Your exercise files live wherever
exerciseLocation points and are never deleted by the extension.
The assertion API
Verify.java gets (mod, t) — actually, since Java has no dynamic module object,
it just references your classes by name directly, plus a TestApi t:
class Verify {
static void run(TestApi t) throws Exception {
t.test("does the thing", () -> {
t.equal(new Calculator().add(2, 3), 5);
});
}
}
t provides test(name, action), equal/notEqual (value equality via
Objects.equals — correct for String, boxed numbers, and List/Map),
same/notSame (reference identity, for "is this literally the same object"),
ok, assertThrows, and instanceOf.
Contributing a pattern
A pattern is a folder under patterns/<id>/:
patterns/observer/
metadata.json # id, name, category, difficulty, order, summary, prerequisites, estimatedMinutes
instruction.md # the brief shown in the panel
Starter.java # what the learner edits
Solution.java # reference implementation
Verify.java # class Verify { static void run(TestApi t) throws Exception { t.test(...); } }
Top-level classes must not be public (the learner's file is compiled under a
name we control, not the file's own name) — members can still be public.
Validate everything — metadata shape, that each Solution.java compiles and
passes its spec, and that each Starter.java does not:
npm run validate-patterns
Development
npm install
npm run build # bundle to dist/ with esbuild
npm run watch # rebuild on change
npm run check-types # tsc --noEmit
npm run lint
npm test # validate-patterns
npm run package # produce a .vsix
Open this folder in VS Code and press F5 to launch an Extension Development
Host with the extension loaded. Full run / debug / reload instructions are in
DEVELOPMENT.md.
License
MIT — see LICENSE.