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

@hypercolor/create-hc-server

v1.0.0

Published

Used by the team at Hypercolor to quickly spin up a backend express server

Downloads

7

Readme

Hypercolor Create Express Server

Table of Contents

Introduction

This tool is used by the team at Hypercolor Digital to quickly spin up a new backend server using our standard infrastructure practices. This tool uses TypeScript, Express, Postgres, AWS SQS and MongoDB.

Installation

Install this package using your package manager of choice.

  • NPM
    • npm i -g @hypercolor/create-hc-server
  • Yarn
    • yarn global add @hypercolor/create-hc-server

Usage

Step 1: Create Your New App

After installing the package, you can run the following command to create a new project.

npx create-hc-server my-server-name

Step 2: Finalize your configuration

Now that the package has been initialized, we need to either connect our datasbases and workers, or remove them from the package.

  • If you are not using an AWS SQS worker instance, delete the /src/worker directory and remove the SQS_URL_ASYNC_WORKER declaration in /src/util/config.ts.
    • open the .env file at the root of the project, and add the URL strings for your MongoDB and Postgres databases.
      • NOTE: The keys in the .env file need to exactly match the declarations in /src/util/config.ts.

Step 3: Add an API Endpoint

Visit /src/routes/api/v1/hello/get.ts to see an example of how to add a new API endpoint controller class. The pattern for this server architecture is that requests pass through a controller, into a service file to do some work, and then return back out of the same controller it was entered through.

Example:

import { Controller } from "../../../classes/controller";
import { UserService } from "../../../services/user-service";
import { Mapper } from "../../../util/mapper";

export class GetUsersController extends Controller {
  public async handleRequest() {
    const users = await UserService.getUsers();
    return Mapper.mapOutput(users, UserDto);
  }
}

Step 4: Run your server

Build your server:

nvm use && yarn build

Run your server:

yarn start

Misc Info

Toolchain

  • TypeScript
  • MongoDB
  • Postgres
  • AWS SQS
  • Express

Project Repository

Organization Repository