# 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** - `/pages/admin/users.html` becomes `/admin/users`
- **Template variables** - `#user.name#`, `#session.count#`
- **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
- **Live reload** - Changes auto-refresh during development
- **Component library** - Reusable `<what-*>` component tags
## 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
To update to the latest version, simply run the install command again:
```bash
cargo install run-what
```
Cargo automatically replaces the old version with the new one.
## 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
```
### Custom Port
To run the server on a different port:
```bash
run-what dev --port 3000
```
### Hot Reload
The development server automatically watches for file changes. When you edit any `.html`, `.css`, `.js`, `.json`, `.toml`, or `.what` file, the browser refreshes automatically. No manual reload needed.
This works by:
1. Watching the project directory for changes
2. Detecting relevant file modifications (ignores `.db` and hidden files)
3. Broadcasting a reload signal to connected browsers via WebSocket
## Basic Usage
Create pages in the `pages/` directory:
```html
<page title="Home">
<main>
<h1>Hello, #name#!</h1>
</main>
</page>
```
Routes are file-based:
- `pages/index.html` → `/`
- `pages/about.html` → `/about`
- `pages/blog/index.html` → `/blog`
## Documentation
See the [docs/](docs/) folder for detailed guides on:
- [Template Syntax](docs/templates.md) - Variables, includes, loops, conditionals
- [Custom Tags](docs/custom-tags.md) - Creating reusable components
- [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, and session settings
- [Dynamic Routes](docs/dynamic-routes.md) - URL parameters and patterns
## License
MIT