Skip to content

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 path

chad 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.ts

More 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/:

ToolDescription
cgrepgrep-like search with colorized output
cwcLine/word/char counter (like wc)
ccatFile viewer with syntax highlighting (like bat)
ctreeDirectory tree printer (like tree)
chexHex dump viewer (like xxd)
cjqJSON query tool (like jq)
cqlSQL queries on CSV files (powered by SQLite)
chttpHTTP client (like curl)
cserveStatic file server

Apps — full applications in examples/apps/:

AppDescription
hackernewsFull Hacker News clone — SQLite + embedded assets + JSON API
weatherWeather app — live at chadsmith.dev/weather
http-serverHTTP server with Express-like routing
websocketWebSocket chat with embedded HTML/CSS

Snippets — small feature demos in examples/snippets/:

SnippetDescription
hello.tsHello World — native execution, no runtime
parallel.tsParallel HTTP fetches with async/await + Promise.all
sqlite-demo.tsSQLite database operations
timers.tssetTimeout/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:3000

Next Steps