Skip to content

pomdtr/smallweb

Repository files navigation

Smallweb - Host websites from your internet folder

Smallweb is a lightweight web server based on Deno. It draws inspiration from both legacy specifications like CGI and modern serverless platforms such as Val Town and Deno Deploy.

Smallweb maps domains to folders in your filesystem. For example, if you own the smallweb.run domain:

  • https://smallweb.run maps to ~/smallweb/www
  • https://example.smallweb.run maps to ~/smallweb/example

Creating a new website is as simple as creating a folder and opening the corresponding URL in your browser. There's no need to configure a build step (unless you want to) or start a development server. Since servers are mapped to folders, you can manage them using standard Unix tools like cp, mv, or rm.

A self-hosted serverless platform

Each incoming HTTP request is sandboxed in a single Deno subprocess by the Smallweb evaluation server. If there are no incoming requests, no resources are used, making it an ideal solution for low-traffic websites.

Smallweb does not use Docker, but it still sandboxes your code using Deno. A smallweb app only has access to:

  • the network
  • some environment variables (for configuration or secrets)
  • it own folder (read and write)

And if you website suddenly go viral, you can move your site to Deno Deploy in one command.

Open-Source, GPL Licensed

You can find the smallweb source on github.

Installation

All the instructions are available in the docs.

Examples

All the websites on the smallweb.run domain are hosted using smallweb (including this one):

Since creating smallweb websites is so easy, you can even create super simple ones. For example, when I want to invite someone to the smallweb discord server, I just send him the link https://discord.smallweb.run, which maps to ~/smallweb/discord/main.ts on my vps.

export default {
    fetch: () => Response.redirect("https://discord.gg/BsgQK42qZe"),
};