Simple TypeScript project for Message Parser.
- Parses structured message input
- Validates required segments and fields
- Returns normalized JSON output
- Includes unit tests with Vitest
src/
parser/
validators/
types/
errors/
tests/
npm install
npm test
npm run typecheck- Segments are separated by new lines
- Segment fields are separated by
| - Field components are separated by
^
parseMessage(input: string): ParsedMessage
Example input and output can be added here.
- No database
- Focused on parser logic and validation
- Small, maintainable module layout
- Framework
- I would setup a framework, maybe Express or Nest.js(mostly Express due to it's flexibility)
- I would more structure the error handling to be fair with maybe something like Error categories or whatever make sense
- I would implement some runtime validation tools like Zod to catch any type mismatch
- Maybe also would like to cover logging, configuration to limit input size to guard the server and CI