🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

practicode

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

practicode

Local-first coding-test practice in a Rust terminal UI with optional AI help.

latest
Source
npmnpm
Version
0.1.20
Version published
Weekly downloads
4.3K
Maintainers
1
Weekly downloads
 
Created
Source

practicode

Rust Ratatui Local first AI ready crates.io npm CI Socket.dev package health

Personal coding practice, right in your terminal.

practicode is a small Rust TUI for syntax exercises and stdin/stdout coding-test practice. It keeps your problems, settings, and submissions local by default.

Practicode home screen with Learn syntax and Practice coding tests choices First run opens a small home screen for choosing learning or practice. Practicode terminal UI with problem text, code editor, status line, and command palette Practice mode keeps the problem, editor, judge output, and command palette in one terminal.

What You Get

  • Syntax learning and coding-test practice from one entry screen.
  • Local judging for Python, TypeScript, Java, and Rust.
  • A scrollable Ratatui UI with lesson/problem text, editor, run output, result status, and command palette.
  • Optional Codex or Claude Code help for hints and generated problems.

Install

npm

npm install -g practicode
practicode

The npm package ships no install lifecycle script. The launcher runs the locked Cargo build on first use if the binary is missing.

User data is stored under ~/.practicode by default, regardless of the directory where you run the command.

Cargo
cargo install practicode
practicode
Local checkout
git clone https://github.com/baba9811/practicode.git
cd practicode
npm install
npm start

Language runtimes

Install only the languages you plan to practice. Python uses python3 or python; TypeScript uses node --experimental-strip-types; Java uses javac and java; Rust uses rustc.

macOS
brew install python node
brew install --cask temurin@21
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Windows
winget install -e --id Python.Python.3.12
winget install -e --id OpenJS.NodeJS.LTS
winget install -e --id EclipseAdoptium.Temurin.21.JDK
winget install -e --id Rustlang.Rustup

Restart the terminal after installing so python, node, javac, and rustc are on PATH.

Ubuntu / Debian
sudo apt update
sudo apt install -y python3 nodejs npm openjdk-21-jdk curl build-essential
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

If node --version is below v22.6.0, install a newer Node.js from the official Node.js downloads or your preferred version manager before using TypeScript practice.

Verify runtimes:

python3 --version
node --version
javac -version
rustc --version

References: Python, Node.js, Rust, Eclipse Temurin.

After starting practicode, run /doctor to check these runtimes from inside the TUI.

Check the install:

practicode --version
practicode --smoke
practicode --help

Docker sandbox

If you do not want submissions to run directly on your host, use the npm launcher sandbox:

practicode --docker

The launcher builds a local practicode-sandbox:<version> image, then runs the TUI in Docker. The current directory is mounted at /workspace for legacy-data migration, while the host data directory is mounted at /data so progress survives container removal. The container runs without network access, with a read-only root filesystem, a writable /tmp, dropped Linux capabilities, no-new-privileges, and CPU/memory/process limits.

Install Docker first if needed:

# macOS
brew install --cask docker

# Windows
winget install -e --id Docker.DockerDesktop

# Ubuntu / Debian
# Use Docker's official apt repository:
# Ubuntu: https://docs.docker.com/engine/install/ubuntu/
# Debian: https://docs.docker.com/engine/install/debian/

After starting Docker, check the sandbox:

practicode --docker --smoke

Update

npm is the primary install path:

npm update -g practicode

The app checks npm for newer releases in the background and shows /update in the status line when one is available. Disable that check with PRACTICODE_NO_UPDATE_CHECK=1.

Cargo update
cargo install --force practicode
Local checkout update
git pull --ff-only
npm install
npm start

First Run

On first run, choose a mode:

Learn syntax: study the concept, worked example, mistakes, and self-check; use /ask when stuck; edit the exercise, /run, then /next
Practice coding tests: write code, Esc, /run, then /next when it passes

Use arrow keys to move on the home screen, and Enter or Space to open the selected mode.

Commands

Type / outside the editor to open the command palette. Use up/down to move, Enter to run or complete the selected command, and Esc to cancel.

Most-used commands:

CommandAction
/homeReturn to the mode chooser
/runJudge the current submission or syntax exercise
/ask <question>Ask AI about the current lesson or problem without leaving the TUI
/nextOpen the next problem or lesson
/backGo to the previous problem or lesson
/doctorCheck local runtimes and show install hints
/profileEdit language, theme, difficulty, topics, and AI settings

See docs/COMMANDS.md for the full command list, aliases, AI generation commands, and profile settings.

Local Data

Generated problems, settings, and submissions live in one user-data directory:

PathPurpose
~/.practicode/problem_bank.jsonLocal/custom/generated problems
~/.practicode/problem_notes.mdOptional personal problem-generation notes
~/.practicode/problem-state.jsonCurrent problem, history, and settings
~/.practicode/problems/Generated problem markdown/index files
~/.practicode/submissions/Your answer files

On Windows, ~ means %USERPROFILE%. Set PRACTICODE_HOME to use another directory:

PRACTICODE_HOME=/path/to/practicode-data practicode

When upgrading from 0.1.19 or earlier, launch practicode once from the old practice directory while the new data directory is empty. State, problems, and submissions are copied into the new location; the originals are not changed, and disposable build output is not copied. If the old practice directory was your home directory itself, choose a new empty PRACTICODE_HOME and keep that override configured afterward; automatic sibling-folder copying is disabled when the old metadata path already equals the default global path.

Safety

  • /run executes your local submission as a normal process. It is not an OS sandbox.
  • practicode --docker runs the TUI and judge in a restricted Docker container, but Docker is still a shared-kernel container runtime, not a guarantee against every escape.
  • /run scrubs inherited environment variables and hides case input/expected output in failure logs.
  • /hint, AI-backed /next, and /generate send the current problem/submission context to the selected provider CLI.
  • settings.ai_next_command can run a custom shell command. Save only commands you trust.
  • Do not publish tokens, private prompts, .env, .npmrc, or the contents of your practicode data directory.

Security reporting details live in SECURITY.md.

Contributing

Local checks:

cargo fmt --check
cargo test
cargo clippy --all-targets --all-features -- -D warnings
cargo run -- --smoke

License

practicode is MIT licensed. Third-party dependency license notes are in THIRD_PARTY_LICENSES.md.

Keywords

algorithms

FAQs

Package last updated on 10 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts