npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

docker-react

v1.0.2

Published

Tooling to deploy React applications with docker containers.

Readme

Docker React

CLI & base image to deploy React applications with docker containers.

Features

  • [x] Configuration
    • [x] Command-line arguments
    • [ ] Configuration file
  • [x] Lightweight nginx docker container
  • [x] CLI
    • [x] Runtime environment variable injection & validation
      • [x] Javascript
      • [ ] HTML
      • [ ] Hash file for cache invalidation
    • [ ] Application initialization
      • [ ] index.html file modification
      • [ ] Dockerfile generation
      • [ ] Schema and types generation
  • [ ] Support for serving at a path

Supported Tooling

  • Vite

Supported Validation

  • Zod

Other TODOs

  • [ ] Example projects
  • [ ] Cookbook for proxying the container with cloudflare
  • [ ] Cookbook for handling "in-the-wild" chunks
  • [ ] Research plugin possibilities with the supported tooling

Out of scope

  • Server side rendering

Implementation Instructions

  1. Install docker-react and zod (zod version should match the peer dependency version exactly)

    npm i -S docker-react [email protected]
  2. Create environment variable schema (currently only Zod supported but the future others will be available)

    // env.schema.js
    const { z } = require('zod');
    
    const envSchema = z.object({
      VITE_API_URL: z.string().uri().required(),
    });
    
    module.exports = envSchema;
  3. Add env import to your index.html head (in a future version this will be generated for you)

    <head>
      ...
      <script src="/window.env.js"></script>
    </head>
  4. Create Dockerfile (in a future version this will be generated for you). NOTE docker-react image version version must match your installed npm version of docker-react.

    FROM demery/docker-react:vX.X.X
    
    COPY env.schema.js ./env.schema.js
    COPY build /usr/share/nginx/html
    
  5. Create .dockerignore

    node_modules
    
  6. Update npm scripts (add the init-local command and run it before your local dev scripts)

    {
      "dev": "npm run init-local && vite",
      "init-local": "npx docker-react prep -s ./env.schema.js -d public"
    }

    Note if you are using a .env file the current recommended way is to use node directly.

    {
      "init-local": "node --env-file=.env ./node_modules/.bin/docker-react prep -s ./env.schema.js -d public"
    }

    There is a pending feature request for npx commands to support loading .env files directly, once it's implemented these docs will be updated accordingly. https://github.com/npm/cli/issues/7069

  7. Replace all references to environment variables with window.env, eg.

    • process.env => window.env (for create-react-app and others)
    • import.meta.env => window.env (for vite)

Local Testing Instructions

Note: This instructions are to be performed in the consuming application.

# Perform a local production build (using whichever command)
npm run build
# Build a local image tagged with local
docker build -t my-app:local .
# Run local build using the env file
docker run -p 3000:80 --env-file=.env --name=my-app my-app:local

The app should now be available at http://localhost:3000

# Cleanup
docker rm my-app && docker image rm my-app:local