Skip to content
webx-netPublic

About

A DSL and framework for hypermedia driven web backends, and REST APIs

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Latest commit

ย 

History

321 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation


Web X

GitHub Workflow Status (with event) GitHub all releases GitHub repo size
Discord GitHub contributors GitHub Sponsors


This is the official repository for the WebX web server project. A framework for building minimal but powerful web app backends, REST APIs, and hypermedia systems using a HTML first approach.
โ–ธ Get started or read more about the project below.

โš ๏ธ WebX is still in early development and not ready for production use. See current runtime support and limitations.


Features & Roadmap

Below is a high-level overview of the existing (implemented) and planned features of the WebX technology (in no particular order).

  • Blazingly fast1 ๐Ÿ”ฅ
  • Lightweight and minimalistic ๐Ÿชถ
  • Versatile, flexible, and powerful ๐Ÿคธ
  • Easy to use and learn ๐Ÿง 
Batteries included ๐Ÿ”‹
  • Hot reloading ๐Ÿ”ฅ
  • Protected and secure by default ๐Ÿ”’
    • DDOS ๐Ÿ›ก๏ธ
    • CORS ๐Ÿ›ก๏ธ
    • CSRF ๐Ÿ›ก๏ธ
    • XSS ๐Ÿ›ก๏ธ
    • SQL injection ๐Ÿ›ก๏ธ
    • Rate limiting โฑ๏ธ
    • TLS/SSL/HTTPS ๐Ÿ”’
  • Built-in modules and services ๐Ÿ“ฆ
    • Static file serving ๐Ÿ“
    • Database driver integration ๐Ÿ—ƒ๏ธ
      • PostgreSQL
      • MySQL
      • SQLite
      • MariaDB
      • MongoDB
      • Redis
    • Authentication ๐Ÿ”‘
    • Authorization ๐Ÿ”‘
    • Caching ๐Ÿ—„๏ธ
    • Sessions ๐Ÿช
    • WebSockets ๐ŸŒ
  • VSC extension (Syntax Highlighting, Snippets, and more)
  • WebX Playground ๐Ÿ›
  • WebX Docs ๐Ÿ“–
  • Package manager ๐Ÿ“ฆ (NPM-like, for WebX handlers, modules, and drivers)
WebX DSL (Domain Specific Language)
  • Parser
    • AST for WebX modules
  • Comments
  • Model definitions (ORM, Prism-like)
    • Fields
    • Types
    • Value Constraints
    • Serde Validation
    • Relations
    • Migrations
    • Queries (CRUD operations)
  • Native SSR (templating)
    • JSX support
    • HyperScript support
  • TypeScript support
    • Deno runtime
    • WebAssembly AoT compilation
    • Unified type definitions (shared between client and server)
  • Validation (Serialize/Deserialize for req/res data)
    • Input sanitization (safe defaults)
    • Output sanitization (safe defaults)
    • Type checking
    • Constraints
    • Relations
    • Formats
      • JSON
      • JSON5
      • XML
      • HTML
      • CSV
      • YAML
      • TOML
      • Custom (plugins)
  • Route definitions
    • HTTP methods
    • Path parameters (URL/segments/)
    • Query parameters (?key=value)
    • Request headers
    • Request Body parameters (POST/PUT/PATCH)
    • Body serialization (JSON, XML, etc.)
    • Body deserialization and validation
    • Dependency injection (between handlers)
    • Middleware (before/after handlers)
    • Endpoint body code block types
      • TypeScript (TS)
      • Typescript-React (TSX)
get /todos/(id: number) -> initServices:s, auth(s.userService, id):user, isAdmin(user) { ... }
  • Handlers (middleware)
    • Design choices
      • Async vs sync
      • Return types (explicit)
      • Error handling (opinionated!)
      • Dependency injection
      • Return result destructuring
  • Built-in handlers ๐Ÿ“ฆ (stdlib)
    • Data manipulation
    • Business logic
    • Authentication
      • OAuth
      • OpenID
      • JWT
      • SAML
      • LDAP
      • Kerberos
      • Basic
      • Digest
      • Bearer
      • API keys
      • HMAC
      • Mutual TLS
    • Authorization
      • RBAC
      • ABAC
      • PBAC
      • LBAC
      • DAC
    • Logging
      • Request logging
      • Error logging
      • Audit logging
      • Security logging
      • Performance logging
      • Debug logging
      • Custom logging (plugins)
    • Caching
      • In-memory
      • Redis
      • Memcached
    • Sessions
    • Database drivers
    • Static file serving
    • Templating ๐Ÿ“„
  • Error handling ๐Ÿšจ
    • Server errors
    • Client errors
    • Network errors
    • Database errors
    • External service errors
    • Logging
