# wwwhat
A Rust-based HTML framework for building server-rendered web applications with automatic interactivity.
**No JavaScript frameworks. No build steps. Just HTML.**
## Features
- **File-based routing** - `site/about.html` becomes `/about`
- **Template variables** - `#user.name#`, `#session.count#`, `#var|filter:arg#`
- **Components** - Reusable `<what-*>` tags with props, defaults, and slots
- **HTML injection** - `w-get`, `w-post` for AJAX without JavaScript
- **Reactive session variables** - Session values auto-update across the page
- **JWT authentication** - Protected routes and role-based access via `auth:` directives
- **SQLite database** - Schema declarations, auto-migration, collection queries
- **Form validation** - Client + server enforcement with `w-validate`
- **Email sending** - SMTP or Resend API, templates with `#variable#` syntax
- **Live reload** - Changes auto-refresh during development
- **Static build** - `run-what build` pre-renders to static HTML with minification
- **Deploy** - SSH, Docker, or static hosting via `run-what deploy`
## Installation
```bash
# Install from crates.io (recommended)
cargo install run-what
# Or build from source
git clone https://github.com/tedigo/what.git
cd what
cargo build --release
```
### Updating
```bash
cargo install run-what
```
## Quick Start
```bash
# Create a new project
run-what new my-site
cd my-site
# Start the development server
run-what dev
# Open http://127.0.0.1:8085
```
## Basic Usage
Create pages in the `site/` directory:
```html
<what>
title: Home
data.session = ["counter"]
</what>
<h1>#title#</h1>
<p>Count: #session.counter|default:"0"#</p>
<button w-set="session.counter += 1">+1</button>
```
Routes are file-based:
- `site/index.html` -> `/`
- `site/about.html` -> `/about`
- `site/blog/index.html` -> `/blog`
- `site/blog/[slug].html` -> `/blog/:slug`
Components are HTML files in `components/`:
```html
<what>
props = "title"
</what>
<div class="card">
<h3>#title#</h3>
<slot/>
</div>
```
## Documentation
See the [docs/](docs/) folder for detailed guides:
- [Getting Started](docs/getting-started.md) - Installation, create a project, first page
- [Template Syntax](docs/templates.md) - Variables, loops, conditionals, filters
- [Components](docs/custom-tags.md) - Creating reusable components with props and slots
- [Form Actions](docs/form-actions.md) - CRUD operations without JavaScript
- [Client Attributes](docs/client-attributes.md) - `w-get`, `w-post`, modals, SPA navigation
- [Reactive Variables](docs/reactive-variables.md) - Auto-updating session variables
- [Configuration](docs/configuration.md) - Server, cache, session, database, auth, uploads, email
- [Dynamic Routes](docs/dynamic-routes.md) - URL parameters and patterns
- [CSS Framework](docs/css-framework.md) - Utility classes, components, dark mode
- [Reference](docs/reference.md) - Complete cheat sheet of all features
- [Build a Blog](docs/tutorial-blog.md) - End-to-end tutorial
- [Deploy to Cloudflare](docs/cloudflare.md) - D1, R2, Turnstile setup (free tier)
- [Comparisons](docs/comparisons.md) - vs HTMX, Astro, Hugo
## CLI Commands
```bash
run-what new [name] # Create a new project (starter, demo, or blank)
run-what dev [--port N] # Start dev server with hot reload
run-what build [--output dist] # Pre-render to static HTML
run-what deploy [--target ssh] # Deploy (ssh, docker, static)
run-what test # Run template tests
run-what generate page [name] # Generate a new page
run-what generate component [name] # Generate a new component
run-what sitemap [--host URL] # Generate sitemap.xml
run-what doctor # Check project health
run-what migrate [--target d1] # Migrate database schema (d1 or sqlite)
```
## License
MIT