How to build software using just vanilla JS

Modules in browser

The goal here is to export/import modern ES modules.

Typing

JavaScript built-in types can be checked using the typeof operator: boolean, number or bigint, string, symbol or object.

So typeof applied to any of your custom classes will return object. To get the actual class name, check yourInstance.constructor.name.

Your IDE can check your types by checking your JSDoc comments, which allows your IDE to check types, including your own custom types.

If you provide an API, you can even generate .dt.ts files from JavaScript files using JSDoc.

You can use TypeScript type checking in JavaScript projects and even use a jsconfig.json

Have a page containing some template or another

Define as many <template>s as your need and replace the DOM node by their cloned content.

Reload code on change

Instead of running node mycode.js, run node --watch mycode.js

Examples

APIs