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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ozanarslan/corpus-cli

v0.1.0

Published

CLI for @ozanarslan/corpus

Downloads

829

Readme

@ozanarslan/corpus-cli

CLI for @ozanarslan/corpus — codegen for API clients, and scaffolding for services, controllers, models, exceptions, and full resources.

Usage

bunx @ozanarslan/corpus-cli <module> [args]

Or install as a dev dependency:

bun add -d @ozanarslan/corpus-cli
{
	"scripts": {
		"gen:api": "corpus api",
		"gen:resource": "corpus resource"
	}
}

Modules

| Module | Aliases | Description | | ------------------- | ------- | ----------------------------------------------------------------------------- | | api | — | Codegen for all routes | | service <name> | svc | Scaffold a standalone service with stubbed CRUD methods | | controller <name> | ctrl | Scaffold a standalone controller with stubbed CRUD routes | | model <name> | mdl | Scaffold a standalone model with a default CRUD-shaped interface or schema | | exception <name> | exc | Scaffold a standalone exception class with a default NotImplemented exception | | resource <name> | res | Scaffold a new resource (model, service, controller, exception) |

Run corpus <module> --help for module-specific flags.

corpus api

Generates types and model interfaces for all routes, and an API client with methods for all routes (unless disabled in config).

corpus api

Your entry file must call .listen() either at the top level or inside a single function.

corpus service <name> (svc)

Scaffolds a standalone service with stubbed CRUD methods.

corpus service <name>
corpus svc --name <name>

| Flag | Description | | -------------- | -------------------------------------------------- | | <name>, -n | Name of the service to generate | | --empty | Generate a bare service with no default CRUD shape |

This only generates the service file. Without a matching model, the stubbed methods will be untyped.

corpus controller <name> (ctrl)

Scaffolds a standalone controller with stubbed CRUD routes.

corpus controller <name>
corpus ctrl --name <name>

| Flag | Description | | -------------- | ---------------------------------- | | <name>, -n | Name of the controller to generate |

This only generates the controller file. Without a matching model and service, the stubbed routes will be untyped and just throw.

corpus model <name> (mdl)

Scaffolds a standalone model with a default CRUD-shaped interface or schema.

corpus model <name>
corpus mdl --name <name>

| Flag | Description | | -------------- | ------------------------------------------------ | | <name>, -n | Name of the model to generate | | --empty | Generate a bare model with no default CRUD shape |

This only generates the model file and does not touch any other files.

corpus exception <name> (exc)

Scaffolds a standalone exception class with a default NotImplemented exception.

corpus exception <name>
corpus exc --name <name>

| Flag | Description | | -------------- | ---------------------------------------------------------- | | <name>, -n | Name of the exception class to generate | | --empty | Generate a bare exception class with no default exceptions |

This only generates the exception file and does not touch any other files.

corpus resource <name> (res)

Scaffolds a new resource: model, service, controller, and exception together.

corpus resource <name>
corpus res --name <name>

| Flag | Description | | -------------- | ------------------------------------------------ | | <name>, -n | Name of the resource to generate | | --empty | Generate a bare model with no default CRUD shape |

Configuration

Define config with defineConfig:

import { defineConfig } from "@ozanarslan/corpus-cli";

export default defineConfig({
	main: "./src/main.ts",
	validationLibrary: "arktype",
	casing: "pascal",
	// ...
});

Options

| Option | Type | Default | Description | | ----------------------- | --------------------------------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | silent | boolean | false | Suppress console logs | | main | string | "./src/main.ts" | The server entrypoint file path; must contain your instances and .listen() call | | pkgPath | string | "@ozanarslan/corpus" | The corpus package path | | casing | "pascal" \| "camel" \| "kebab" | "pascal" | Casing for generated file and directory names | | validationLibrary | "arktype" \| "zod" \| "yup" \| null | null | Validation library to generate models with. Append a version with @ if needed (default versions: arktype 2.2.0, yup 1.7.1, zod 4.3.6) | | output | string | "./src/corpus.gen.ts" | File path where the generated API client output is written | | apiClient | ApiClientConfig | — | API client specific configuration (see below) | | exportModelsNamespace | boolean | true | Collects all models into a namespace | | exportArgsNamespace | boolean | true | Collects all args (models without the response) into a namespace | | ignoreGlobalPrefix | boolean | true | Generated method/type names ignore the global prefix by default | | defaultMethods | DefaultMethodsConfig | — | Default method names for scaffolded models, services, and controllers | | folderStructure | Partial<Record<ImportableKind, \${string}.ts`>>|"{resource}/{resource}-{kind}.ts"` | Custom output path templates per file kind (see below) |

apiClient

| Option | Type | Default | Description | | ---------------- | --------- | ------------- | -------------------------------------------------------------------------- | | disabled | boolean | false | Disables API client generation. Types and models are still generated | | exportAs | string | "CorpusApi" | Controls how the API client is exported. Set to false to skip the client | | useStaticClass | boolean | false | Makes all API client methods and properties static |

defaultMethods

Maps default CRUD method names to your own, for scaffolded models/services/controllers:

{
	get: { propertyKey: "get", address: "GET /:id" },
	getByParams: { propertyKey: "getByParams", address: "GET /" },
	create: { propertyKey: "create", address: "POST /" },
	update: { propertyKey: "update", address: "PUT /:id" },
	remove: { propertyKey: "remove", address: "DELETE /:id" },
}

folderStructure

Custom output path templates per file kind, letting you control your own folder structure. Each template is a relative path string supporting:

  • {resource} — the resource name (e.g. "user"), cased per the casing option
  • {kind} — the file kind (e.g. "service", "model", "controller", "route"), cased per the casing option

Kinds without a matching entry fall back to the default template "{resource}/{resource}-{kind}.ts". The file extension is preserved as-is and not affected by casing.

// group files by kind instead of by resource
{
	model: "models/{resource}-model.ts",
	service: "services/{resource}-service.ts",
	controller: "controllers/{resource}-controller.ts",
}