All Plugins/ORM & Data Modeling/v0.1.0

Veap Taggable

Official

Polymorphic tagging trait for Veap Models with slugification, multilingual tag names, and tag-based filtering scopes.

bun add @veap/taggable

Purpose & Overview

Enables attaching multiple tags to any model through polymorphic relations, supporting tag cloud generation and quick querying.

Installation & Setup

1

Install the package

bash
bun add @veap/taggable
2

Apply trait to your domain Model

models/YourModel.ts
typescript
// models/Product.ts
import { Model } from "@veap/core/database";
import { Taggable } from "@veap/taggable";

export class Product extends Taggable(Model) {
  static table = "products";
}

// Attaching tags and querying:
const product = await Product.find("product-uuid");
await product.syncTags(["nextjs", "framework", "typescript"]);

const taggedProducts = await Product.query()
  .whereTag("nextjs")
  .withTags()
  .get();
3

Run database migrations

bash
bun run veap migrate

Keep in mind

  • Polymorphic `morphToMany` relation with the central `taggables` table.
  • Provides `syncTags(['react', 'nextjs'])` and `attachTags(['new-tag'])` methods.
  • Supports automated querying and filtering via `whereTag('react')`.

Dependencies

Veap Core

@veap/core (^0.1.0)

Required Veap Plugins
NPM Packages
  • @faker-js/faker@^9.4.0

Authors & Maintainers

Veap Core Team

Maintainer

Profile →

Specifications

License
MIT
Type
plugin
Status
official
Repository
GitHub →
veap
Preparing0%