Run a Full JavaScript Website with AxonASP โ€” No Node.js Required
DEV Community

Run a Full JavaScript Website with AxonASP - No Node.js Required

Why AxonASP Changes the Game for Server-Side JS

Most developers associate server-side JavaScript exclusively with Node.js. And Node.js is great - until you're drowning in async/await chains, package.json conflicts, and the 47th minor version bump of a dependency that broke your build.

AxonASP takes a fundamentally different approach. Instead of wrapping everything in an event loop and forcing asynchronous patterns everywhere, AxonASP's JavaScript engine executes code synchronously by default. You write your server logic the same way you write your frontend logic - line by line, top to bottom. It compiles through a high-performance AST parser and runs directly on a custom Go-based virtual machine. The result? Cleaner code, simpler debugging, and a massive reduction in cognitive overhead.

What You Get Out of the Box

  • Full ES5 + ES6 support (classes, arrow functions, template literals, destructuring, proxies, for...of, Map, Set, Symbol, typed arrays - 37+ modern features documented)
  • Synchronous execution - no callback pyramid, no promise chains for basic I/O
  • ASP intrinsic objects - Request, Response, Session, Application, Server - all accessible directly from your JS code
  • No npm install required - just write .asp or .js files and point the server at them
  • CLI execution - run JavaScript files from the command line for automation, batch processing, or testing

The Philosophy: Simplicity Over Complexity

Here's a hard truth: most web applications don't need 2,000 npm modules. They need to read a database, render HTML, handle form submissions, and maybe serve a JSON API. That's it.

The modern JavaScript ecosystem has convinced people that every project requires a build pipeline, a bundler, a linter, a type checker, and a module graph resolver. But the reality is that a well-structured server-rendered application - where you can see the actual HTML structure of your pages and inject backend logic only where you need it - is often simpler, faster, and more maintainable than a single-page application backed by a microservice mesh.

With AxonASP, you write plain HTML with embedded server-side JavaScript. The <% %> delimiters mark exactly where the backend logic lives. You can see the entire page structure in one file. No hidden abstraction layers. No magic.

Bridging Frontend and Backend with G3TEMPLATE

One of the hidden gems in the AxonASP ecosystem is the G3TEMPLATE library - a high-performance template rendering engine powered by Go's html/template underneath. Here's why it matters for teams:

The Designer-Developer Gap

If you've ever worked on a project where a frontend designer hands off HTML to a backend developer, you know the pain. The designer builds a beautiful page. The developer cuts it apart into templates, sprinkles in logic, and suddenly the design breaks because someone closed a <div> in the wrong partial.

G3TEMPLATE solves this by keeping your template files pure HTML with Go-style template syntax. The designer can open the template file directly in any browser and see exactly what the page will look like. The backend developer binds data through a clean Render(path, data) API. No stepping on each other's toes. No broken layouts.

// Server-side JavaScript using G3TEMPLATE
<% @ Language = "javascript" %>
<%
var template = Server.CreateObject("G3TEMPLATE");
var data = Server.CreateObject("Scripting.Dictionary");
data.Add("title", "My JavaScript-Powered Site");
data.Add("user", "Lucas");
var html = template.Render("/views/index.html", data);
Response.Write(html);
%>

The template file (/views/index.html) is a plain HTML file that your designer can open, edit, and preview without ever touching the server:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{.title}}</title>
</head>
<body>
    <h1>Welcome, {{.user}}!</h1>
</body>
</html>

That's it. No template inheritance hierarchies. No custom DSL to learn. Just clean separation of concerns.

Step-by-Step: Building a JavaScript Website on AxonASP

Let's walk through creating an actual website. The entire thing, from scratch.

Step 1: Get AxonASP Running

Clone the repository and build the server:

git clone https://github.com/guimaraeslucas/axonasp.git
cd axonasp
./build.ps1

This gives you three executables:

  • axonasp-http.exe - standalone HTTP server
  • axonasp-fastcgi.exe - FastCGI server (for IIS/nginx integration)
  • axonasp-cli.exe - CLI runner for batch scripts

Start the HTTP server:

./axonasp-http.exe

By default, it serves files from the www/ directory on http://localhost:8801/.

Step 2: Create Your First JavaScript Page

Create www/index.html (yes, AxonASP serves static files too) or www/index.asp for a dynamic page:

<% @ Language = "javascript" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><%= Server.HTMLEncode(pageTitle) %></title>
    <link rel="stylesheet" href="/css/style.css">
</head>
<body>
    <header>
        <h1>Welcome to My JS-Powered Site</h1>
        <nav>
            <a href="/">Home</a>
            <a href="/about.asp">About</a>
            <a href="/api/products.asp">Products API</a>
        </nav>
    </header>
    <main>
        <%
        var features = [
            "Server-side JavaScript with ES6 support",
            "Zero npm dependencies",
            "Synchronous execution model",
            "Full ASP intrinsic object access",
            "G3TEMPLATE for clean template separation"
        ];
        for (var i = 0; i < features.length; i++) {
        %>
        <div class="feature-card">
            <h3>Feature #<%= i + 1 %></h3>
            <p><%= features[i] %></p>
        </div>
        <% } %>
    </main>
    <footer>
        <p>Page generated at: <%= new Date().toString() %></p>
    </footer>
</body>
</html>

Step 3: Build a JSON API

One of my favorite use cases - a REST API endpoint with zero dependencies:

<% @ Language = "javascript" %>
<%
Response.ContentType = "application/json";

var products = [
    { id: 1, name: "Wireless Mouse", price: 29.99, inStock: true },
    { id: 2, name: "Mechanical Keyboard", price: 89.99, inStock: true },
    { id: 3, name: "USB-C Hub", price: 49.99, inStock: false }
];

var idParam = Request.QueryString("id");
if (idParam !== "") {
    var id = parseInt(idParam, 10);
    var found = null;
    for (var i = 0; i < products.length; i++) {
        if (products[i].id === id) {
            found = products[i];
            break;
        }
    }
    Response.Write(JSON.stringify({ success: true, data: found || null }));
} else {
    Response.Write(JSON.stringify({ success: true, count: products.length, data: products }));
}
%>

No Express, no router, no body-parser, no cors middleware. Five lines of setup, then just JavaScript.

Step 4: Use Modern ES6 Features

Yes, you can use arrow functions, template literals, destructuring, Map, Set, for...of, and even Proxy:

<% @ Language = "javascript" %>
<%
// Classes
class Product {
    constructor(name, price) {
        this.name = name;
        this.price = price;
    }
    get formatted() {
        return `${this.name} - $${this.price.toFixed(2)}`;
    }
}

// Arrow functions + template literals
const products = [
    new Product("Widget A", 9.99),
    new Product("Widget B", 14.99)
];
const html = products.map(p => `<li>${p.formatted}</li>`).join('\n');
%>
<ul><%= html %></ul>

Step 5: Run from the CLI

Need to automate something? Write a JavaScript file and run it directly:

./axonasp-cli.exe -r scripts/generate-report.js -m javascript

Your scripts have full access to Response, Server, custom libraries (G3JSON, G3FILES, G3CRYPTO, and more), and the console object for logging. Perfect for scheduled tasks, data transformations, or batch processing.

The Full Architecture Picture

Here's what the project structure looks like for a typical AxonASP JS website:

axonasp/
โ”œโ”€โ”€ axonasp-http.exe        # HTTP server binary
โ”œโ”€โ”€ axonasp-cli.exe         # CLI runner binary
โ”œโ”€โ”€ global.asa              # App/session lifecycle (JS or VBScript)
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ axonasp.toml        # Server configuration
โ”œโ”€โ”€ www/                    # Web root
โ”‚   โ”œโ”€โ”€ index.asp           # JavaScript-powered homepage
โ”‚   โ”œโ”€โ”€ about.asp
โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”‚   โ””โ”€โ”€ style.css
โ”‚   โ”œโ”€โ”€ js/                 # Client-side JS files (static)
โ”‚   โ”œโ”€โ”€ views/              # G3TEMPLATE template files
โ”‚   โ”‚   โ”œโ”€โ”€ header.html
โ”‚   โ”‚   โ”œโ”€โ”€ footer.html
โ”‚   โ”‚   โ””โ”€โ”€ layout.html
โ”‚   โ””โ”€โ”€ api/                # REST API endpoints
โ”‚       โ””โ”€โ”€ products.asp
โ””โ”€โ”€ scripts/                # CLI automation scripts
    โ””โ”€โ”€ cleanup.js

No node_modules/. No package.json. No webpack.config.js. No .babelrc. Just your code, your templates, and a server that runs them.

When Should You Use This?

AxonASP with server-side JavaScript is a strong fit when:

  • You want full-stack JS without the Node.js ecosystem overhead
  • You're building server-rendered websites where clean HTML matters
  • You need a simple API layer without framework boilerplate
  • You work with designers who need to see and edit HTML templates directly
  • You value synchronous, predictable code flow over async abstractions
  • You're migrating legacy Classic ASP applications and want to modernize gradually

It's not a replacement for Node.js in every scenario - if you need WebSockets, streaming, or event-driven microservices, stick with what works. But for the vast majority of web applications - content sites, dashboards, API backends, CMS platforms - this stack is remarkably efficient.

Dive Deeper

The official AxonASP documentation has an entire section dedicated to JavaScript support, with detailed pages for every ES6 feature, the G3TEMPLATE library, and the ASP intrinsic objects:

๐Ÿ‘‰ JavaScript Support in AxonASP

You can also explore the full source code, download binaries for Mac, Linux, FreeBSD and Windows or contribute on GitHub:

๐Ÿ‘‰ AxonASP on GitHub

Have you tried running server-side JavaScript without Node.js? I'd love to hear about your experience in the comments. If you found this useful, follow me for more deep dives into practical, no-nonsense web development.

Comments

No comments yet. Start the discussion.