Add Blocks
Add production-ready backend blocks to your project.
The add command downloads a backend block from the Blockend registry and installs it directly into your project.
Each block is framework-aware, TypeScript-first, and follows your project's existing configuration defined in blockend.json.
npx blockend add <block>For example:
npx blockend add authIf no block name is provided, Blockend launches an interactive block picker.
npx blockend addHow It Works
When you run the command, Blockend performs several steps automatically.
- Finds your
blockend.jsonconfiguration. - Connects to the Blockend Registry.
- Retrieves all blocks available for your framework.
- Lets you select a block (if one isn't provided).
- Detects the appropriate storage variant.
- Installs missing dependencies.
- Downloads the block source code.
- Writes the files into your configured blocks directory.
Everything happens automatically—no copying files or manually installing packages.
Interactive Block Selection
Running the command without a block name opens an interactive selector.
npx blockend addExample:
? Which backend block would you like to inject?
❯ auth
pagination
upload
cache
loggerOnly blocks compatible with your configured framework are displayed.
Framework Aware
Every block is generated specifically for your backend framework.
Currently supported environments include:
- Express.js
- Fastify
- Next.js (App Router)
- Hono
If a block is unavailable for your framework, Blockend will notify you before downloading anything.
Storage Variants
Some blocks support multiple storage implementations.
For example:
- Memory
- Redis
- Database
If multiple variants are available, Blockend asks which implementation you want.
? Which architectural storage variant do you want?
❯ Memory
RedisIf Redis is enabled in your blockend.json, the Redis variant is selected automatically whenever available.
Automatic Dependency Installation
Many backend blocks require external packages.
Before downloading a block, Blockend checks your project's dependencies.
If required packages are missing, you'll be prompted to install them.
Example:
Missing required infrastructure packages:
- redis
- zod
Would you like the CLI to install them automatically?
❯ YesBlockend automatically detects your package manager.
Supported package managers:
- pnpm
- npm
After installation completes, the block download continues automatically.
Generated Files
Downloaded files are placed inside the blocks directory configured during initialization.
Example:
src/
└── blocks/
└── auth/
├── auth.ts
└── store-redis.tsSimple blocks may generate a single file.
src/
└── blocks/
└── pagination.tsExisting Files
If a block already exists, Blockend never overwrites it without confirmation.
Example:
Block component already exists.
Overwrite existing files?
❯ NoSelecting No safely aborts the operation and preserves your code.
Examples
Generate an authentication block:
npx blockend add authGenerate a pagination block:
npx blockend add paginationGenerate an upload block:
npx blockend add uploadOpen the interactive selector:
npx blockend addRequirements
Before using the add command, make sure your project has been initialized.
npx blockend initBlockend also requires:
- A valid
blockend.json - A TypeScript project
- A supported backend framework
- Internet access to download blocks from the Blockend Registry
Common Errors
blockend.json not found
blockend.json not found.
Run 'npx blockend init' first.Initialize your project before adding blocks.
npx blockend initBlock not found
Block "auth" does not exist.The requested block either doesn't exist or hasn't been published yet.
Run the interactive command to see all available blocks.
npx blockend addUnsupported Framework
The block "upload" does not support your environment.Some blocks are framework-specific and may not be available for every backend.
Failed to Download Registry
Failed to fetch the component registry.Verify your internet connection and try again.
Next Steps
After generating a block, import it into your application and customize it as needed.
Every generated block is fully owned by you—there are no runtime dependencies on Blockend.