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 🙏

© 2025 – Pkg Stats / Ryan Hefner

initapi

v0.6.0

Published

A tool for creating API and typings

Readme

Features

  • Code as Document
  • Standardized, unified team style, easy to maintain
  • Tool generates code to reduce coding and improve efficiency
  • If the backend uses Swagger or Openapi3 specifications, it can be accessed at zero cost

Install

pnpm i initapi -D

Usage

configure api.config.ts or api.config.js

import { defineConfig } from "initapi";
// you can use the `defineConfig` helper which should provide intellisense without the need for jsdoc annotations:
export default defineConfig({
  // Path related configurations are all based on the working directory of the nodejs process
  // Supports Openapi3 and Swagger specifications, with content created based on specified JSON
  service: {
    pets: {
      url: "https://petstore.swagger.io/v2/swagger.json",
    },
    platform: {
      url: "http://127.0.0.1:3000/api-json",
      commonPrefix: "/api/v1",
    },
    // Can convert local JSON
    local: {
      url: "./assets/openapi.json",
      // API address public prefix, used to generate class names and file names. When not configured, it will automatically attempt to find the public prefix
      commonPrefix: "/mg/api",
    },
  },
  outputDir: "./src/api",
  outputType: "TypeScript",
  // ...
});
// package.json
"scripts": {
  "api": "initapi create"
}
pnpm run api

Generate API Workflows Example

Generate API Workflows Example

Generate API content example

Generate API content example

Generate Type content example

Generate Type content example

Configure

Detailed configuration items for defineConfig

| Name | Description | Type | Required | Default | | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | -------- | ---------------------------- | | importRequest | Import axios or axios encapsulation | string | No | 'import axios from "axios";' | | useRequest | Using axios | string | No | 'axios.request' | | service | The JSON (swagger/openapi3specification) file address corresponding to the API service | object | Yes | — | | outputDir | Output file storage location | string | No | './api' | | outputType | Output File Type - When there is no configuration, a command line interaction will pop up for selection | TypeScript or JavaScript | No | — | | definition | How to define types | class or interface | No | interface | | indexable | The advantage of using index signature is that it can add any number of attributes, making interface or class more flexible; The disadvantage is that it may cause uncertainty in the value type of the attribute | boolean | No | false | | enumMode | How to define enumeration (enum: generate enumeration type. type: generate type alias.) | enum or type | No | type | | multipleFiles | Enable multi file mode - single file only creates API files. Multiple files will split the API into all controllers and generate corresponding files | boolean | No | true |

Prettier

Before creating a file, by default, the data will be formatted using a prettier

When the project root directory has a. prettier file, the default configuration will be used for file formatting. If obtaining the file fails, the built-in prettier will be used to format the default configuration:

const defaultOptions: prettier.Options = {
  parser: "typescript",
  printWidth: 130,
  tabWidth: 2,
  useTabs: false,
  semi: true,
  singleQuote: false,
  quoteProps: "as-needed",
  jsxSingleQuote: false,
  trailingComma: "all",
  bracketSpacing: true,
  bracketSameLine: true,
  jsxBracketSameLine: true,
  arrowParens: "avoid",
  rangeStart: 0,
  rangeEnd: Infinity,
  requirePragma: false,
  insertPragma: false,
  proseWrap: "preserve",
  htmlWhitespaceSensitivity: "ignore",
  endOfLine: "auto",
}

Git commit

  • 💍 test: Adding missing tests
  • 🎸 feat: A new feature
  • 🐛 fix: A bug fix
  • 🤖 chore: Build process or auxiliary tool changes
  • ✏️ docs: Documentation only changes
  • 💡 refactor: A code change that neither fixes a bug or adds a feature
  • 💄 style: Markup, white-space, formatting, missing semi-colons...
  • 🎡 ci: CI related changes
  • ⚡️ perf: A code change that improves performance

Last

Welcome to provide feedback and contribute code.

License

MIT