This feature adds transaction categorization capabilities to the NexaFx-js application, enabling analytics and user insights through organized transaction data.
- Transaction Categories Table: Stores category definitions with keywords and merchant tags
- Category ID Column: Added to transactions table as nullable foreign key
TransactionCategoryEntity- Defines category structure- Updated
TransactionEntitywith categoryId relationship
Retrieve all transaction categories
Response:
{
"success": true,
"data": [
{
"id": "uuid",
"name": "Bills",
"description": "Utility bills and recurring payments",
"keywords": ["electricity", "water", "internet"],
"merchantTags": null,
"createdAt": "2026-01-28T00:00:00.000Z",
"updatedAt": "2026-01-28T00:00:00.000Z"
}
]
}Create a new transaction category
Request Body:
{
"name": "Shopping",
"description": "Retail purchases",
"keywords": ["amazon", "walmart", "store"],
"merchantTags": ["retail", "ecommerce"]
}Assign a category to a transaction
Request Body:
{
"categoryId": "uuid-of-category"
}The existing /transactions/search endpoint now supports filtering by category:
GET /transactions/search?categoryId=uuid&status=SUCCESS
Run the database migration to create tables and columns:
npm run build
# Then run your TypeORM migration commandMigration file: src/database/migrations/xxxxxx-create-transaction-categories.ts
- Rule-based automatic categorization using keywords and merchant tags
- Category assignment history tracking
- Analytics dashboards using categorized data
- Machine learning-based categorization suggestions
Use the provided test script:
node test-categories.jsReplace YOUR_TRANSACTION_ID_HERE with an actual transaction ID from your database.