Skip to content

Examples

Hello World

typescript
console.log("Hello from ChadScript!");
bash
chad run hello.ts
# or compile to a standalone binary:
chad build hello.ts -o hello && ./hello

More Examples

The examples/ directory contains runnable programs covering common use cases. Clone the repo and run any of them with chad run:

ExampleDescription
hello.tsHello World — native execution, no runtime
word-count.tsFile line/word/char counter (like wc)
parallel.tsParallel HTTP fetches with async/await + Promise.all
query.tsSQLite database operations
http-server.tsHTTP server with Express-like routing
string-search.tsgrep-like search with colorized output
timers.tssetTimeout/setInterval with the libuv event loop
cli-parser-demo.tsCLI argument parsing
websocket/app.tsWebSocket chat with embedded HTML/CSS
hackernews/app.tsFull Hacker News clone — SQLite + embedded assets + JSON API
bash
git clone https://github.com/cs01/ChadScript && cd ChadScript

chad run examples/hello.ts
chad run examples/word-count.ts -- README.md
chad run examples/parallel.ts
chad run examples/query.ts
chad run examples/http-server.ts          # http://localhost:3000
chad run examples/websocket/app.ts        # http://localhost:8080
chad run examples/hackernews/app.ts       # http://localhost:3000

Next Steps