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

code-brick

v0.2.0

Published

A framework-agnostic CLI tool for managing reusable code templates. Save, manage, and apply code snippets across projects.

Readme

🧱 Brick CLI

A framework-agnostic CLI tool for managing reusable code templates. Stop copy-pasting code between projects — save it once, use it everywhere.

The Problem

Every developer has faced this workflow:

  1. Create a new project (nest new my-app)
  2. Open an existing project with code you want to reuse
  3. Manually copy-paste files (auth module, pagination utils, config files)
  4. Adjust imports, fix paths, install missing dependencies
  5. Repeat for every new project

Brick eliminates steps 2-4 entirely.

Installation

# Install globally via npm
npm install -g code-brick

# Or with yarn
yarn global add code-brick

# Or with pnpm
pnpm add -g code-brick

# Or with bun
bun add -g code-brick

After installation, the brick command will be available globally:

brick --version

Quick Start

# 1. Initialize brick (one-time setup)
brick init

# 2. Save a folder as a reusable template
brick save my-auth ./src/auth --description "JWT authentication module"

# 3. View your saved templates
brick list

# 4. Apply a template to a new project
cd ~/new-project
brick apply my-auth ./src/auth

Commands

brick init

Initialize Brick on your system. Creates the storage directory at ~/.codebrick/.

brick init

brick save <name> [path]

Save a folder as a reusable template.

# Save current directory
brick save my-template

# Save a specific path
brick save nestjs-auth ./src/auth

# With options
brick save nestjs-auth ./src/auth \
  --description "JWT authentication for NestJS" \
  --tags auth,jwt,nestjs \
  --detect-deps

Options:

  • -d, --description <desc> — Template description
  • -t, --tags <tags> — Comma-separated tags
  • --include <patterns> — Glob patterns to include
  • --exclude <patterns> — Glob patterns to exclude
  • --detect-deps — Auto-detect dependencies from imports

brick list

List all saved templates.

brick list

# Filter by type
brick list --local
brick list --remote

# Filter by tag
brick list --tag auth

# Detailed view
brick list --detailed

Output:

  #   Name                Type    Files  Description
  ─────────────────────────────────────────────────────────────────────
  0   nestjs-auth         local   5      JWT authentication module
  1   react-modal         local   3      Animated modal with backdrop
  2   docker-dev          local   4      Docker Compose dev setup

  3 templates (3 local, 0 remote)

💡 Tip: Use the index number (0, 1, 2) instead of the full name in any command!

brick tree <name|index>

Display the file structure of a template.

# By name
brick tree nestjs-auth

# By index
brick tree 0

# With file sizes
brick tree 0 --size

Output:

nestjs-auth
├── guards/
│   └── jwt.guard.ts
├── strategies/
│   └── jwt.strategy.ts
├── auth.controller.ts
├── auth.module.ts
└── auth.service.ts

5 files, 2 directories

brick apply <name|index> [destination]

Apply a template to your project.

# Apply to current directory
brick apply nestjs-auth

# Apply by index
brick apply 0 ./src/auth

# With options
brick apply 0 --force --latest

Options:

  • -f, --force — Overwrite existing files without prompting
  • --skip-existing — Skip files that already exist
  • --dry-run — Preview changes without writing files
  • --latest — Use @latest for all dependency versions
  • --no-deps — Skip dependency installation prompts

brick info <name|index>

Show detailed information about a template.

brick info nestjs-auth
brick info 0

brick size [name|index]

Show the size of templates.

# Show all template sizes
brick size

# Show specific template size
brick size nestjs-auth
brick size 0

Output (all templates):

  #   Name                Type    Files      Size
  ─────────────────────────────────────────────────────────────────────
  0   nestjs-auth         local   5          12.4 KB
  1   react-modal         local   3          8.2 KB
  2   docker-dev          local   4          3.1 KB

Total: 12 files, 23.7 KB

Output (single template):

nestjs-auth

  Files:       5
  Directories: 2
  Total Size:  12.4 KB

brick add <name|index> <files...>

Add files to an existing template.

# Add a single file
brick add nestjs-auth ./src/auth/dto/login.dto.ts

