Est. 1998 Beginner

SMX

A server-side macro-expansion language for building dynamic, database-driven web pages by embedding percent-delimited macros directly in HTML.

Created by Server Macro Expansion originated in Internet Factory's Commerce Builder web server; the open-source SMX language and its reference implementation were created and maintained by Erik Aronesty.

Paradigm Macro expansion, Template-based, Server-side scripting
Typing Untyped (text/string-based macro processing)
First Appeared Around 1998 for the open-source implementation; the underlying Server Macro Expansion language originated earlier in Internet Factory's Commerce Builder
Latest Version smx 1.1.4 (build 458), April 2018

SMX — short for Server Macro Expansion — is a server-side scripting language for generating dynamic web pages by embedding macros directly in HTML. Instead of writing a separate program that prints markup, an SMX author writes an ordinary HTML page sprinkled with percent-delimited macros; the engine passes the file through, expanding each macro in place and leaving everything else untouched. This “pass-through templating” model makes SMX easy to adopt for tasks such as page hit counters, string manipulation, form handling, and database-backed content.

SMX is a niche language with a long history. It began as the embedded scripting feature of a 1990s commercial web server and was later revived as an open-source macro processor and web-server module, keeping the syntax runnable on modern systems long after its original platform faded.

History & Origins

SMX first appeared as the scripting layer of Internet Factory’s Commerce Builder, a web server from the mid-1990s that aimed to let people build e-commerce sites with minimal programming. The server’s Server Macro Expansion feature was a set of proprietary HTML extensions covering everything from hit counters and string manipulation to ODBC database access — capabilities that, at the time, otherwise required CGI programs written in C or Perl. Because so much functionality was reachable through simple macros, SMX could substantially reduce the effort of building dynamic or database-driven sites.

As Commerce Builder faded from the market, its SMX pages risked becoming unmaintainable. Rather than rewrite those sites in more popular languages, a small group of SMX users chose to reimplement the language itself. Around 1998, Erik Aronesty began an open-source version of SMX — a standalone macro processor that could run as a web-server module, a CGI program, or a FastCGI service. This open-source lineage (copyright dating from 1998) is what keeps SMX runnable today, and it is the implementation most directly associated with the “SMX” name in later documentation.

A note on dates: The exact first-appearance year of Server Macro Expansion in Commerce Builder is not well documented. The 1998 date used here reflects the beginning of the open-source implementation, which is the version with verifiable release history. Where precise years are uncertain, treat them as approximate.

Design Philosophy

SMX is built around a few simple, consistent ideas:

  1. Pass-through by default — An SMX file is mostly plain HTML. The engine outputs everything verbatim except the parts it recognizes as macros. This inverts the model of languages like PHP, where code is the default and markup must be explicitly echoed.
  2. One uniform macro syntax — Every function begins with a % (“magic character”), followed by the function name, and then either a closing % or a parenthesized argument list. There is essentially one thing to learn syntactically, which keeps the language approachable for people who are primarily writing HTML.
  3. High-level building blocks — SMX ships ready-made macros for common web chores (counters, form fields, SQL queries, includes), so a page author can accomplish a lot without writing procedural code.
  4. Safe embedding of untrusted content — Because macros live inside otherwise ordinary documents, SMX provides a %safe-mode mechanism to restrict what macros are permitted to run when pages may include user-supplied text.

Key Features

Macro Syntax

All SMX constructs follow the same shape. Argument-less macros are wrapped in a pair of percent signs; macros with arguments use parentheses:

%header%
<h1>Welcome</h1>

This page has been viewed %counter(home-hits) times.

%footer%

Arguments can be wrapped in double quotes (with backslash escaping) when they contain spaces or special characters, and in single quotes to disable macro interpretation inside the argument — a useful way to pass literal text through untouched.

Database Access

One of SMX’s headline capabilities is querying a database and formatting the results inline. A %sql macro can iterate over rows and emit a column value with per-row formatting:

<ul>
%sql(<dsn>, "SELECT name FROM products", <li>%col(1)</li>)
</ul>

Here %col(1) refers to the first selected column, and the third argument is the template repeated for each row. In practice SMX has been used with ODBC data sources (via unixODBC) and SQLite, making small database-driven pages — guestbooks, product listings, counters — straightforward to build.

Forms and Includes

SMX includes macros for reading form input and for composing pages out of reusable fragments (for example, shared %header% and %footer% snippets), which encourages a consistent layout across a site without a heavyweight framework.

