README.md

# smol

[![Package Version](https://img.shields.io/hexpm/v/smol)](https://hex.pm/packages/smol)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/smol/)

A tiny web server for Gleam targeting all JavaScript runtimes (Node.js, Deno, Bun, and others).

## Features

- 🦄 **Cross-Platform**: Use it with Node.js, Deno, Bun or serverless functiosn with the same API
- 🚀 **Fully Featured**: First-class support for chunked responses, Server-Sent Events and WebSockets
- 🧩 **Uses the platform**: Built-in support for streaming files and working with JSON, uses standard Web APIs under the hood.

## Installation

```sh
gleam add smol@1 gleam_javascript@1 gleam_http@4
```

## Hello, World!

```gleam
import gleam/javascript/promise
import smol

pub fn main() {
  let handler = fn(request) {
    let response = smol.send_string("Hello, Joe!")
    promise.resolve(response)
  }
  
  smol.new(handler)
  |> smol.start()
}
```

## Runtime Adaptation

smol provides functions to adapt your Gleam handlers to different environments:

```gleam
// Convert handler to standard Web Fetch API
let fetch_handler = smol.adapt(my_handler)
```

## Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.