The Andromeda repository ships with
an extensive examples/ directory covering every API surface. The examples on
this site walk through a few of them in detail; the full set includes:
- CLI / process —
args.ts,env.ts,sleep.ts,command.ts - File system and encoding —
fs.ts,btoa.ts,atob.ts,blob.ts - Networking —
fetch.ts,headers.ts,request.ts,response.ts,tls.ts - HTTP server — everything under
examples/serve/ - Canvas —
canvas.ts,canvas_advanced.ts,canvas_gradient.ts,canvas_global_alpha.ts,breakout.ts - Crypto —
crypto.ts - Storage —
storage.ts,sqlite.ts,cache_storage.ts - Streams —
streams.ts - URL / Web APIs —
url.ts,console.ts,performance.ts,navigator.ts,event/,queue_microtask.ts - Cron —
cron.ts - Modules —
import-map.ts,modules/,jsr.ts,std.ts - Window (optional) —
window.ts,games/ - Linting —
lint_empty_function.ts,lint_empty_statement.ts,lint_var_usage.ts - FizzBuzz — the obligatory
fizzbuzz.ts
Featured Examples
Data and Storage
- SQLite Examples —
DatabaseSync, prepared statements, transactions, sessions - Web Storage Examples —
localStorageandsessionStorage - Performance Monitoring —
performance.now, marks, measures
Basics
- FizzBuzz Example — control flow and
console.log
Running Examples
Every example is a single .ts file. Run it with:
andromeda run example.ts
# Verbose, for debugging
andromeda run --verbose example.tsExamples that produce files (e.g., the canvas examples) write to the current working directory.
See Also
Found an issue with this page?Edit on GitHub
Last updated: