Quickstart
Running and Building
Any ChadScript program can be run directly or compiled to a standalone binary:
bash
chad run app.ts # compile and run in one step
chad build app.ts # compile to .build/app
chad build app.ts -o myapp # compile to a custom pathchad run compiles and executes immediately. chad build produces a native binary — by default in .build/ mirroring the source path. Use -o to specify an output location.
Hello World
typescript
console.log("Hello from ChadScript!");bash
chad run hello.tsMore Examples
The examples/ directory contains runnable programs covering common use cases. Clone the repo and run any of them with chad run:
CLI Tools — Unix tool replacements in examples/cli-tools/:
| Tool | Description |
|---|---|
cgrep | grep-like search with colorized output |
cwc | Line/word/char counter (like wc) |
ccat | File viewer with syntax highlighting (like bat) |
ctree | Directory tree printer (like tree) |
chex | Hex dump viewer (like xxd) |
cjq | JSON query tool (like jq) |
cql | SQL queries on CSV files (powered by SQLite) |
chttp | HTTP client (like curl) |
cserve | Static file server |
Apps — full applications in examples/apps/:
| App | Description |
|---|---|
hackernews | Full Hacker News clone — SQLite + embedded assets + JSON API |
weather | Weather app — live at chadsmith.dev/weather |
http-server | HTTP server with Express-like routing |
websocket | WebSocket chat with embedded HTML/CSS |
Snippets — small feature demos in examples/snippets/:
| Snippet | Description |
|---|---|
hello.ts | Hello World — native execution, no runtime |
parallel.ts | Parallel HTTP fetches with async/await + Promise.all |
sqlite-demo.ts | SQLite database operations |
timers.ts | setTimeout/setInterval with the libuv event loop |
bash
git clone https://github.com/cs01/ChadScript && cd ChadScript
chad run examples/snippets/hello.ts
chad run examples/snippets/parallel.ts
chad run examples/snippets/sqlite-demo.ts
chad run examples/apps/http-server/app.ts # http://localhost:3000
chad run examples/apps/hackernews/app.ts # http://localhost:3000Next Steps
- Browse the Standard Library for all available APIs
- See CLI Reference for all compiler options
- Check Supported Features to understand the TypeScript subset