Skip to content

Examples

This section contains practical, minimal examples built with Vix.

Each example is:

  • Self-contained
  • Minimal
  • Focused on one concept
  • Everything inside main()
  • Ready to copy and run

Available Examples

hello-http

A minimal HTTP server with one route.

Concepts:

  • App
  • GET route
  • Response
  • app.run()

auth

A simple authentication example using:

  • Headers
  • Middleware
  • 401 responses
  • Protected routes

ws-chat

A minimal WebSocket chat example using:

  • Typed messages
  • broadcast_json
  • Rooms
  • Basic chat protocol

async-worker

A background async worker example showing:

  • Thread pool usage
  • Non-blocking handlers
  • Task execution off the main request thread

p2p-ping

A minimal peer-to-peer example demonstrating:

  • Basic P2P communication
  • Message exchange
  • Simple ping/pong behavior

Philosophy

Examples are not production templates.

They are:

  • Concept demonstrations
  • Minimal by design
  • Explicit over abstract
  • Easy to understand

Use them as building blocks.