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

xsh-node-api-rate-limit

v1.0.2

Published

Xendit Gateway Library for Rate Limit

Downloads

5

Readme

XSH Node API Rate Limit

![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=xendit/XSH Node API Rate Limit&identifier=212729010)

Ownership

Team: Your team

Slack Channel: #team-channel

Slack Mentions: @team-mention

Conventions

File Name

We prefer hyphens (kebab-case) this-file-name vs underscores (snake_case) this_file_name

Development

Prerequisite

  • VSCode
  • Installed Docker
  • Node LTS
  • docker-compose newer than version 1.17.3

Start development environment

  • Create .env file or run cp .env.example .env
  • Create .npmrc file or run cp .npmrc.example .npmrc

You can look for the example in the .env.example and .npmrc.example. Paste the actual token in newly created .npmrc file.

.npmrc.example will be where you would put non sensitive npm configs that you would like to be shared across your team.

Next up you can choose to run your development environment entirely inside Docker or to run the app server directly on your local machine.

Running app server inside Docker

  • Start the development cluster
docker-compose up -d
  • View consolidated logs via Docker Compose
docker-compose logs -f
  • Log into app container
# the command below will open a shell session inside our app container
docker exec -it XSH Node API Rate Limit sh
# this is for executing CLI in dev env, for i.e. DB migration command like below
npm run migration:run
  • Shutdown development cluster
docker-compose down

Running app server directly on your local machine's environment

  • Start the db service in Docker
docker-compose up -d postgres
  • Start your app server
npm run start:dev
# you might also want to migrate the DB with this command below
npm run migration:run
  • Shutdown development cluster
docker-compose down

Testing

Prerequisite

  • Installed Docker
  • Node LTS

Run the test

Tests are split into two types

  • unit: which does not requires db instance
  • integration: which requires db instance

In order to run both unit and integration test use: npm run test:all

In order to run unit test only use: npm run test

In order to run integration tests, you need to have a local postgresql running for your test environment:

# dockest runs a test postgres container for your tests and run migrations for you before starting the test
# dockest will also spin the container down automatically and all data will be wiped clean
npm run test-integration:dockest

If you want to do TDD, run the test in watch mode or simply running the test without dockest, you can spin up the test postgres containers

# Start the test postgres container
docker-compose -f docker-compose.test.yml up -d

# Update the .env file to point to ports 54320 for the test postgres container
npm run migration:run

# Run the test
npm run test

Database migration

Before continuing, please learn about the fundamentals of migration with TypeORM here

On first time setting up the DB

Run migration

npm run migration:run

If you made new changes to the db

Modifying columns in entities, or adding new entities (migration file is a class, start with CapitalLetter) Please refer to 1571751456489-Init.ts for changes to be made to the migration file to satisfy linting rules

It's a good idea to generate a new migration for every atomic changes made to the db

Generate migration

npm run migration:generate -- -n <migration-name> # eg. add-disbursement-column

If you made a mistake on running migration

Revert will revert migration file by file

Revert migration

npm run migration:revert

If you need a manual migration

For eg you need to add new extensions or simply custom migration

Create migration

npm run migration:create -- -n <MigrationName>

Deployment

  1. Go to https://buddy.tidnex.com/xendit-inc/create-project to create a new project. Click on the repository that you want to import to BuddyWorks.

  2. After you import the repository to BuddyWorks, every commit and PR that you make will trigger a CI (Continuous Integration) Test that will appear on your PR.

  3. To deploy to staging, [create a tag release](https://github.com/xendit/XSH Node API Rate Limit/releases) with the version <VERSION>rc, for example v1.0.0-rc.

  4. To deploy to production, [create a tag release](https://github.com/xendit/XSH Node API Rate Limit/releases) with the version like <VERSION>, for example v1.0.0.

For more information on the flow for deploying through Github, check out the Github Flow RFC or RFC 13 - Trident