Skip to main content

Introduction

Welcome to the Regius documentation!

What is Regius?​

Regius is a CLI application for building web pages, inspired by Laravel but built with Go. It offers tools for database migrations and code generation, providing an agile and organized development experience.

Key Features​

CLI & Code Generation​

  • Quick Project Setup: Create new web applications with a single command (templ, jet, or Go renderers)
  • Hot-Reload Development: regius dev rebuilds and restarts your app on file changes, with automatic browser reload
  • Database Migrations: Built-in support for database schema management with golang-migrate
  • Seeding: Create and run SQL seed files with automatic tracking
  • Code Generation: Generate models, GORM models, handlers, mail templates, auth scaffolding, API handlers, webhooks, background jobs, WebSocket endpoints, CRUD slices, resources, middleware, services, and more
  • Shell Completion: Generate autocompletion scripts for bash, zsh, fish, and PowerShell
  • Maintenance Mode: Put the server in maintenance mode and bring it back with simple commands

Database Layer​

  • Multi-database support: PostgreSQL, MySQL/MariaDB, and SQLite out of the box
  • Connection pool tuning: Configure max open/idle connections and lifetime
  • Health checks: Verify database reachability with HealthCheck(ctx)
  • Transaction helper: Run code in a transaction with automatic commit/rollback
  • Read/write splitting: Route reads to a replica via Reader() and writes via Writer()
  • GORM integration: Access a configured *gorm.DB or run AutoMigrate
  • Query logging: Log every SQL statement with timing and error details

Security Middleware​

  • Rate Limiting: Protect against abuse and DDoS with Token Bucket or Sliding Window algorithms
  • CORS: Handle Cross-Origin Resource Sharing with flexible configuration
  • Security Headers: Helmet-equivalent HTTP security headers (CSP, HSTS, X-Frame-Options, etc.)
  • API Key Authentication: Authenticate API requests with multiple key sources and validation backends
  • Request ID Tracing: Stamp every request with a unique correlation ID for log correlation
  • Request Sanitization: Neutralize XSS at the request boundary with bluemonday
  • IP Whitelist/Blacklist: Allow or deny requests based on client IP with CIDR support
  • Password Hashing: Centralized hashing with bcrypt, scrypt, and argon2id support

Other Features​

  • Authentication: Built-in authentication scaffolding with make auth
  • Session Management: Multiple session store options (cookie, database, Redis)
  • Mail Support: Built-in mail templates and SMTP/API mailer configuration
  • File Storage: Support for S3, MinIO, SFTP, and WebDAV filesystems
  • Template Engine: Jet, Go, and templ rendering

Validation & APIs​

  • Validation: Rich built-in rule set, custom rules, struct-tag validation, localized errors, and request-validation middleware
  • Scalar API Reference: Interactive OpenAPI 3.1 documentation UI with response envelopes and pagination helpers
  • Webhooks: Signed inbound webhooks (Stripe, GitHub, or any HMAC provider) with constant-time verification

Async & Real-Time​

  • Background Jobs: Run work outside the request cycle with retries, backoff, dead-lettering, scheduling, and monitoring
  • WebSockets: Bidirectional real-time channels with same-origin handshake security and an SSE-shared event envelope
  • Server-Sent Events (SSE): Push real-time updates to browsers over standard HTTP

Developer Experience​

  • Internationalization (i18n): Multi-language apps with locale detection and translation file management
  • Configuration Management: Multiple config file formats, profiles, startup validation, and hot-reload
  • Secrets Management: Fetch secrets from external providers (env, aws, vault) and encrypt sensitive values at rest

Getting Started​

To start using Regius, follow these steps:

  1. Install Regius via Homebrew or download binaries
  2. Create a new application: regius new myapp
  3. Navigate to your project: cd myapp
  4. Configure your environment variables in .env
  5. Run the development server

For detailed installation and usage instructions, see the Installation and Usage sections.