How leoincode/validate-ticket works
Project type and purpose
• This is a backend API service (not a full-stack app) whose sole purpose is to validate bank-slip and dealership-slip codes and return parsed information (barCode, amount, expirationDate).
• It follows a layered, “clean” or hexagonal architecture (ports & adapters) implemented in Node.js + TypeScript + Express, with TDD via Jest.
File structure
• Top-level entry points:
– server.ts / app.ts – bootstraps the Express server
– routes/fetlock.ts – defines the HTTP endpoint(s)
• src/01.api – Express controllers that handle HTTP and call application use cases
• src/02.application – core business logic divided into:
– common/exceptions & common/helpers – reusable validators & calculators
– useCases/bankSlip & useCases/dealershipSlip – specific domain workflows, factories & helpers
• src/03.infra – technical adapters (e.g., dateTransform using date-fns)
• tests – mirrors the three layers (01.api, 02.application, 03.infra) for unit & integration tests
README for additional insights
• Describes supported slip types, success & error responses, external dependency (date-fns)
• Confirms Node.js, TypeScript, Express, Jest TDD