Yarnin Peled YP Monogram Logo
Yarnin Peledponyapp.net
Back to All ApplicationsTECHNICAL REFERENCE — PART 2

Book a Show Technical Reference

Architecture, Data Model, Workflow Rules & Integration Surface

The shape of the app for developers and technical evaluators — database schemas, Next.js App Router architecture, 8-stage bid workflow pipeline, partner API specification, and source-level quality gates.

Platform & Architecture Choices

Core architectural decisions driving performance, security, and document fidelity:

Next.js App Router

TypeScript codebase with React Server Components by default and targeted Client Components for interaction.

PostgreSQL & Prisma ORM

16 data models and 9 enums powered by Prisma via the Postgres driver adapter for type-safe database queries.

NextAuth & Scrypt Security

JWT session management with separate credentials providers for Staff (email) and Producers (Company Reg ID).

Dual PDF Generation Engine

Browser HTML->Canvas->PDF for signed documents (capturing exact signature layout); server headless browser for previews.

Build-Time Bidi Locale

Full bidirectional (RTL and LTR) support driven by build-time constant, eliminating missing translation key runtime errors.

Nodemailer SMTP Engine

Direct SMTP email delivery with every email template editable in the admin panel.

Database Topology (16 Models & 9 Enums)

PostgreSQL database schema structured into 5 logical domain groups:

3.1 Identity and Access

User

Venue staff. Role is ADMIN (pricing, user management, API keys) or VIEWER (operations). Scrypt password hash.

Producer

Counterparty. Company name, registration ID (login ID, unique), contact person, email, phone, password hash.

Account, Session, VerificationToken

NextAuth standard authentication tables.

3.2 The Calendar

CalendarDate

One row per day. Status is OPEN, OPEN_CANCELLABLE, BLOCKED, PENDING, or ASSIGNED.

DateRange

Contiguous run of days a producer asked for. Carries range status and optional document folder.

DateRangeItem

Join row linking DateRange to each CalendarDate it covers.

3.3 Requests & Pricing

Bid

Central record: artist, show type, status, frozen price snapshot, document timestamps.

BidCostLine

Free-text additional cost lines on a bid, ordered.

PricingChangeLog

Audit trail of every change to global rates with who and when.

SystemConfig

Key/value settings: rates, calendar window, storage path, SMTP, contracting entity.

3.4 Documents

Document

File attached to a bid (COMMITMENT, FINAL_AGREEMENT, DRAFT_OBLIGATION, CONTRACT, SIGNED_RETURN, OTHER).

DocumentTemplate

Admin-editable wording: built-in default -> venue override -> per-booking override.

3.5 Integration

ApiKey

Credential for downstream system stored as SHA-256 hash with clear prefix, expiry, and lastUsedAt.

SyncLog

Results of external calendar synchronisation runs.

8-Stage Bid Workflow Pipeline

State progression matrix for requests, holds, and assigned dates:

Bid StatusWorkflow MeaningCalendar Days State
SUBMITTEDRequested, competing for datesNo
DOCS_READYCommitment form prepared, not sentNo
AWAITING_SIGNATUREForm sent, awaiting producerYes — PENDING
DOCS_RETURNEDProducer signed, awaiting staffYes — PENDING
APPROVEDConfirmed by venue staffYes — ASSIGNED
REJECTEDNever finalisedNo
CANCELLEDReversed after being promisedNo
ESCALATEDPassed to next-ranked candidateNo

Read-Only Partner API Specification (`/api/v1`)

Exposes contracted shows to downstream finance, ERP, and document management systems:

GET/api/v1/shows

Contracted shows, filterable by date overlap, paginated

GET/api/v1/shows/{id}

One contracted show details and cost breakdown

GET/api/v1/shows/{id}/agreement

The signed final agreement PDF document

Security & Scope Rules:

Strict Scope Isolation: Only shows with a signed final agreement are visible. Uncontracted draft bookings return 404.
Bearer API Key Security: API keys are shown once and stored SHA-256 hashed with instant revocation.
Rate Limiting: 120 requests per minute per key applied post-authentication with rate-limit response headers.
Freeze-on-Quote Figures: Reported amounts come from the frozen rate snapshot, ensuring 100% financial audit accuracy.

9 Quality Gate Assertion Check Suites

Source-level automated check suites executing on every change:

check:templates

Every template's fields and defaults resolve without errors

check:storage

Uploaded files cannot escape the designated storage root

check:dates

Date-span labels render accurately across month and year boundaries

check:agreement

Default -> template -> per-booking override layering functions correctly

check:pricing

Day counts, night teardown, and discount ordering evaluate precisely

check:signature

The signature is embedded into document canvas, not stamped on after

check:api

Partner API authentication, scope limits, and rate limiting behave strictly

check:schedule

Calendar availability vs revokable booking statuses stay 100% distinct

check:boundary

No client component imports a server-only module that reaches the database