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 🙏

© 2024 – Pkg Stats / Ryan Hefner

create-dynamic-server

v1.0.6

Published

A CLI tool for setting up a new project with the Super Dynamic Server template.

Downloads

223

Readme

create-dynamic-server

A CLI tool for quickly setting up a new project with the Super Dynamic Server template. It clones the template from a GitHub repository, installs dependencies, and prepares the project for development with hot-reloading and SCSS support.

Create project with npx create-dynamic-server

You can use this tool directly with npx:

npx create-dynamic-server my-app

or cd into folder you want to use and run

npx create-dynamic-server .
  • Installs dependencies automatically.
  • Sets up a new project without Git history.
  • untracks .env file

Features

  • Express for serving the application.
  • Webpack for bundling JavaScript and CSS.
  • Gulp for defining tasks for automating development and build workflows
  • Hot Module Replacement with Webpack for speedy development — live updates browser on edits to JS, SCSS, or CSS files in the /src directory without requiring a full page reload.
  • Nodemon to automatically restart the Express server when changes are detected in the server.js file or anything in the /api directory — ensuring that the server stays up to date during development without manual restarts.
  • Support for Vanilla JavaScript, React, and other preferred JS frameworks frameworks
  • Easy Node module imports on the front end

Configure the environment you wish to run through the env by commenting out the one you wish to use — default is development

(note: if you cloned this repo directory w/o using npx, add your .env to the .gitignore

# DEV CONFIG 
NODE_ENV='development'
PORT=3000
HOST='localhost'

# PROD CONFIG
# NODE_ENV='production'
# PORT=80
# HOST='0.0.0.0'

To Start the Development Server

npm start

or

npm run start:dev 

To generate a production-ready build, run:

npm run build

To build & run production you can uncomment prod configs and uncomment dev configs in your .env

# DEV CONFIG 
# NODE_ENV='development'
# PORT=3000
# HOST='localhost'

# PROD CONFIG
NODE_ENV='production'
PORT=80
HOST='0.0.0.0'

and run

npm start

or

npm start:prod

Folder Structure

super-dynamic-server/ 
	├── config/ # Webpack configurations │ 
		├── dev.config.js # Development mode Webpack configuration 
		│── prod.config.js # Production mode Webpack configuration 
	├── dist/ # Build folder for production, do not delete files will be generated here in dev mode
	├── public/ # Static assets (images, fonts, etc.) │ 
	├── src/ # Application client side files 
	  ├── index.js # Main JavaScript entry point │ 
		├── App.js # Example React component (can be Vanilla JS) │ 
		├── css/ 
				├── main.css # compiled / minified of CSS from SCSS files
		├── scss/ 
				├── main.scss # File that gets compiled to main.css
	│ └── index.html # HTML template used by HtmlWebpackPlugin 
	├── gulpfile.js # Gulp tasks (SCSS compilation, clean, etc.) 
	├── server.js # server entry file
	└── package.json 

Customization

Changing Front-End Frameworks

You can easily swap out React for any other front-end framework (like Vue or Angular) by replacing the relevant dependencies and modifying src/index.js and webpack.config.js accordingly.

You can modify src/index.js for your preferred framework:

Using Vanilla JavaScript

import html from "./component.html";
document.body.innerHTML = html;

Using React

import React from 'react';
import ReactDOM from 'react-dom/client';
import './css/main.css';

const App = () => <h1>Hello, React!</h1>;

const rootElement = document.getElementById('root');
const root = ReactDOM.createRoot(rootElement);

root.render(<App />);

Gulp Task Automation

The gulpfile.js includes several preconfigured tasks for SCSS compilation, cleaning the build directory, and more. Feel free to extend or modify it to suit your workflow.