# Add by index
brick add 0 ./src/auth/dto/*.ts

# Add a directory
brick add 0 ./src/auth/decorators/

brick remove-file <name|index> <files...>

Remove files from a template.

brick remove-file nestjs-auth auth.controller.ts
brick remove-file 0 dto/

brick delete <name|index>

Delete a template entirely.

brick delete nestjs-auth

# By index
brick delete 0

# Skip confirmation
brick delete 0 --force

brick clean <name|index>

Remove local/project-specific imports from template files. This makes templates portable by stripping out imports that reference the original project.

# Clean a template (auto-detects project name)
brick clean flutter-clean

# By index
brick clean 0

# Preview what will be removed (dry run)
brick clean 0 --dry-run

# Use custom pattern
brick clean 0 --pattern "package:my_app/"

# Also remove external packages (not recommended)
brick clean 0 --no-keep-external

Options:

  • -p, --pattern <regex> — Custom regex pattern to match imports to remove
  • --dry-run — Preview changes without modifying files
  • --no-keep-external — Also remove external package imports

Example (Flutter/Dart):

Before cleaning:

import 'package:my_app/features/auth/login.dart';
import 'package:my_app/core/utils/helpers.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

After brick clean flutter-template:

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

Supported languages:

| Language | Local Imports Removed | External Imports Kept | | --------------- | ---------------------------------- | ---------------------------------- | | Dart/Flutter| package:project_name/... | package:flutter/, package:go_router/, etc. | | TypeScript/JS | ./path, ../path | react, lodash, express, etc. | | Python | from .module, from .. | from flask, import requests | | Rust | use crate::, use super:: | use std::, external crates |

The command auto-detects the project name from pubspec.yaml, package.json, or pyproject.toml.

brick export <name|index>

Export a template as a shareable .brick file. Perfect for sharing templates with teammates or between machines.

# Export to current directory
brick export nestjs-auth

# By index
brick export 0

# Specify output path
brick export 0 --output ~/Desktop/my-auth.brick

Options:

  • -o, --output <path> — Output file path (default: ./<name>.brick)

Example output:

┌ 🧱 Exporting template
│  ● Template: nestjs-auth
│  ● Files: 5 files
│  ● Output: /Users/you/nestjs-auth.brick
│
│  ◇ Export complete!
│    Size: 12.34 KB
│
│  Share this file and import with:
│    brick import nestjs-auth.brick
└

brick import <file>

Import a template from a .brick file.

# Import from .brick file
brick import nestjs-auth.brick

# Import with custom name
brick import nestjs-auth.brick --name my-auth-v2

# Force overwrite existing template
brick import nestjs-auth.brick --force

Options:

  • -n, --name <name> — Custom name for the imported template
  • -f, --force — Overwrite existing template without prompting

Example output:

┌ 🧱 Importing template
│  ● File: /Users/you/nestjs-auth.brick
│  ● Template: nestjs-auth
│  ● Description: JWT authentication module
│  ● Files: 5 files
│
│  ◇ Import complete!
│
│  View structure: brick tree nestjs-auth
│  Apply template: brick apply nestjs-auth
└

Smart Ignore System

Brick automatically ignores common dependency directories, build outputs, and generated files across all frameworks. This keeps your templates clean and portable.

Ignored Directories

| Framework | Automatically Ignored | | ------------- | ------------------------------------------------------------------- | | Node.js | node_modules/, .npm/, .yarn/, .pnpm-store/ | | Python | __pycache__/, .venv/, venv/, .pytest_cache/, .mypy_cache/ | | Flutter | .dart_tool/, .pub-cache/, build/, .flutter-plugins* | | Rust | target/ | | Go | vendor/ | | Java | .gradle/, .idea/, out/, build/ | | iOS | Pods/, .symlinks/, DerivedData/ | | .NET | bin/, obj/, packages/ | | Build | dist/, build/, .next/, .nuxt/, .output/, .vercel/ | | Cache | .cache/, .temp/, .turbo/, coverage/ | | VCS | .git/, .svn/, .hg/ | | IDE | .idea/, .vscode/ (settings, not launch configs) |

Ignored Files

| Category | Files | | ------------ | ------------------------------------------------------------------ | | Locks | package-lock.json, yarn.lock, pnpm-lock.yaml, Podfile.lock | | Env | .env, .env.local, .env.production, .env.* | | OS | .DS_Store, Thumbs.db, desktop.ini | | Logs | *.log, npm-debug.log*, yarn-debug.log* | | Metadata | brick.json (template metadata) |

This means when you save a template, you get only the source code — no bloat:

# Before smart ignore (hypothetical)
flutter-app: 1,247 files, 89.2 MB  ❌

# With smart ignore (actual)
flutter-app: 42 files, 156 KB      ✅

Framework Agnostic

Brick works with any language or framework since it operates at the file level:

| Category | Examples | | -------------- | ---------------------------------------------------- | | Frontend | React, Vue, Angular, Svelte, Solid, Astro | | Backend | NestJS, Express, FastAPI, Django, Rails, Spring Boot | | Mobile | React Native, Flutter, Swift, Kotlin | | Languages | TypeScript, JavaScript, Python, Go, Rust, Java, C# | | Infrastructure | Terraform, Pulumi, Docker, Kubernetes configs | | Other | Markdown docs, config files, shell scripts |

Storage Location

Templates are stored locally at:

~/.codebrick/
├── config.json      # Configuration
├── store.json       # Template registry
└── templates/       # Actual template files
    ├── nestjs-auth/
    ├── react-modal/
    └── ...

Examples

Save a NestJS Auth Module

# From your existing project with a working auth implementation
cd ~/projects/my-backend
brick save nestjs-auth ./src/auth \
  --description "JWT authentication with Passport" \
  --tags nestjs,auth,jwt,passport \
  --detect-deps

Apply to a New Project

# Create new project
nest new my-new-api
cd my-new-api

# Apply the auth template (by index or name)
brick apply 0 ./src/auth

# Install dependencies (brick will show you the command)
npm install @nestjs/jwt @nestjs/passport passport-jwt bcrypt

Save React Components

brick save react-modal ./src/components/Modal \
  --description "Animated modal with backdrop" \
  --tags react,modal,ui,animation

Save Flutter Clean Architecture

brick save flutter-clean ./lib \
  --description "Clean architecture with BLoC" \
  --tags flutter,bloc,clean-architecture

Save Docker Configs

brick save docker-dev ./docker \
  --description "Docker Compose development setup" \
  --tags docker,devops

Quick Operations with Index

# List templates
brick list
#   0   nestjs-auth
#   1   react-modal
#   2   flutter-clean

# Use index for faster operations
brick tree 0
brick info 1
brick apply 2 ./lib
brick size 0
brick clean 2          # Remove local imports
brick delete 1 --force

Share Templates with Your Team

# Export a template to share
brick export nestjs-auth
# Creates: nestjs-auth.brick (shareable file)

# Send the .brick file to your teammate, then they run:
brick import nestjs-auth.brick

# Or import with a custom name
brick import nestjs-auth.brick --name company-auth

Contributing

Contributions are welcome! Please open an issue or submit a pull request.