← All Plugins/ORM & Data Modeling/v0.1.0Official

Veap Taggable

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

bun add @veap/taggable
[See clean architecture layers, Knex migrations & configuration below]

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/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

Start application

bash
bun dev

Migrations run automatically on boot via MigrationServiceProvider.

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 Kernel

@veap/kernel (^0.1.0)

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

Authors & Maintainers

Veap Core Team

Maintainer

Profile →

Links & Source

veap
Preparing0%