Installation

Get feature101 set up and add your first feature in under 30 seconds.

Prerequisites

feature101 works inside any existing Next.js project. Make sure you have:

Next.js 14+ with App Router enabled
TypeScript configured in your project
A PostgreSQL database with a connection string

Initialize Your Project

Optional, but recommended before your first feature. This scaffolds the shared Prisma client, auth stub, and shadcn/ui setup every primitive depends on:

npx feature101@latest init

Sets up shadcn/ui (Base UI + the Vega preset), your Prisma client, and .env.example in one step. Skipping this is fine too — addbootstraps the same shared layer automatically the first time it's needed.

Add a Feature

Run the CLI with the feature slug you want to install:

npx feature101@latest add follow

What happens when you run this

01

Copies feature files

All source files are written into features/follow/ in your project. You own every file immediately.

02

Installs npm dependencies

Runtime deps (@prisma/client, zustand, etc.) and dev deps (prisma, @types/pg) are installed automatically.

03

Installs shadcn/ui components

If shadcn/ui isn't set up yet, the CLI bootstraps it with Base UI + the Vega preset first. Then it runs npx shadcn@latest add [component] for whatever the feature needs.

04

Merges Prisma model

The feature's model block is appended to your existing prisma/schema.prisma. Your existing models are untouched.

05

Generates client and syncs the database

Runs prisma generate, then prisma migrate dev if DATABASE_URL is set in .env. Skipped silently if the env var is missing.

Generated File Structure

Running npx feature101@latest add follow creates this complete file structure in your project:

Generated output
features/follow/
├─index.tsbarrel export
├─follow.types.tsTypeScript interfacesclient
├─follow.store.tsZustand storezustand
├─follow.hooks.tsxoptimistic updatesclient
├─follow.actions.tsDB mutationsserver
components/
├─FollowButton.tsxready-to-use componentclient
lib/
├─prisma.tsshared singleton — skipped if init already ran
├─get-current-user.tstrust boundary — auth stub, skipped if init already ran
prisma/
├─schema.prismaFollow model merged inprisma
├─prisma.config.tsshared — skipped if init already ran

Database Connection

Set your database connection string in .env:

DATABASE_URL=postgresql://user:password@localhost:5432/mydb

PostgreSQL by default, any DB supported

Features ship with @prisma/adapter-pgpre-configured for PostgreSQL. Since it's Prisma under the hood, you can adapt prisma.config.ts to MySQL, SQLite, MongoDB, Neon, Supabase, PlanetScale, or any other Prisma-supported database.

DATABASE_URL must exist before the CLI runs

The CLI only runs prisma migrate dev if DATABASE_URL is present in .env at install time. If you add it after, run manually — or your app will throw table does not exist at runtime:
npx prisma migrate dev

Schema Merging

If you already have a prisma/schema.prisma, the CLI appends the new model block — it does not overwrite your file. Your existing models, datasource, and generator config are preserved.

If no schema exists yet, a new one is created with the default PostgreSQL datasource config.

Installing multiple features is safe — each model is appended independently, and the CLI won't add a model that already exists.

Usage

Import the component from the feature's barrel export and drop it anywhere in your app:

import { FollowButton } from "@/features/follow";

export default function ProfilePage() {
  return (
    <article>
      <h1>Jane Doe</h1>
      <p>Profile content...</p>

      <FollowButton targetUserId="user_xyz" showCount={true} />

    </article>
  );
}

Manual Installation

Prefer copy-paste? Every feature page has a Code tab with all files and syntax highlighting. To manually wire a feature:

1Copy all files from the Code tab into features/[slug]/ in your project
2Install the npm deps listed at the top of the feature page: npm install [deps]
3If the feature uses shadcn/ui, run npx shadcn@latest add [component]. If shadcn/ui isn't initialized yet, run npx shadcn@latest init -b base -p vega first
4Copy the Prisma model block into prisma/schema.prisma
5Run npx prisma generate then npx prisma migrate dev to sync your schema

Troubleshooting

Error: table does not exist

Cause: DATABASE_URL wasn't set when the CLI ran, so prisma migrate dev was skipped.

Fix: Add DATABASE_URL to .env, then run npx prisma migrate dev.

shadcn components look unstyled or use the wrong primitives

Cause: shadcn/ui was already initialized in this project before you started using feature101 — with Radix instead of Base UI, or without the Vega preset — so newly added components don't match.

Fix: The CLI only bootstraps shadcn/ui automatically when components.json doesn't exist yet. To switch an existing setup to Base UI + Vega, re-run npx shadcn@latest init -y -b base -p vega manually.

prisma: command not found

Cause: The prisma dev dependency wasn't installed correctly.

Fix: Run npm install -D prisma, then npx prisma generate and npx prisma migrate dev.

Cannot find module '@/features/follow'

Cause: Your tsconfig.json doesn't have the @/* path alias configured.

Fix: Add "@/*": ["./*"] to the paths section of your tsconfig.json.

Ready to browse features?

Browse the feature registry — pick your next primitive and ship it in 30 seconds.