veko
ORO Homoiconic Language • Custom VM • Wasm 3.0 (vvm) • Native x86_64 & arm64

Runnable Examples & Showcase Applications

Every example in examples/ (42 runnable programs) and every multi-module showcase application in demos/ (6 complete applications, including the 29-widget demos/widget_gallery desktop UI suite) executes across Veko's three execution tracks: the 64-bit VKO bytecode VM (veko run), WebAssembly 3.0 sandbox (veko run --wasm), and standalone native executables (veko run --native or veko compile --native [--target=<win-x64|win-arm64|linux-x64|linux-arm64|macos-arm64>]).

SELF-HOSTING CONVERGENCE

Veko 1.0 Self-Hosted Toolchain & Triple-Target S1 == S2 Fixed Point

How the 39-module pure-Veko compiler compiles itself to bit-identical native binaries across architectures.

Interactive SVG • Click any node (4 components)
UNIFIED PURE-VEKO SOURCE src/ (39) + lib/ (79) DETERMINISTIC BOOTSTRAP CHAIN Reproducible S1 == S2 Proof Compile S1 Same source S1 builds S2 SHA-256 Bit-equal! Source Tree Self-Hosted Source 39 src/*.vk + 79 lib/*.vk Stage 1 Stage 1 Compiler (S1) veko compile --native src/main.vk Stage 2 Stage 2 Compiler (S2) S1 compiles src/main.vk -> S2 Release Gate Bit-Identical Fixed Point SHA-256(S1) == SHA-256(S2)
Components:
Source Tree
Self-Hosted Source
src/main.vk
Component 1 of 4
Architectural Role & Purpose

100% of lexer, parser, typechecker, VKO VM, Wasm emitter, x64/arm64 emitters, fmt, lsp, and docgen.

Contextual Description & System Interaction

Every tool in Veko is written in idiomatic Veko itself.

Core Functionality & Mechanics
  • Zero C, C++, Rust, or V compiler runtime dependencies
  • Deterministic map iteration and canonical binary headers
  • Single entry point src/main.vk drives every CLI subcommand
Stage 1
Stage 1 Compiler (S1)
native_emit.vk arm64_emit.vk
Component 2 of 4
Architectural Role & Purpose

Promoted host compiler compiles src/main.vk into a fresh Stage 1 native executable.

Contextual Description & System Interaction

Produces a clean candidate compiler binary for each target.

Core Functionality & Mechanics
  • Emits win-x64, linux-x64, linux-arm64, and macos-arm64 binaries
  • Embeds 79-group DCE and deterministic symbol layout
  • Zero timestamps or host path entropy in output sections
Stage 2
Stage 2 Compiler (S2)
pe_emit.vk elf_emit.vk
Component 3 of 4
Architectural Role & Purpose

Stage 1 executes natively (or under QEMU for arm64) to compile src/main.vk a second time.

Contextual Description & System Interaction

Proves the generated compiler faithfully reproduces its own machine code.

Core Functionality & Mechanics
  • Exercises the newly generated machine code on all 39 modules
  • Stress-tests ORO slab recycling across 100,000+ AST nodes
  • Emits Stage 2 binary without external host assistance
Release Gate
Bit-Identical Fixed Point
build.vk tests/run_tests.vk
Component 4 of 4
Architectural Role & Purpose

Byte-for-byte SHA-256 equality across Win64 PE32+, Linux x86_64 ELF64, and Linux AArch64 ELF64.

Contextual Description & System Interaction

Establishes mathematical reproducibility for Veko v1.0.0 releases.

Core Functionality & Mechanics
  • Plus verified 14/14 test suites across VM, Wasm, and Native
  • Zero leaked slabs verified via --wasm --check-slabs
  • Signed macOS arm64 Mach-O LC_CODE_SIGNATURE verified

1. Runnable Example Catalog (examples/)

Example File Focus Run Command
examples/01_basics_and_math.vk Rich literals (250ms, 4kb, .tcp), bitwise ops, ranges, loops veko run examples/01_basics_and_math.vk
examples/02_pipelines_and_json.vk use aliases, \ pipes, json/decode, filter/map/reduce, match veko run examples/02_pipelines_and_json.vk
examples/03_oro_buffers_and_errors.vk mut buffer loans, bytes/with-secret, defer, /or, recur veko run examples/03_oro_buffers_and_errors.vk
examples/04_macros_and_dialects.vk quote, compose/deep, parse-block, compile-time macro veko run examples/04_macros_and_dialects.vk
examples/05_closures_and_capabilities.vk Stateful ORO closures & explicit non-OOP capability records veko run examples/05_closures_and_capabilities.vk
examples/06_policy_firewall_compiler.vk Declarative parse-block policy compiler & stateful ORO rate-limiter veko run examples/06_policy_firewall_compiler.vk
examples/07_binary_frame_codec.vk Binary wire-protocol encoder/decoder, XOR checksum & ascii normalization veko run examples/07_binary_frame_codec.vk
examples/08_kv_store_and_audit_log.vk Single-owner ORO KV store, hash-chained recur audit log & secret zeroing veko run examples/08_kv_store_and_audit_log.vk
examples/09_concurrent_worker_pool.vk Shared-nothing spawn worker pool, chan/select, timeouts & isolation guards veko run --wasm examples/09_concurrent_worker_pool.vk
examples/10_loopback_tcp_echo_service.vk Loopback TCP server-client, mut buffers & .secret firewall veko run --wasm --allow-net --allow-listen --allow-private-net examples/10_loopback_tcp_echo_service.vk
examples/11_modular_service/src/main.vk Multi-file veko.vk manifest, pub/export, macro + spawn worker pipeline veko run --wasm examples/11_modular_service/src/main.vk
examples/12_typed_structs_and_secrets.vk Typed struct slots, struct/with, secret governance, veko check --strict-types veko run --wasm examples/12_typed_structs_and_secrets.vk
examples/13_pure_vk_tls13_and_codecs.vk Pure-.vk codec/der, codec/pem, codec/http1, X.509 & loopback RFC 8446 TLS 1.3 handshake veko run --native examples/13_pure_vk_tls13_and_codecs.vk
examples/14_http_json_api_server.vk Multi-worker concurrent HTTP/1.1 + JSON REST microservice (spawn store actor + worker pool) veko run --allow-net --allow-listen --allow-private-net examples/14_http_json_api_server.vk
examples/15_encrypted_vault_cli.vk Authenticated encrypted file vault (HKDF-SHA256, ChaCha20-Poly1305, Ed25519) veko run --wasm --fuel=0 examples/15_encrypted_vault_cli.vk
examples/16_query_dialect_engine.vk Homoiconic VQL telemetry query & stream dialect (quote, parse-block, macro) veko run examples/16_query_dialect_engine.vk
examples/17_stdlib_cli_fmt_and_collections.vk cli parser, fmt tables/units, testing, math, text, path, seq, coll, rand veko run examples/17_stdlib_cli_fmt_and_collections.vk
examples/18_io_streams_regex_and_codecs.vk buf, io SchemeMux, glob, Thompson NFA regex, dialect, codec/*, compress/deflate veko run examples/18_io_streams_regex_and_codecs.vk
examples/19_modern_crypto_and_sealed_vault.vk SHA3/SHAKE, BLAKE2b, Argon2id, AES-256-GCM, XChaCha20-Poly1305, crypto/seal, ECDSA P-256 veko run --native examples/19_modern_crypto_and_sealed_vault.vk
examples/20_post_quantum_nist_pqc.vk NIST FIPS 203 ML-KEM-768, FIPS 204 ML-DSA-65, and FIPS 205 SLH-DSA-SHAKE-128f veko run --native examples/20_post_quantum_nist_pqc.vk
examples/21_io_streams_dns_and_pqc_tls.vk UUID v7, io/fs, net/dns, and Hybrid Post-Quantum TLS 1.3 (X25519MLKEM768) + HTTP/2 veko run --native examples/21_io_streams_dns_and_pqc_tls.vk
examples/22_web_server_websocket_and_jwt.vk OAuth2 PKCE, HS256/EdDSA/ML-DSA-65 JWTs, web server, and RFC 6455 net/websocket veko run --native examples/22_web_server_websocket_and_jwt.vk
examples/23_zero_ffi_databases_kv_pg_redis.vk Embedded WAL db/kv, PostgreSQL v3 (SCRAM-SHA-256), Redis RESP3, and db/sidecar veko run --native examples/23_zero_ffi_databases_kv_pg_redis.vk
examples/24_signed_vkp_package_bundles.vk Dual-signed Ed25519 + ML-DSA-65 'VKP1' Merkle package bundle creation & verification veko run --native examples/24_signed_vkp_package_bundles.vk
examples/25_batteries_datetime_fs_archives_and_toml.vk datetime, utf8, fs, slog, archive/tar & zip, codec/toml, net/ip, semver, totp veko run examples/25_batteries_datetime_fs_archives_and_toml.vk
examples/26_pure_vk_html_components_and_http_client.vk Auto-escaped html components, template, web/page + gzip, and 3-track net/client veko run --native examples/26_pure_vk_html_components_and_http_client.vk
examples/27_tooling_fmt_lsp_and_v2vk.vk Self-hosted veko fmt, live veko lsp JSON-RPC 2.0 session, and veko v2vk migrator veko run examples/27_tooling_fmt_lsp_and_v2vk.vk
examples/28_simd_optimization_and_arm64_cross_compile.vk f64/sqrt, SIMD bytes/{eq,index-of,xor!,aes-enc-block}, and linux-arm64/macos-arm64 emit veko run --native examples/28_simd_optimization_and_arm64_cross_compile.vk
examples/29_async_reactor_http_server_and_client.vk OS readiness reactor (epoll/kqueue/IOCP), timers, web/serve-reactor, and get-many veko run --native examples/29_async_reactor_http_server_and_client.vk
examples/30_tui_and_native_ui_canvas.vk TrueColor diffing tui, zero-copy RGBA32 ui/canvas & ui/widgets, .ui window, BMP export veko run --native examples/30_tui_and_native_ui_canvas.vk
examples/31_opt_in_ffi_and_c_struct_packing.vk Opt-in .ffi native shared library calls (kernel32.dll / libc.so.6) & C-struct packing veko run --allow-ffi examples/31_opt_in_ffi_and_c_struct_packing.vk
examples/32_durable_objects_and_workflows.vk Transactional durable/object actors, alarms, inboxes, and replay-safe durable/workflow sagas veko run --native examples/32_durable_objects_and_workflows.vk
examples/33_ergonomic_refinements_templates_and_interfaces.vk User /refinements, universal /or [e -> ...], .secret templates, 2-var for, destructuring, and interface veko -A examples/33_ergonomic_refinements_templates_and_interfaces.vk
examples/34_png_charts_and_flex_widgets.vk Light-Mode ui/widgets (stat-card, bar-chart, line-chart, flex/grid) and lossless image/png roundtrip veko examples/34_png_charts_and_flex_widgets.vk
examples/35_sse_multipart_and_kv_queries.vk SSE streaming, multipart/form-data, HTTP 206 Range slices, indexed db/query, and conc/scope veko -A examples/35_sse_multipart_and_kv_queries.vk
examples/36_regex_zstd_otel_and_bindgen.vk Linear-time Thompson NFA text/re, RFC 8878 compress/zstd, and W3C/OTLP/Prometheus otel veko examples/36_regex_zstd_otel_and_bindgen.vk
examples/37_clipboard_x11_flamegraph_and_lock.vk .secret-firewalled clipboard & Hi-DPI, X11 wire-protocol framing, SVG flamegraphs, and veko.lock veko -A examples/37_clipboard_x11_flamegraph_and_lock.vk
examples/hello.vk, examples/tour.vk, examples/oro_closures.vk, examples/dialects.vk Bite-sized introductory tours of syntax, pipes, ORO closures, and block dialects veko run examples/hello.vk
benchmarks/bench_suite.vk Cross-subsystem benchmark suite (math, CRC-32, regex, gzip, SHA3, AES-GCM, ML-KEM) veko run --native benchmarks/bench_suite.vk

2. Basics, Bitwise Ring Buffers & Slicing (01_basics_and_math.vk)

VEKO
title   = 'Veko Basics'
timeout = 250ms
buf-cap = 4kb
proto   = .tcp

head = 12
offset = 7
cap = 16
next-slot = (head + offset) & (cap - 1)   // 3

nums = 1..=5
println (mold nums[1..4])                 // [2 3 4]

3. JSON Filtering, Reduction & match (02_pipelines_and_json.vk)

VEKO
use [j = json, s = strings]

payload = '[{"name": " alpha ", "score": 90, "active": true}, {"name": " beta ", "score": 40, "active": false}, {"name": " gamma ", "score": 85, "active": true}]'

names = payload
    \ j/decode
    \ filter fn [item] [item.active]
    \ map fn [item] [item.name.trim.upper]

println (s/join names ' | ')    // ALPHA | GAMMA

ev = { kind = .ready, code = 200 }
status-msg = match ev.kind [
    .starting ['booting']
    .ready    ['serving']
    _         ['unknown']
]

4. Zero-Alloc Buffers, Secrets, defer, /or & recur (03_oro_buffers_and_errors.vk)

VEKO
use [bytes, ascii, str]

pkt = bytes/with-cap 4kb
bytes/push-all mut pkt (bytes/from-str '  ping trustnode  ')
ascii/trim-right! mut pkt
ascii/upper! mut pkt
bytes/push mut pkt 33
println (str/from-bytes pkt)      //   PING TRUSTNODE!

safe-find = fn [hay needle] [
    defer [println 'cleanup-done']
    str/index-of/or hay needle [-1]
]

5. Homoiconic Dialects & Compile-Time Macros (04_macros_and_dialects.vk)

VEKO
mut endpoints = []
parsed-ok = parse-block (quote [allow .tcp '10.1.0.0/16' 443 allow .udp '10.2.0.0/16' 51820]) [
    any [
        ['allow' proto = enum! cidr = str! p = int!] [
            push mut endpoints (compose [(proto) (cidr) (p)])
        ]
    ]
]

triple = macro [x] [
    compose [(x) + (x) + (x)]
]
println (triple 14)   // 42

6. Capability Records Without OOP (05_closures_and_capabilities.vk)

VEKO
use [str]

make-logger = fn [prefix] [
    {
        info  = fn [msg] [println (str/append prefix msg)]
        warn  = fn [msg] [println (str/append '[WARN] ' msg)]
        flush = fn []    [println (str/append prefix 'flushed')]
    }
]

app-log = make-logger '[veko] '
log-info = app-log.info
(log-info 'initialized')
call app-log.flush

7. Zero-Trust Policy Firewall Compiler (06_policy_firewall_compiler.vk)

Combines homoiconic quote/parse-block rule extraction with a captured ORO map inside make-evaluator to rate-limit, require .mtls, and enforce default-deny verdicts across simulated traffic:

VEKO
policy-spec = quote [
	default .deny
	route .tcp '10.10.' 8443 .mtls 2
	route .udp '192.168.' 51820 .open 5
	route .tcp '0.0.0.' 80 .deny 0
]

ok = parse-block policy-spec [
	any [
		['default' act = enum!] [ default-action = act ]
		['route' p = enum! c = str! pt = int! a = enum! lim = int!] [
			push mut rules (make-rule p c pt a lim)
		]
	]
]

Expected output (veko run examples/06_policy_firewall_compiler.vk):

TEXT
compiled-rules=3
NO_MTLS 10.10.4.20 8443
ALLOW 10.10.4.20 8443
ALLOW 10.10.4.20 8443
LIMIT 10.10.4.20 8443
ALLOW 192.168.1.9 51820
BLOCK 0.0.0.5 80
DENY_DEFAULT 172.16.0.1 9999

8. Binary Wire Frame Codec & In-Place Normalization (07_binary_frame_codec.vk)

Demonstrates big-endian length framing (0x54 0x4e magic, version, opcode, XOR checksum), borrowing mut buffer parameters for zero-copy header/slice reads, in-place ascii/trim-right! + ascii/upper! normalization, and /or fallback on corrupt trailing bytes:

VEKO
decoded = decode-and-normalize/or mut pkt [{ error = 'decode-failed' }]
println (mold decoded)

mut bad-pkt = bytes/with-cap pkt.len
bytes/push-all mut bad-pkt pkt
bytes/push mut bad-pkt 0xff
bad-res = decode-and-normalize/or mut bad-pkt ['recovered-corrupt-frame']
println bad-res

Expected output (veko run examples/07_binary_frame_codec.vk):

TEXT
25
TN
{version = 1, op = 7, payload = '  PING TRUSTNODE'}
recovered-corrupt-frame

9. Single-Owner ORO KV Store & Hash-Chained Audit Log (08_kv_store_and_audit_log.vk)

Encapsulates data, audit, and tip-hash inside one single-owner ORO dispatcher closure (make-kv-store), derives a temporary secret seed inside bytes/with-secret 64b that wipes deterministically on scope return, verifies the hash chain in constant stack via recur, and checks json/encode / json/decode round-tripping:

VEKO
verify-chain = fn [entries idx prev-hash] [
	if idx >= entries.len [return true]
	entry = entries[idx]
	expected = hash (str/join [prev-hash entry.op entry.key] '|')
	if entry.sig != expected [return false]
	recur entries (idx + 1) expected
]

snap = (kv .snapshot .none .none)
encoded = j/encode snap
reloaded = j/decode encoded

Expected output (veko run examples/08_kv_store_and_audit_log.vk):

TEXT
127.0.0.1
8443
audit-valid=true
entries=3
roundtrip-keys=3

10. Shared-Nothing Concurrent Worker Pool (09_concurrent_worker_pool.vk)

Demonstrates structured shared-nothing concurrency across all three backends (vm_oro, backend_wasm, and native_emit.vk) with zero shared mutable heaps or GC pauses: fans jobs out to isolated spawn [ ... ] OS-thread workers over bounded FIFO channels (chan/new, chan/send, chan/recv), multiplexes priority lanes with chan/select, recovers deterministically from slow workers via task/await/timeout/or, and proves that .secret slabs, mut borrows, and closures cannot cross chan/send:

VEKO
w1 = spawn [
	mut processed = 0
	forever [
		item = chan/recv/or fast-q [break]
		chan/send out-q (transform-job item)
		processed = processed + 1
	]
	processed
]

picked = chan/select [lane-a lane-b]
sec-guard = chan/send/or out-q tok ['secret-blocked']

Expected output (veko run --wasm examples/09_concurrent_worker_pool.vk):

TEXT
queue-empty
total-score=116
workers-done=2
selected-lane=1:priority-alert
deadline-exceeded
completed-after-deadline
secret-blocked
mut-loan-blocked
closure-blocked

11. Loopback TCP Service Across Isolated Workers (10_loopback_tcp_echo_service.vk)

Runs a full client/server session over host OS sockets (--vm), wasi:sockets@0.3.0 + wasi:io/async@0.3.0 (--wasm), or WinSock2 / Linux POSIX sockets (--native). Binds an ephemeral local socket (net/listen-tcp .ip '127.0.0.1:0'), spawns a client worker dialing net/connect-tcp, blocks .secret buffer transmission via net/write/or, reads into a pre-allocated ORO mut buffer (net/read-into), normalizes bytes in place (ascii/trim-right!, ascii/upper!), and tears down cleanly:

VEKO
ln = net/listen-tcp .ip '127.0.0.1:0'
client-worker = spawn [
	cli = net/connect-tcp '127.0.0.1' port
	sec-verdict = net/write/or cli api-key 'secret-write-blocked'
	net/write-string cli '  hello veko socket  '
	reply = net/read-bytes cli 64
	net/close cli
	{ sec = sec-verdict, reply = (bytes/to-str reply) }
]

Expected output (veko run --wasm --allow-net --allow-listen --allow-private-net examples/10_loopback_tcp_echo_service.vk):

TEXT
server-rx-bytes=21
client-secret-guard=secret-write-blocked
client-rx=  HELLO VEKO SOCKET

12. Multi-File Modular Service (11_modular_service/)

Combines logical modules and least-privilege veko.vk capability manifests (allow-caps = [.clocks]) with concurrent worker threads: private helpers in lib/protocol stay encapsulated while pub format-telemetry and compile-time alert-threshold execute identically across vm_oro, veko inspect --modules, isolated Wasm worker sandboxes, and --native executables:

VEKO
use [proto = lib/protocol, str]

limit = proto/alert-threshold 80 15
w1 = spawn [
	pkt = proto/format-telemetry 'edge-west-01' 1 'cpu=42%'
	chan/send outbox pkt
	'ok-w1'
]

Expected output (veko run --wasm examples/11_modular_service/src/main.vk):

TEXT
threshold=95
over-limit=true
workers=ok-w1,ok-w2
packets=2
csum-sum=1199
clock-ok=true

13. Typed Structs, .secret Governance & Unboxed Loops (12_typed_structs_and_secrets.vk)

Demonstrates static verification and performance together cleanly under veko check --strict-types, --vm, --wasm, and --native: fixed-schema Upstream and RouteSummary structs with defaults and secret str fields, pure immutable updates via struct/with, os/getenv/secret and bytes/with-secret redaction/JSON-blocking, checked conversions (str/to-i64, as-u8), runtime entry type guards, and an unboxed typed i64 register loop:

VEKO
compute-weight = fn [ep Upstream, factor u8, samples i64] i64 [
	mut acc = 0
	mut i = 0
	while i < samples [
		acc = acc + (i & 7) + factor
		i = i + 1
	]
	acc + ep.port
]

standby = primary \ struct/with { name = 'edge-eu', host = 'eu.veko.local', port = parsed-port }
score = compute-weight standby ok-u8 5000

Expected output (veko check --strict-types examples/12_typed_structs_and_secrets.vk + veko run --wasm examples/12_typed_structs_and_secrets.vk):

TEXT
secret-buf-mold=<secret>
target=edge-eu:eu.veko.local:8443
bad-port=-1
clamped-u8=255
summary={"name":"edge-eu","host":"eu.veko.local","port":8443,"load":85943}

14. Pure-Veko DER/PEM/HTTP Codecs, X.509 & Loopback TLS 1.3 (13_pure_vk_tls13_and_codecs.vk)

Demonstrates Veko's 100% pure-.vk protocol and cryptographic stack (codec/der with parse-block AST nodes, codec/pem, codec/http1, crypto/sha256, crypto/x25519 Ed25519, crypto/x509 SPKI pinning, and net/tls13) executing an in-process loopback RFC 8446 TLS 1.3 + HTTP/1.1 exchange with zero OS crypto DLLs:

POWERSHELL
veko run --allow-net --allow-listen --allow-private-net examples/13_pure_vk_tls13_and_codecs.vk
veko run --wasm --fuel=0 --allow-net --allow-listen --allow-private-net examples/13_pure_vk_tls13_and_codecs.vk
veko compile --native examples/13_pure_vk_tls13_and_codecs.vk -o dist/13.exe ; ./dist/13.exe

15. Concurrent HTTP/1.1 + JSON REST Microservice (14_http_json_api_server.vk)

Demonstrates a multi-worker concurrent HTTP/1.1 + JSON REST microservice across all three backends using typed structs (TaskItem, ApiMetrics + struct/with), a channel-owned spawn store actor, a 2-worker spawn pool with reusable per-worker reply_ch, net/listen-tcp .ip '127.0.0.1:0', codec/http1, parse-block (http/request-to-block ...), json/decode/or + json/encode/or, time/now/time/since, and .secret JSON firewall enforcement:

VEKO
req_blk_ok = parse-block (http/request-to-block sample_req) [
    any [
        [.req m = str! t = str! _v = str! _h = map! _b = any!] [
            parsed_method = m
            parsed_target = t
        ]
    ]
]

Run across all three backends (veko check -> 2 module(s), 2 struct(s), 22 typed fn(s)):

POWERSHELL
veko check examples/14_http_json_api_server.vk
veko run --allow-net --allow-listen --allow-private-net examples/14_http_json_api_server.vk
veko compile --vko examples/14_http_json_api_server.vk -o dist/14.vko ; veko run --allow-net --allow-listen --allow-private-net dist/14.vko
veko run --wasm --allow-net --allow-listen --allow-private-net examples/14_http_json_api_server.vk
veko compile --native examples/14_http_json_api_server.vk -o dist/14.exe ; ./dist/14.exe

Expected output (identical 10 lines across --vm, .vko, --wasm, and --native):

TEXT
secret-firewall=secret-json-blocked
req-block-parsed=true:POST:/items
health=200:'ok'
created-ids=1,2|statuses=201,201
malformed-json=400:'invalid_json'
list-count=2
done-item1=200:done=true
missing-item=404:'not_found'
metrics=handled:8,created:2,workers:2
pool=accepted:8,served:8,actor:8,timing-ok=true

16. Authenticated Encrypted File Vault CLI (15_encrypted_vault_cli.vk)

Implements an authenticated encrypted file vault and Ed25519-signed multi-block PEM manifest CLI using HKDF-SHA256, ChaCha20-Poly1305 AEAD, HMAC-SHA256 + ct-eq, Ed25519, codec/pem + parse-block, bytes/with-secret, os/getenv/secret, and os/args. Invoking with zero arguments runs an in-process self-demo (including Ed25519 tamper, AEAD tamper, wrong-passphrase, and .secret firewall tests) and scrubs the temporary demo file; passing arguments invokes the init, set, get, list, verify, or --help CLI subcommands with --pass <pw>.

Run across all three backends (veko check -> 5 module(s), 2 struct(s), 84 typed fn(s)):

POWERSHELL
veko check examples/15_encrypted_vault_cli.vk
veko run examples/15_encrypted_vault_cli.vk
veko run --wasm --fuel=0 examples/15_encrypted_vault_cli.vk
veko compile --native examples/15_encrypted_vault_cli.vk -o dist/15.exe ; ./dist/15.exe

# Interactive CLI subcommands (pass --allow-fs on --wasm)
veko run examples/15_encrypted_vault_cli.vk -- init vault.pem --pass mypw
veko run --wasm --allow-fs --fuel=0 examples/15_encrypted_vault_cli.vk -- init vault.pem --pass mypw

Expected self-demo output:

TEXT
vault-secret-mold=<secret>|name=master
vault-secret-firewall=secret-json-blocked
vault-sealed=exists:true,entries:3,cipher:chacha20-poly1305
vault-ed25519-verify=true
vault-unseal=api:tok_prod_veko_991,db:postgres://vault.local/app,tls:sha256/veko-spki-pin
tamper-ed25519-rejected=true
tamper-aead-rejected=true
wrong-pass-rejected=true
demo-scrubbed=true

17. Homoiconic VQL Telemetry Query & Dialect Engine (16_query_dialect_engine.vk)

Combines homoiconic quote, parse-block AST compilation, compile-time macros (sla-budget, sla-floor), compose/deep, typed structs (TraceSpan, QueryPlan + struct/with), filter/map/reduce, match, tail-recursive recur, str/to-i64/or, as-u8/or, and an optional os/args[0] latency threshold override:

POWERSHELL
veko check examples/16_query_dialect_engine.vk
veko run examples/16_query_dialect_engine.vk
veko compile --vko examples/16_query_dialect_engine.vk -o dist/16.vko ; veko run dist/16.vko
veko run --wasm examples/16_query_dialect_engine.vk
veko compile --native examples/16_query_dialect_engine.vk -o dist/16.exe ; ./dist/16.exe
./dist/16.exe 200

Expected output:

TEXT
vql-parsed=true|name=edge-5xx-slow|clauses=3
vql-matched=3|limited=2|sum-bytes=7520
vql-rows=1:edge-gateway@eu-west:502:145ms,4:edge-gateway@eu-west:504:320ms
macro-plan={"name":"sla-watchdog","svc":"edge-gateway","min_ms":100,"status_min":500,"region":"eu-west","limit":5,"agg":"sum_bytes"}
sla-budget=240|breaches=2|max-ms=320|clamped-u8=255
report-ast=[vql 'edge-5xx-slow' [parsed true matched 3 returned 2 sum_bytes 7520] sla [plan 'sla-watchdog' budget_ms 240 breaches 2 max_ms 320]]

17b. Systems, Networking, Async Reactor, UI/FFI & Durable Workflow Examples (21..32)

Twelve end-to-end systems examples exercise Veko 1.0's connected networking, web/auth, zero-FFI databases, signed packages, developer tooling, hardware SIMD & ARM64 cross-compilation, readiness reactor, TUI/native UI, opt-in FFI, and durable workflows:

  • examples/21_io_streams_dns_and_pqc_tls.vk: Time-ordered UUID v7, positioned io/fs streams, net/dns resolution, and a live loopback Hybrid Post-Quantum TLS 1.3 (X25519MLKEM768) + ALPN 'h2' + net/http2 RPC.
  • examples/22_web_server_websocket_and_jwt.vk: OAuth 2.0 PKCE S256, HS256/EdDSA/ML-DSA-65 JWTs, web routes with security headers/SSE, and live RFC 6455 net/websocket upgrade + masked frames.
  • examples/23_zero_ffi_databases_kv_pg_redis.vk: Embedded WAL KV store (db/kv + AES-256-GCM put-sealed), loopback PostgreSQL v3 (SCRAM-SHA-256), pipelined Redis RESP3 (db/redis), and 'VKSC' db/sidecar frames.
  • examples/24_signed_vkp_package_bundles.vk: Packs and verifies a multi-module 'VKP1' archive dual-signed with Ed25519 + ML-DSA-65 (pkg/vkp).
  • examples/25_batteries_datetime_fs_archives_and_toml.vk: Exercises datetime, utf8, fs, slog, archive/tar (.tar.gz), archive/zip, codec/toml, net/ip, semver, auth/totp, diff, and retry.
  • examples/26_pure_vk_html_components_and_http_client.vk: Auto-escaped lib/html components, lib/template, web/page + gzip, and loopback requests via net/client.
  • examples/27_tooling_fmt_lsp_and_v2vk.vk: Exercises veko fmt, a live veko lsp JSON-RPC 2.0 session, and veko v2vk source migration.
  • examples/28_simd_optimization_and_arm64_cross_compile.vk: Exercises hardware f64/sqrt, SIMD bytes/{eq,index-of,xor,xor!,aes-enc-block}, and cross-compiles standalone linux-arm64 ELF64 and macos-arm64 Mach-O binaries.
  • examples/29_async_reactor_http_server_and_client.vk: Exercises lib/reactor.vk (epoll/kqueue/IOCP+WSAPoll), monotonic timers, cross-thread wakeups, web/serve-reactor, and concurrent net/client/request-batch.
  • examples/30_tui_and_native_ui_canvas.vk: Exercises double-buffered TrueColor lib/tui.vk, zero-copy RGBA32 lib/ui/canvas.vk + lib/ui/widgets.vk, .ui window presentation, and 24-bit BMP export.
  • examples/31_opt_in_ffi_and_c_struct_packing.vk: Demonstrates opt-in --allow-ffi dynamic shared library calls (kernel32.dll / libc.so.6) and deterministic little-endian C-struct packing (lib/ffi.vk).
  • examples/32_durable_objects_and_workflows.vk: Exercises crash-safe durable/object actor turns, alarms, and FIFO inboxes alongside replay-safe durable/workflow steps, retries, signals, and LIFO sagas over db/kv.
  • examples/38_zero_ffi_sqlite_and_orm.vk: Exercises genuine "SQLite format 3\0" 4096-byte slotted B-tree pages, CREATE UNIQUE INDEX, BEGIN/ROLLBACK, SQL aggregates, and the homoiconic ORM (db/sqlite) across --vm, --wasm --check-slabs, and --native.
  • examples/39_debugger_coverage_and_fuzzing.vk: Exercises testing/fuzz (fuzz-bytes, fuzz-block) with automatic delta-debugging counterexample shrinking alongside veko test --coverage and veko debug.
  • examples/40_sdk_https_registry_and_wayland.vk: Exercises veko-lang.org + decentralized HTTPS .vkp registry resolution (pkg/lock), VEKO_LIB .ffi search paths, and Linux Wayland (wl_shm + xdg_wm_base) wire framing (ui/wayland).

17c. Multi-Module Showcase Applications (demos/)

Beyond single-file examples, demos/ provides six complete multi-module applications demonstrating full-stack architecture across --vm, --wasm, and --native:

Application Modules What It Demonstrates
demos/widget_gallery/ model.vk, pages.vk, main.vk 29-widget Light-Mode desktop UI gallery (ui/widgets, ui/layout, ui/font, image/png, ui), clipboard selection (Ctrl+A/Ctrl+C/Ctrl+V), Per-Monitor V2 Hi-DPI badge, live desktop mode (-- --live), and lossless PNG export.
demos/taskflow_studio/ auth.vk, store.vk, ui_assets.vk, main.vk Role-separated Light/Dark web portal & admin console (/ui/auth, /ui/portal, /ui/admin), HS256 JWT + TOTP 2FA, durable/object customer wallets, durable/workflow order fulfillment + LIFO sagas, and live web/serve-reactor mode (-- --serve 8095).
demos/canvas_workbench/ state.vk, views.vk, main.vk 720x440 immediate-mode desktop GUI (ui/canvas, ui/widgets, ui) with 4 tabs (Topology, Sketch Pad, Durable db/kv Sprint Board, SHA-256 Frame Profiler), Light/Dark toggle, live 60 FPS -- --live / --gui window mode, and BMP export.
demos/pulse_mesh/ wire_frame.vk, mesh_broker.vk, tui_inspector.vk, main.vk Multi-protocol broker combining 'VKPM' binary frames (codec/wire + deflate + crc32 + Ed25519 tickets), TCP pub/sub, UDP gossip heartbeats, RFC 6455 WebSocket frames, HTTP upstream probes, homoiconic parse-block routes, and TrueColor tui inspector.
demos/vault_dialect/ policy.vk, vault_core.vk, main.vk Structured cli flags, homoiconic parse-block RBAC dialect, NIST ML-KEM-768 + ML-DSA-65, and AES-256-GCM db/kv/put-sealed scoped zeroization.
demos/netpulse_tui/ main.vk Compact health-probe monitor combining web/serve-async, net/client/get-many, tui, and a 320x160 RGBA32 ui/canvas telemetry card.

18. Three-Backend Parity & Self-Hosting Convergence (S1 == S2)

The unified 46-module pure-Veko single-binary SDK in src/ (embedding all 93 lib/ standard library modules via src/stdlib_vfs.bin) compiles itself across Windows x86_64 (dist/bin/veko.exe PE32+), Windows 11 ARM64 (--target=win-arm64 PE32+ 0xAA64), Linux x86_64 (dist/bin/veko static ELF64), Linux AArch64 (--target=linux-arm64 static ELF64), macOS Apple Silicon (--target=macos-arm64 signed 16 KiB Mach-O), Wasm 3.0 (veko.wasm), and 64-bit VKO bytecode (veko.vko), proving byte-for-byte S1 == S2 native fixed-point convergence across x86_64 and AArch64.