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

@nilejs/cli

v0.0.7

Published

CLI for scaffolding and generating Nile backend projects

Readme

@nilejs/cli

NPM Version

CLI for scaffolding and generating Nile backend projects.

Install

bun add -g @nilejs/cli
npm install -g @nilejs/cli

Or use without installing:

bunx @nilejs/cli new my-app
npx @nilejs/cli new my-app

Commands

nile new <project-name>

Scaffold a new Nile project. Copies the project template, replaces placeholders with your project name, and prints next steps.

nile new my-app

Output:

Creating project: my-app

  Copying project files...
  Configuring project...
  Project "my-app" created.

Next steps:

    cd my-app
    bun install
    cp .env.example .env
    bun run dev

The scaffolded project includes:

  • src/index.ts, server entry with PGLite and Drizzle
  • src/db/, database client, schema, types, and a tasks model using createModel
  • src/services/, a tasks service with five CRUD actions
  • drizzle.config.ts, .env.example, tsconfig.json, package.json

nile generate service <name>

Alias: nile gen service <name>

Generate a new service directory under src/services/ with a demo action and barrel export. Run this from the project root.

nile gen service users

Creates:

src/services/users/
  sample.ts       # Demo action with Zod schema, handler, and createAction
  index.ts        # Barrel export

After creating the files, the CLI asks whether to auto-register the service in src/services/services.config.ts. If you accept, it adds the import and service entry. If you decline, it prints the snippet to add manually.

nile generate action <service-name> <action-name>

Alias: nile gen action <service-name> <action-name>

Generate a new action file in an existing service directory.

nile gen action users get-user

Creates src/services/users/get-user.ts with:

import { type Action, createAction } from "@nilejs/nile";
import { Ok } from "slang-ts";
import z from "zod";

const getUserSchema = z.object({
  // Define your validation schema here
});

const getUserHandler = async (data: Record<string, unknown>) => {
  // Implement your users.get-user logic here
  return Ok({ result: data });
};

export const getUserAction: Action = createAction({
  name: "get-user",
  description: "GetUser action for users",
  handler: getUserHandler,
  validation: getUserSchema,
});

Kebab-case names are converted to camelCase for variables and PascalCase for types.

nile generate schema

Alias: nile gen schema

Extract Zod validation schemas from your action definitions and generate TypeScript files with schema exports and inferred types.

nile gen schema

The command auto-detects src/services/services.config.ts. If the file is not found, it prompts for the path. It spawns a bun subprocess to import your services config, extracts JSON Schema from each action's validation field, and converts them back to Zod code strings.

Output (default src/generated/):

  • schemas.ts — named Zod schema exports (tasksCreateSchema, tasksUpdateSchema, etc.)
  • types.ts — TypeScript types via z.infer (TasksCreatePayload, TasksUpdatePayload, etc.)

Options:

| Flag | Description | |---|---| | -e, --entry <path> | Path to services config (auto-detected by default) | | -o, --output <path> | Output directory (default: src/generated) |

Actions without a validation schema are skipped and listed in the CLI output.

Requires Bun installed for the extraction subprocess.

Quick Reference

| Command | Description | |---|---| | nile new <name> | Scaffold a new project | | nile gen service <name> | Add a service with a demo action | | nile gen action <service> <name> | Add an action to an existing service | | nile gen schema | Generate Zod schemas and TypeScript types |

Generated Project Structure

my-app/
  package.json
  tsconfig.json
  drizzle.config.ts
  .env.example
  src/
    index.ts
    db/
      client.ts
      schema.ts
      types.ts
      index.ts
      models/
        tasks.ts
        index.ts
    services/
      services.config.ts
      tasks/
        create.ts
        list.ts
        get.ts
        update.ts
        delete.ts

Requirements

  • Node.js 18+ or Bun
  • The scaffolded project uses Bun as its runtime (Bun.serve, bun run)

License

MIT