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

@kazize/create-ts-starter-1

v2.2.0

Published

TypeScript Express.js backend boilerplate on AWS Lambda

Downloads

20

Readme

Typescript Server Boilerplate on AWS Lambda

Node.js CI

Production-ready Node.js v20 TypeScript app using MongoDB. Deployable to AWS Lambda using AWS SAM.

Compatible with Node.js >=19

This project does not use experimental flags such as --es-module-specifier-resolution or any custom loaders. Instead all TypeScript files have .js extensions in their import statements.

Table of Contents

Features

  • ES2022: transpiles to ES2022 modules
  • Static Typing: TypeScript static typing using typescript
  • Hot Reloading: Concurrently Hot realoding with concurrently
  • NoSQL database: MongoDB object data modeling using Mongoose
  • Authentication and authorization: using passport
  • Validation: request data validation using Joi
  • Logging: using winston and morgan
  • Testing: unit and integration tests using Vitest
  • Error handling: centralized error handling mechanism
  • API documentation: automatic OpenAPI spec generation with decorators from tsoa, served with swagger-ui-express
  • Dependency injection: with InversifyJS
  • Package management: with Yarn
  • Environment variables: using dotenv and cross-env and AWS Secrets Manager
  • Security: set security HTTP headers using helmet
  • Santizing: sanitize request data against xss and query injection
  • CORS: Cross-Origin Resource-Sharing enabled using cors
  • Compression: gzip compression with compression
  • AWS Lambda: IaC with AWS SAM
  • CI: continuous integration with GitHub CI
  • Git hooks: with husky and lint-staged
  • Linting: with ESLint and Prettier
  • Editor config: consistent editor configuration using EditorConfig
  • Structured Commit Messages: with Commitizen
  • Commit Linting: with CommitLint

Quick start

To clone this project, run:

npx @kazize/create-ts-starter-1

or,

npm init @kazize/ts-starter-1

and follow the prompts to setup the project.

Open .env and modify the environment variables (if needed).

Make sure you have MongoDB running locally. Then:

yarn dev

More steps:

  • initialise your own fresh repository with git init

Manual Installation

Clone the repo.

Install the dependencies:

yarn install

Set the environment variables:

cp .env.example .env

Open .env and modify the environment variables (if needed).

Make sure you have MongoDB running locally. Then:

yarn dev

More steps:

  • remove the existing .git folder
  • rename the project folder from ts-starter-1 to something else, remove other references to ts-starter-1 from package.json and elsewhere.
  • initialise your own fresh repository with git init

Husky Setup

After you have initialised your own fresh git repository, install the Husky git hooks provided with project.

yarn run husky install

Now husky tasks should run on git commit.

AWS Lambda Deployment

Make sure you have AWS and SAM CLIs installed locally.

Make sure you have MongoDB running on a cloud.

(Optional) Update the following in config object in package.json if necessary.

  • s3BucketName
  • region
  • cloudFormationStackName

Create AWS Secrets Manager secrets like so:

  • ts-starter-1/prod/JWT:secret
  • ts-starter-1/prod/MONGODB_URL:url

If you change the prefix in the secrets above from ts-starter-1 to something else, then update them in sam-template.yaml as well.

Finally, run the following. Warning, this will create an S3 bucket and a CloudFormation Stack on your configured AWS account.

yarn setup

Inspirations

License

MIT