Awesome Open Source
Awesome Open Source


Build Tool for Browser and Node Applications

npm version


$ npm install @sinclair/hammer -g


Create an index.html file

<!DOCTYPE html>
    <link href="index.css" rel="stylesheet" />
    <script src="index.tsx"></script>
    <img src="banner.png" />

Run Hammer

$ hammer build index.html



Hammer is a build tool for browser and node applications. It offers a command line interface to instantly run browser and node applications and provides appropriate watch and reload workflows for each. It is designed with rapid application development in mind and requires little to no configuration to use.

Hammer was written to consolidate several disparate tools related to monitoring node processes (nodemon), building from HTML (parcel), mono repository support (lerna, nx) and project automation (gulp, grunt). It takes esbuild as its only dependency and is as much concerned with build performance as it is with dramatically reducing the number of development dependencies required for modern web application development.

License MIT


Use the serve command to start a development server that reloads on save.

<!DOCTYPE html>
    <script src="index.tsx"></script>
    <h1>Hello World</h1>
$ hammer serve index.html


Use the run command to start node scripts that reload on save.

$ hammer run index.ts

$ hammer run "index.ts arg1 arg2" # use quotes to pass arguments


Use the watch command to start a compiler watch process only.

$ hammer watch worker.ts


Use the monitor command to execute shell commands on file change.

$ hammer monitor fib.ts "asc fib.ts --binaryFile fib.wasm --optimize"


Use the task command to execute javascript functions in a file named hammer.task.ts or hammer.task.js. Hammer will look for this file in the current working directory and will allow any exported function to be called though the CLI. You can use tasks to run shell commands in parallel. Hammer includes a built in shell() function for this purpose. The following runs a run and serve task in parallel.

 * file: hammer.task.js

export async function start(dist = 'target') {
    await shell([
        `hammer serve apps/website/index.html --dist ${dist}/website`,
        `hammer run apps/server/index.ts --dist ${dist}/server`
$ hammer task start


In mono repository projects, you can import shared libraries by using TypeScript tsconfig.json path aliasing.

    index.ts    ───────────┐
  /website                 │
    index.html             │
    index.ts    ───────────┤ depends on
/libs                      │
  /shared                  │
    index.ts    <──────────┘

To enable website and server to import the shared library. Configure tsconfig.json in the project root as follows.

    "compilerOptions": {
        "baseUrl": ".",
        "paths": {
            "@libs/shared": ["libs/shared/index.ts"],

Once configured the server and website applications can import with the following.

import { Foo } from '@libs/shared'


Hammer provides the following command line interface.

   $ hammer run     <entry script>   <...options>
   $ hammer build   <file or folder> <...options>
   $ hammer watch   <file or folder> <...options>
   $ hammer serve   <file or folder> <...options>
   $ hammer monitor <file or folder> <shell command>
   $ hammer task    <task>           <...arguments>
   $ hammer version
   $ hammer help


   --target      targets     The es build targets.
   --platform    platform    The target platform.
   --dist        directory   The target directory.
   --port        port        The port to listen on.
   --minify                  Minifies the output.
   --sourcemap               Generate sourcemaps.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
typescript (11,641
html (11,176
node (1,001
workflow (345
bundle (132
watch (58
tasks (48
esbuild (17