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
  • 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, 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 and Go template rendering

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.