This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
NaaS (No as a Service) is a lightweight HTTP service written in pure Rust that always responds with "no" in various formats. It uses only the Rust standard library with zero external dependencies, making it extremely lightweight and fast.
## Development Commands
### Build and Run
```bash
# Debug build
cargo build
# Release build (optimized for size)
cargo build --release
# Run locally
PORT=8080 cargo run
# Run release binary
PORT=8080 ./target/release/naas
```
### Testing
```bash
# Run tests (currently no test files exist)
cargo test
# Test endpoints manually
curl http://localhost:8080/api/no
curl http://localhost:8080/api/no?format=json
curl http://localhost:8080/health
```
### Container Operations
```bash
# Build container with Podman (preferred over Docker)
podman run -d --name naas -p 8080:8080 --restart=always naas:latest
# Check container health
podman healthcheck run naas
```
## Architecture
### Single-File Design
The entire application is contained in `src/main.rs` with ~372 lines of code. This monolithic approach is intentional for simplicity and minimal binary size.
-`/api/no` - API endpoint with format parameter support
-`/health` - Health check endpoint
- CORS headers are added to all responses
3.**Thread-per-Connection Model**: Each incoming TCP connection spawns a new thread via `thread::spawn()`, providing simple concurrency without async complexity.
4.**Manual HTTP Parsing**: The application manually parses HTTP requests and constructs responses, avoiding HTTP library dependencies.
## API Response Formats
The `/api/no` endpoint supports these formats via the `format` query parameter:
- When creating a release, we normally just increment the patch level. We always update all relevant version fields, and we always want to include an up to date debian package in the forgejo release.