A modern CLI tool for super seamlessly adding UI components to your Next.js projects.
- Rust installed on your system
- Cargo (comes with Rust)
- A Next.js project where you want to add components
- Clone the repository
git clone https://github.com/vin-dKR/vin-ui-cli
cd vin-ui- Build and install the CLI
cargo build --release
cargo install --path .- Verify installation
vin-ui --helpYou should see the VIN-UI help message with available commands.
Before adding components, initialize your Next.js project:
cd your-nextjs-project
vin-ui initThis will create the necessary directory structure:
components/ui/- Where UI components will be installedlib/utils.ts- For utility functions that components may need
To see what components are available to install:
vin-ui listThis will show all components in the templates directory, along with their dependencies and required utilities.
To add a component to your project:
vin-ui add ButtonThe CLI will:
- Copy the component file to your
components/ui/directory - Offer to install any required dependencies
- Add any necessary utility functions to
lib/utils.ts
You can expand the template library with your own components:
- Create your component file in the
templates/directory:
templates/MyComponent.tsx
- (Optional) Create a configuration file with the same name:
templates/MyComponent.json
The configuration file should follow this format:
{
"name": "MyComponent",
"dependencies": [
"framer-motion",
"other-dependency"
],
"utils": [
"cn",
"other-utility"
]
}- Add any utility functions to
templates/utils/:
templates/utils/my-utility.ts
- Create component families: Group related components together with consistent naming (e.g.,
Form,FormInput,FormLabel) - Document component dependencies: Always create configuration files with proper dependencies
- Use consistent styling: Ensure your components follow the same styling approach (e.g., Tailwind CSS)
- Test components before adding: Make sure your template components work properly before adding them to the templates directory
If vin-ui command is not found after installation:
- Make sure Cargo's bin directory is in your PATH:
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc- Try reinstalling:
cargo install --force --path .If a component can't be found when using vin-ui add:
- Check that the component exists in the templates directory
- Ensure the filename matches exactly (case-sensitive)
- Run
vin-ui listto see available components
If dependency installation fails:
- Make sure you have a working internet connection
- Try installing the dependency manually:
npm install <dependency-name>oryarn add <dependency-name> - Check if the dependency exists in the npm registry
Contributions are welcome! Here's how you can contribute:
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin feature/my-feature - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.