No As A Service
  • Rust 93.5%
  • Dockerfile 6.5%
Find a file
Ole-Morten Duesund ebd0fcc448 Redesign main page with minimalist "No" and move interactive UI to /playground
- Create elegant minimalist main page with centered "No"
- Add automatic dark mode support for main page
- Move original interactive API testing interface to /playground
- Add footer links to main page for navigation
- Update routing to serve both pages appropriately
- Update documentation to reflect new page structure

The main page now provides a clean, focused experience while the
playground remains available for API testing and exploration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 16:47:29 +02:00
src Redesign main page with minimalist "No" and move interactive UI to /playground 2025-09-27 16:47:29 +02:00
Cargo.lock Initial commit: Add NaaS (No as a Service) implementation 2025-09-27 16:42:47 +02:00
Cargo.toml Initial commit: Add NaaS (No as a Service) implementation 2025-09-27 16:42:47 +02:00
CLAUDE.md Redesign main page with minimalist "No" and move interactive UI to /playground 2025-09-27 16:47:29 +02:00
Containerfile Initial commit: Add NaaS (No as a Service) implementation 2025-09-27 16:42:47 +02:00
naas.service Initial commit: Add NaaS (No as a Service) implementation 2025-09-27 16:42:47 +02:00
README.md Redesign main page with minimalist "No" and move interactive UI to /playground 2025-09-27 16:47:29 +02:00

No as a Service (NaaS)

A lightweight, production-ready HTTP service that always says "no" in various formats.

Features

  • Minimal dependencies (pure Rust, standard library only)
  • Multiple response formats (text, JSON, XML, YAML, boolean)
  • Mobile-responsive web frontend
  • CORS support
  • Health check endpoint
  • Optimized for small binary size (~1MB)
  • Container-ready with health checks

API Endpoints

  • GET / - Minimalist web page displaying "No"
  • GET /playground - Interactive API testing playground
  • GET /api/no - Returns plain text "no"
  • GET /api/no?format=json - Returns {"answer": "no"}
  • GET /api/no?format=bool - Returns false
  • GET /api/no?format=xml - Returns XML response
  • GET /api/no?format=yaml - Returns YAML response
  • GET /health - Health check endpoint

Quick Start

Local Development

# Build and run locally
cd naas
cargo build --release
PORT=8080 ./target/release/naas

Visit http://localhost:8080

Container Deployment with Podman

# Build container
cd naas
BUILDAH_FORMAT=docker podman build -t naas:latest -f Containerfile .

# Run container
podman run -d \
  --name naas \
  -p 8080:8080 \
  --restart=always \
  naas:latest

# Check health
curl http://localhost:8080/health

Systemd Service Deployment

  1. Setup user and directory:
# Create service user
sudo useradd -r -s /bin/false naas

# Copy application files
sudo mkdir -p /opt/naas
sudo cp -r naas/* /opt/naas/
sudo chown -R naas:naas /opt/naas
  1. Install systemd service:
# Copy service file
sudo cp naas/naas.service /etc/systemd/system/

# Reload systemd and start service
sudo systemctl daemon-reload
sudo systemctl enable naas
sudo systemctl start naas

# Check status
sudo systemctl status naas
  1. View logs:
sudo journalctl -u naas -f

Production Deployment to no.donothireus.com

Caddy Reverse Proxy Configuration

no.donothireus.com {
    reverse_proxy localhost:8080 {
        header_up Host {host}
        header_up X-Real-IP {remote_host}
        header_up X-Forwarded-For {remote_host}
        header_up X-Forwarded-Proto {scheme}
    }
}

Full Production Setup

  1. Deploy application using systemd service (see above)

  2. Configure Caddy with the above Caddyfile configuration (SSL certificates are automatic with Caddy)

  3. Restart services:

sudo systemctl restart caddy
sudo systemctl restart naas

Performance

  • Binary size: ~1MB (release build with optimizations)
  • Memory usage: <10MB
  • Startup time: <100ms
  • Request latency: <1ms

Development

Building from Source

# Debug build
cargo build

# Release build with optimizations
cargo build --release

# Run tests
cargo test

Container Build Options

# Multi-platform build (if needed)
podman build --platform linux/amd64,linux/arm64 -t naas:latest .

# Build with specific Rust version
podman build --build-arg RUST_VERSION=1.75 -t naas:latest .

Security

  • Runs as non-root user (UID 1000)
  • Read-only container filesystem
  • No new privileges
  • All capabilities dropped except NET_BIND_SERVICE
  • Memory and CPU limits enforced
  • CORS headers properly configured

License

MIT