vkc-docgen-template-engine

LEE-SANG-BOK's avatarfrom LEE-SANG-BOK

Design and implement the Viet K-Connect document generation template engine (DB-driven wizard schema + PDF renderSpec + history + Storage upload). Start with 2 templates and scale linearly to 50 without hardcoding.

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 4, 2026

When & Why to Use This Skill

The VKC Docgen Template Engine is a high-performance, database-driven solution designed to automate the generation of official PDF documents. By utilizing a dynamic wizard schema and PDF render specifications, it allows organizations to scale from a few templates to dozens without hardcoding logic. This skill streamlines the entire document lifecycle—from data capture via wizard interfaces to secure cloud storage and version-controlled history—making it ideal for complex regulatory and administrative workflows.

Use Cases

  • Official Form Automation: Automatically generating complex, multi-part official documents like unified visa applications and international student work permit packages using standardized DB-driven schemas.
  • Scalable Template Management: Managing a large-scale library of up to 50+ document types through a centralized database, allowing for rapid updates and versioning without requiring code deployments.
  • End-to-End Document Workflows: Integrating user input from UI wizards with backend PDF rendering, secure Supabase storage, and signed URL delivery for a seamless document generation experience.
namevkc-docgen-template-engine
descriptionDesign and implement the Viet K-Connect document generation template engine (DB-driven wizard schema + PDF renderSpec + history + Storage upload). Start with 2 templates and scale linearly to 50 without hardcoding.
short-descriptionDocgen template engine (DB-driven)

VKC Docgen Template Engine (P1)

Goal

Generate official-form PDFs (starting with unified application + international student part-time work package) from:

  • template schema (wizard fields/steps/i18n labels)
  • renderSpec (PDF mapping)
  • deterministic generator + storage history

Non‑negotiable

  • Templates are data-driven:
    • template schema and renderSpec stored in DB (versioned)
    • code is a stable renderer/evaluator

Core data model (minimum)

  • document_templates: (docType, purpose, version, schemaJson, renderSpecJson, isActive)
  • generated_documents: history + filePath + normalizedFieldsJson + timestamps
  • Storage: Supabase private bucket + signed URL download

Schemas / specs

  • Template schema JSON:
    • .codex/skills/vkc-docgen-template-engine/references/template-schema.json
  • PDF renderSpec reference:
    • .codex/skills/vkc-docgen-template-engine/references/pdf-render-spec.md

Integration points

  • UI uses WizardKit and drives fields from schemaJson.
  • API route POST /api/documents/generate:
    • auth + 1/day limit
    • load active template
    • validate payload
    • render PDF
    • upload to private storage
    • save history row

STEP3 templates (SoT)

  • Official originals + file IDs: docs/STEP3_SOT_RESOURCES.md
  • v1 doc types
    • docgen_unified: 통합신청서(신고서)
    • docgen_parttime: 유학생 시간제취업 패키지(시간제취업확인서 + 조건부 요건 준수 확인서 + 통합신청서 선택 포함)