WebX CLI tool
  • Project
    • Scaffolding (init new project)
    • Configuration
  • Build (AoT compilation)
    • Static files
    • TypeScript to WebAssembly
  • Run (JIT compilation)
    • Development mode
      • Hot reloading
      • Logging
      • Error handling
      • Debugging
    • Production mode
      • Optimizations
      • Caching
      • Compression
      • Security
      • Logging
      • Error handling
  • Test ๐Ÿงช
    • Unit tests
    • Integration tests
    • End-to-end tests
  • Deploy โ˜๏ธ
    • Docker
    • Kubernetes
    • Cloud
  • Documentation (auto-generated)
  • Publish (to package registry)
  • Versioning
  • Linting
  • Formatting
WebX Runtime
  • Web server
    • TCP/IP
    • HTTP Request parsing
    • HTTP Response serialization
    • HTTP Request routing
    • HTTP Request handling
    • Protocols
      • HTTP/0.9
      • HTTP/1.0
      • HTTP/1.1
      • HTTP/2
      • HTTP/3
      • HTTP/3 server push
      • TLS/SSL/HTTPS
    • Multiplexing
    • Compression
    • Status codes
    • Cookies
    • Caching
    • Sessions
    • Multi-threading
    • Middleware
    • Logging
    • Error handling
  • Web framework
    • REST API
    • GraphQL API
    • Hypermedia API
    • WebSockets API

Getting started

โ†’ย  Read the Documentation

โ†’ย  Installation

Download the latest prebuilt binaries from the releases page and extract it to a folder of your choice.

โ†’ย  Development

Run the web server in dev mode for the current project:

webx run

This enables hot reloading ๐Ÿ”ฅ, extensive logging, safe real-time error reporting, and other useful features.

โ†’ย  Production

To run the project in production mode:

webx run --prod

This performs compile-time optimizations ๐Ÿš€ (for performance improvements), caching, and other valuable features. It also disables hot reloading and response-logging to reduce sensitive debug information.


Examples

The todo CRUD example is a runnable HTMX browser UI with an in-memory backend, covered by HTTP integration tests. From this repository:

cargo run --locked -- run examples/todo

Open http://localhost:8080. HTMX sends CRUD requests and swaps server-rendered HTML fragments. The example uses inline JavaScript endpoint blocks, path parameters, URL-encoded PUT form bodies, and static("index.html"); it loads pinned HTMX 2.0.8 from jsDelivr. No database, frontend build step, or JSX rendering is required.

See Runtime behavior for the implemented routing, reload, request-state, and body-handling contract. The roadmap above includes planned features; it is not a statement of current runtime support.

Run the tests with cargo test --locked. They assert actual HTTP responses and join the server/runtime workers without terminating the test process.


Why Web X?

Our vision is to reduce the boilerplate and complexity of building backends and APIs.
โ–ธ WebX is designed to be simple, minimal, easy to learn, and intuitive while still being versatile and flexible. It can build complex applications quickly while still being lightweight๐Ÿชถ and blazingly fast๐Ÿ”ฅ.

Backends shouldn't be bloated and complex, but focus on what's most important. Don't reinvent the wheel for every new project,
โ–ธ Jump straight to the goodi-goodi parts and get started using WebX today!

โค๏ธ Perfect match for </> htmx

WebX is designed to be a minimalistic web framework that is easy to learn and use. It is intended to be used with HTMX, a great alternative to frameworks like React, Vue, and Angular (or other stacks). HTMX allows you to build dynamic web applications without learning a new language or framework for the front end. WebX is designed to be versatile and flexible, and it is easy to quickly build backends for complex applications.
โ–ธ Read more about HTMX


Contributing

Contributions are welcome! If you have any suggestions or find any bugs, please create an issue or a pull request.

Do you have any suggestions for additional features? Create an issue or a pull request! Read more about contributing below.

Footnotes

  1. BLAZING FAST @ThePrimeagen โ†ฉ

About

A DSL and framework for hypermedia driven web backends, and REST APIs

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages