starlight-web
v1.0.2
Published
A lightweight Node.js web framework inspired by Python-style routing with simple HTML templating.
Downloads
298
Maintainers
Readme
Starlight Web
Starlight Web is a lightweight Node.js web framework inspired by Python-style routing, designed for learning, simplicity, and small projects.
It lets you create routes, render HTML templates with {} placeholders, and run smoothly on local machines and real cloud environments.
Perfect for students, beginners, and educational projects.
Features
- Simple routing with clean URLs (no
.htmlin the browser) - Built-in HTML template rendering using
{variable}syntax - Zero dependencies (Node.js built-ins only)
- Cloud-ready (GitHub Codespaces, Render, Railway, VPS, etc.)
- Beginner-friendly API
- ES Modules (
.mjs) support
Installation
npm install starlight-webNo extra dependencies required Uses only Node.js built-in modules
Quick Start
program.sl
import * as web from "starlight-web";
// Home page
web.custom("/", (req, res, render) => {
return render("index.html", {
title: "Starlight Web",
user: "Student"
});
});
// Another page (no .html in URL)
web.custom("/about", (req, res, render) => {
return "<h1>About Starlight Web</h1>";
});
// Start server
web.startServer(3000);Project Structure
project/
│── program.sl
│── index.html
│── dominex_macedon.html
│── starlight.html
└── node_modules/HTML Templates
Use {} placeholders directly in HTML.
index.html
<!DOCTYPE html>
<html>
<head>
<title>{title}</title>
<style>
body {
font-family: Arial, sans-serif;
background: #0f172a;
color: #e5e7eb;
text-align: center;
padding: 40px;
}
</style>
</head>
<body>
<h1>{title}</h1>
<p>Hello, {user}!</p>
</body>
</html>Routing
web.custom("/starlight", (req, res, render) => {
return render("starlight.html");
});Visit in browser:
/starlight(No .html needed)
☁️ Cloud Compatibility
Starlight Web works seamlessly on:
- GitHub Codespaces
- Render
- Railway
- Fly.io
- VPS / DigitalOcean
- Localhost
Codespaces automatically forwards your app to a public HTTPS URL.
🔧 API Reference
custom(path, handler)
Registers a route.
web.custom("/path", (req, res, render) => {
return "HTML content";
});render(file, data)
Renders an HTML file with {} placeholders.
render("index.html", { title: "Hello" });startServer(port)
Starts the HTTP server.
web.startServer(3000);Requirements
- Node.js v16+
- ES Modules support (
.mjs)
Author
Dominex Macedon
License
MIT License
Starlight Web — learn web development the simple way.
