Using Schema for Fixed Format File Encoding/Decoding and Error Handling

hi!
we are handling fixed format files at work (e.g. process EFT payments) and i thought it might be possible to encode/decode them using Schema. E.g. pass in
const header = { name: "test", activityDate: new Date() }

and encode this into a string in a fixed format, e.g.
HEADERtest20250613

and then decode it back to the header from the encoded value

I'm working on a POC - https://effect.website/play#f2d104ad7c7d

- Is this something Schema would be a good fit for? I thought it would, but going through it it feels a bit cumbersome so far (could also be skill issue 😄 )
- is it possible to have nicer errors, e.g. which field failed to decode and why?

thanks!
Was this page helpful?