Flexible Deployment

The open-source SMX reference implementation can run in several ways:

  • Apache module — loaded so that .htm and .html files are processed by SMX.
  • CGI — an SMX file can begin with #!/usr/bin/smx -c and be executed like any CGI script.
  • FastCGI — served through an smx-fcgi binary, which (as with FastCGI generally) reuses a persistent process to avoid per-request startup costs.

The project builds with Autotools and depends on libraries such as unixODBC and SQLite, with optional image support via GD. It is distributed under a BSD-style (3-clause) license.

Evolution

SMX’s story is one of preservation more than expansion. The language’s feature set was largely defined by its Commerce Builder origins — a pragmatic toolkit for dynamic, database-backed pages. The open-source effort’s main contribution was to make that toolkit portable: reimplementing the engine in C/C++, wrapping it for Apache, CGI, and FastCGI, and packaging it so it could be built on contemporary Unix-like systems. Development was most active in the roughly 1998–2006 window, with tagged releases continuing later; the reference implementation’s release smx 1.1.4 (build 458) dates to April 2018. Alternative implementations have also been noted, including a C++ version and a Java “OpenSMX” effort.

Current Relevance

SMX was never a mainstream competitor to PHP, Perl, or ASP/VBScript, and it is not a language most developers would choose for a new project today. Its significance is more historical and practical:

  • A window into early web development — SMX embodies the mid-1990s approach of a commercial web server bundling a proprietary macro language to make dynamic, e-commerce pages accessible to non-programmers.
  • A study in language preservation — The community’s decision to reimplement the language (as an Apache/CGI/FastCGI engine) rather than migrate every site is a notable example of how niche languages survive their original platforms.
  • A minimal, legible templating model — Its single-magic-character, pass-through design remains a clean illustration of macro-expansion templating, comparable in spirit to Server-Side Includes but with a richer function set.

Why SMX Matters

SMX represents a category of language that rarely makes it into textbooks: the vendor-bundled web macro language, born to sell a product and kept alive by the people who depended on it. It shows how much dynamic-web capability could be packed behind a single %-prefixed macro syntax, and how a small, determined community can keep such a language runnable decades after its commercial origins have disappeared. For the code-archaeology enthusiast, SMX is a compact, self-consistent artifact of the early commercial web — still buildable, still documented, and still expanding its macros one percent sign at a time.

Sources

Timeline

1990s
Server Macro Expansion (SMX) appears as the embedded macro language of Internet Factory's Commerce Builder, one of the earlier commercial web servers aimed at building e-commerce sites without extensive programming. The exact debut year is uncertain.
1998
Erik Aronesty begins an open-source reimplementation of SMX as a standalone macro processor and web-server module, rather than porting existing SMX sites to Perl or PHP. The project's copyright dates from 1998.
2000s
The open-source SMX gains handlers for multiple deployment models — an Apache module (loaded for .htm/.html files), CGI (via a #!/usr/bin/smx shebang), and FastCGI — along with ODBC/SQLite database access and a %safe-mode for constraining untrusted macros.
2006
The reference implementation's active development period spans roughly 1998–2006, per the project's copyright range, during which SMX is packaged with Autotools and depends on libraries such as unixODBC, SQLite, and the Apache development headers.
2018
smx 1.1.4 (build 458) is tagged on April 19, 2018 — among the most recent releases of the reference implementation, which is hosted on GitHub (earonesty/smx) and registered on the GNU Savannah (nongnu) forge.

Notable Uses & Legacy

Internet Factory Commerce Builder

SMX (Server Macro Expansion) began as the built-in scripting layer of Commerce Builder, letting site builders add counters, string manipulation, and ODBC database queries to HTML pages to produce dynamic, e-commerce-oriented sites.

Apache-hosted dynamic sites

The open-source SMX reimplementation runs as an Apache module that processes .htm and .html files, expanding embedded macros server-side so legacy SMX pages can be served on a modern LAMP-style stack.

CGI and FastCGI applications

SMX can run as a CGI interpreter (via a #!/usr/bin/smx shebang) or through a FastCGI binary, generating pages such as guestbooks and hit counters backed by SQLite or ODBC data sources.

GNU Savannah / open-source community

A small community of SMX users kept the language alive by hosting the Server Macro Expansion project on GNU Savannah and GitHub rather than abandoning existing SMX codebases.

Running Today

Run examples using the official Docker image:

docker pull
Last updated: