Skip to content

Shared Packages

Five packages under packages/ are shared across the API, worker, and frontend. They are referenced as workspace dependencies (workspace:*).

@tt/database

Path: packages/database/

Contains the Prisma schema, all model definitions, migrations, and seed scripts. The package does not export a JavaScript module — it is consumed indirectly:

  • The API and worker import PrismaClient from @prisma/client (generated by pnpm db:generate)
  • Migrations are applied with pnpm db:migrate

Key scripts:

bash
pnpm db:migrate    # prisma migrate dev
pnpm db:generate   # prisma generate
pnpm db:studio     # prisma studio

@tt/schemas

Path: packages/schemas/

Zod schemas and TypeScript types shared by the API (for validation) and the frontend (for form validation).

typescript
import type { Tenant, Entry, Invoice } from '@tt/schemas'

@tt/queues

Path: packages/queues/

BullMQ queue names and job data interfaces.

typescript
import { QUEUE_NAMES } from '@tt/queues'
import type { InvoiceProcessingJobData, EmailSyncJobData } from '@tt/queues'

// Queue names
QUEUE_NAMES.INVOICE_PROCESSING  // 'invoice-processing'
QUEUE_NAMES.EMAIL_SYNC          // 'email-sync'
QUEUE_NAMES.AUTOMATION          // 'automation'
QUEUE_NAMES.WEBHOOK_DELIVERY    // 'webhook-delivery'

See Queue Jobs for the full job interface definitions.

@tt/logger

Path: packages/logger/

Pino-based logger.

typescript
import { createLogger } from '@tt/logger'

const logger = createLogger({ serviceName: 'my-service' })
logger.info('Starting up')

In production (NODE_ENV=production), logs are written as structured JSON to stdout. In development, pino-pretty formats them with colours and a service tag for readability.

TT Time Tracker — Internal Documentation