Modern EDI Parser, Validator & Builder for TypeScript/JavaScript β EDIFACT & X12
Clean Architecture β’ Type-Safe β’ Business Object Mapping β’ Schema Export β’ Battle-Tested
"Like water finding its path, EDIFlow seamlessly processes EDI data across any standard, any system, any scale."
Inspired by Taoist philosophy, EDIFlow embodies four principles:
- π§ Water finds its way β Intelligent parsing that elegantly solves problems
- π Water adapts to any form β Supports EDIFACT, X12, and more with flexible architecture
- πͺ Water is powerful but gentle β Enterprise-grade performance, developer-friendly API
- π Water connects everything β Bridges between systems and standards seamlessly
Most EDIFACT libraries only parse to generic segments:
// β Other Libraries - No type safety, manual segment parsing
const bgm = message.segments.find(s => s.tag === 'BGM');
const docNumber = bgm?.elements[1]?.value; // What is element[1]? π€·EDIFlow maps to type-safe TypeScript business objects:
// β
EDIFlow - IntelliSense, type safety, business logic
const order = mapper.mapToBusinessObject(message);
console.log(order.documentNumber); // Auto-complete works! π
console.log(order.parties.buyer.id);
console.log(order.lineItems[0].productId);// Parse EDIFACT β TypeScript Object
const order = mapper.mapToBusinessObject(parsedMessage);
// Modify with type safety
order.lineItems[0].quantity = 150;
order.lineItems.push({ productId: 'PRODUCT002', quantity: 50 });
// TypeScript Object β EDIFACT
const edifact = mapper.mapFromBusinessObject(order, {...});// Generate JSON Schema for validation
const schema = exportSchemaUseCase.execute({
standard: 'EDIFACT',
version: 'D20B',
messageType: 'ORDERS',
format: 'json-schema' // or 'typescript'
});
// Validate with Ajv before sending
const ajv = new Ajv();
const validate = ajv.compile(schema);
if (validate(order)) {
sendToPartner(buildEDI(order));
}Benefits:
- β Type Safety - Catch errors at compile time
- β IntelliSense - Auto-completion for all fields
- β Validation - Validate with JSON Schema before sending
- β Testing - Easy to mock business objects
- β Documentation - Auto-generated TypeScript types
β
Type-Safe Business Objects - Map EDIFACT to TypeScript objects
β
Schema Export - Generate JSON Schema & TypeScript definitions
β
Clean Architecture - SOLID principles, testable, maintainable
β
Complete EDIFACT Support - D.96A, D.01B, D.20B, D.12A standards
β
X12 Support - 850, 810, 837, 856 and more (v0.3.0)
β
3-Phase Validation - Syntax β Structure β Business Logic
β
Envelope Support - UNH/UNT/UNB/UNZ and ISA/GS/GE/IEA
β
Well-Tested - 857 tests passing
β
Zero Config - Works out of the box
EDIFlow is published as separate NPM packages (all MIT licensed):
# 1. Install core library (required)
npm install @ediflow/core
# 2. Install EDIFACT standard(s) you need
npm install @ediflow/edifact-d96a # D.96A (1996) β 89 messages
npm install @ediflow/edifact-d01b # D.01B (2001) β 155 messages
npm install @ediflow/edifact-d20b # D.20B (2020) β 178 messages (latest)
npm install @ediflow/edifact-d12a # D.12A (2012) β 196 messages (most complete)
npm install @ediflow/eancom-2002 # EANCOM 2002 β 50 GS1 retail messages
# 3. OR: Install X12 (USA market)
npm install @ediflow/x12 # X12 Parser (850, 810, 837, 856, ...)
npm install @ediflow/x12-004010 # X12 004010 β 293 transaction sets
npm install @ediflow/x12-006040 # X12 006040 β 319 transaction sets (latest 2026)
npm install @ediflow/hipaa-x12-005010 # HIPAA 005010 β 14 healthcare transaction setsimport {
EdifactMessageParser,
EdifactDelimiterDetector,
EdifactTokenizer,
EdifactSegmentParser,
} from '@ediflow/edifact';
const parser = new EdifactMessageParser(
new EdifactDelimiterDetector(), new EdifactTokenizer(), new EdifactSegmentParser(),
);
const message = parser.parse(edifactString);
console.log(message.standard); // 'EDIFACT'
console.log(message.messageType.value); // 'ORDERS'
console.log(message.segments.length); // segment countimport { EdifactValidationServiceBuilder } from '@ediflow/edifact';
const validator = EdifactValidationServiceBuilder.forEDIFACT();
const result = validator.validate(message);
if (result.isValid) {
console.log('β
Message is valid!');
} else {
result.errors.forEach(e => console.error(`β ${e.code}: ${e.message}`));
}import { EdifactMessageBuilder, EdifactEnvelopeBuilder } from '@ediflow/edifact';
import { EDIMessage, Standard, Version, MessageType, EDISegment, EDIElement } from '@ediflow/core';
const msg = new EDIMessage('1', Standard.EDIFACT, new Version(Standard.EDIFACT, 'D.20B'), new MessageType(Standard.EDIFACT, 'ORDERS'));
msg.addSegment(new EDISegment('BGM', [new EDIElement('220'), new EDIElement('PO-001')]));
const envelopeBuilder = new EdifactEnvelopeBuilder();
const wrapped = envelopeBuilder.wrapMessage(msg, { messageRef: '1', messageType: msg.messageType, version: msg.version });
const builder = new EdifactMessageBuilder();
const edifactStr = builder.build(wrapped);
console.log(edifactStr); // Ready to send!| Package | Size | Messages | License | Use Case |
|---|---|---|---|---|
| @ediflow/core | 120 KB | - | MIT | Parser engine, use cases, domain |
| @ediflow/edifact | - | - | MIT | EDIFACT parsers & builders |
| @ediflow/x12 | - | - | MIT | X12 parsers & validators |
| @ediflow/infrastructure-shared | - | - | MIT | Repositories, loaders, cache |
| @ediflow/cli | - | - | MIT | Command-line interface |
| @ediflow/edifact-d96a | 0.32 MB | 89 | MIT | D.96A (1996) |
| @ediflow/edifact-d01b | 0.36 MB | 155 | MIT | D.01B (2001) |
| @ediflow/edifact-d20b | 1.34 MB | 178 | MIT | D.20B (2020) β Latest |
| @ediflow/edifact-d12a | 4.44 MB | 196 | MIT | D.12A (2012) β Most complete |
| @ediflow/eancom-2002 | - | 50 | MIT | EANCOM 2002 β GS1 retail |
| @ediflow/x12-004010 | 7.8 MB | 293 | MIT | X12 version 004010 |
| @ediflow/x12-006040 | - | 319 | MIT | X12 version 006040 β Latest 2026 |
| @ediflow/hipaa-x12-005010 | - | 14 | MIT | HIPAA X12 005010 β Healthcare |
Total (all packages): ~14 MB β’ 1294+ message types β’ All MIT licensed
π‘ Tip: Install only what you need. All packages are free and MIT licensed.
- Parse β EDIFACT / X12 / EANCOM string β structured
EDIMessage - Validate β 3-phase validation (Syntax β Structure β Business)
- Build β
EDIMessageβ EDI string (EDIFACT, X12) - Map β Business Object β
EDIMessagewith 5 key strategies (code,name,camelCase,snake_case,kebab-case) - Schema Export β JSON Schema & YAML from any message structure
- Envelopes β UNH/UNT/UNB/UNZ and ISA/GS/ST/SE/GE/IEA generation & parsing
- D.96A (1996) β 89 message types
- D.01B (2001) β 155 message types
- D.20B (2020) β 178 message types
- D.12A (2012) β 196 message types (most complete)
- EANCOM 2002 β 50 message types (DESADV, ORDERS, INVOIC, PRICAT, ...)
- Uses GLN (Global Location Numbers) & EAN-13 / GTIN product codes
- 004010 β 293 transaction sets (850, 810, 856, 997, ...)
- 006040 β 319 transaction sets β Latest 2026 release
- 005010 β 14 transaction sets (837P, 837I, 835, 270, 271, ...)
- US-mandated standard for healthcare transactions (HIPAA)
EDIFACT Logistics: DESADV, ORDERS, ORDRSP, RECADV, IFTMIN, IFTSTA, IFCSUM
EDIFACT Financial: INVOIC, REMADV, FINSTA, PAYMUL
EDIFACT Catalog: PRICAT, SLSRPT
EANCOM Retail: DESADV, INVOIC, ORDERS, ORDRSP, PRICAT, SLSRPT, RECADV, ...
X12 Retail/Logistics: 850 PO, 810 Invoice, 856 ASN, 997 Functional ACK
X12 Healthcare: 837P/I Claims, 835 Remittance, 270/271 Eligibility, ...
Plus: 1000+ more across all versions and standards
π See complete runnable examples on GitHub:
examples/
| Folder | Examples |
|---|---|
| examples/edifact/ | Build INVOIC, Parse ORDERS, Validate DESADV |
| examples/eancom/ | Parse DESADV (GLN/EAN-13), Validate envelope |
| examples/x12/ | Build 850 PO, Parse 850, Validate 837, Schema Export, Multi-message |
| examples/hipaa/ | Parse 837P, Validate 835 |
| examples/cli/ | All CLI commands with input/result files |
EDIFlow follows Clean Architecture (Uncle Bob) with strict layer separation:
βββββββββββββββββββββββββββββββββββββββ
β Presentation Layer β @ediflow/cli
ββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββββββββββ
β Application Layer β Use Cases, DTOs
β @ediflow/core (application/) β ParseEDI, ValidateMessage, BuildEDI
ββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββββββββββ
β Domain Layer β Entities, Value Objects
β @ediflow/core (domain/) β EDIMessage, ValidationRules
ββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββββββββββ
β Infrastructure Layer β Format-specific parsers
β @ediflow/edifact @ediflow/x12 β Shared: @ediflow/infrastructure-shared
βββββββββββββββββββββββββββββββββββββββ
Key Principles:
- β Dependencies point inward (Domain has zero deps)
- β Domain Layer is framework-agnostic
- β Use Cases orchestrate business logic
- β Dependency Injection via DIContainer
- β Repository Pattern for standard definitions
Read more: Architecture Documentation
- Quick Start Guide - Get started in 5 minutes
- Architecture - Clean Architecture explained
- Developer Guide - Contributing, testing, development
- Examples - Runnable TypeScript & CLI examples
- Release Process - How we release
- @ediflow/core - Core library
- @ediflow/edifact - EDIFACT parsers & builders
- @ediflow/x12 - X12 parsers & validators
- @ediflow/infrastructure-shared - Shared infrastructure
- @ediflow/cli - CLI tool
- Examples - Runnable examples (X12, EDIFACT, EANCOM, HIPAA, CLI)
- @ediflow/edifact-d96a - D.96A standard
- @ediflow/edifact-d01b - D.01B standard
- @ediflow/edifact-d20b - D.20B standard
- @ediflow/edifact-d12a - D.12A standard
- @ediflow/x12-004010 - X12 004010 definitions
- @ediflow/x12-006040 - X12 006040 definitions β Latest 2026
- @ediflow/eancom-2002 - EANCOM 2002 definitions
- @ediflow/hipaa-x12-005010 - HIPAA X12 005010 definitions
- EDIFACT parsing, validation, building
- 4 EDIFACT versions (D.96A, D.01B, D.20B, D.12A)
- 618 message types total
- Clean Architecture
- 599 tests
- Monorepo with format-specific packages
- X12 Parser with full ISA/GS/ST/SE/GE/IEA envelope support
- X12 Validation Rules (STRICT/LENIENT)
- Schema Export for X12 and EDIFACT via CLI
- EANCOM 2002 and HIPAA X12 005010 data packages
- Business Object Mapping + unmap (round-trip)
- 857 tests
- UNG/UNE functional groups
- More X12 transaction sets
- Performance optimizations
- SaaS Platform (EDIFlow Cloud)
- IDOC support (SAP)
- VDA support (Automotive)
- Unified API for all standards
-
EDIFlow is extensively tested with TDD (Test-Driven Development):
-
857 tests passing (Unit + Integration + E2E)
-
90%+ coverage for critical paths
-
E2E roundtrip tests across EDIFACT & X12
-
Performance tests (< 200ms parse-build-parse cycle)
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage reportWe welcome contributions! EDIFlow is MIT licensed and built by the community.
Ways to contribute:
- π Report bugs via GitHub Issues
- π‘ Suggest features
- π Improve documentation
- π§ Submit pull requests
Getting started:
- Read Contributing Guide
- Check Developer Guide
- Fork, develop, test, submit PR
- π¬ Discord: Join our community - Real-time chat & support
- π£ GitHub Discussions: Ask questions, share ideas
- π Dev.to: Technical articles & deep dives
- π Issues: Bug reports & feature requests
- Email: [email protected]
- Website: ediflow.org (coming soon)
- Downloads: Check NPM stats
- Repository: github.com/ediflow-lib/core
- Releases: See all releases
MIT License - see LICENSE for details.
Summary:
- β Commercial use allowed
- β Modification allowed
- β Distribution allowed
- β Private use allowed
- βΉοΈ License and copyright notice required
EDIFlow is built with:
- TypeScript - Type safety
- Vitest - Testing framework
- Clean Architecture - Architecture pattern by Robert C. Martin (Uncle Bob)
- UN/EDIFACT - Standards by United Nations
Special thanks to the EDI community for feedback and contributions.
Made with β€οΈ for the EDI community
| Feature | EDIFlow | edifact |
x12-parser |
|---|---|---|---|
| EDIFACT parsing | β 4 versions (D.96AβD.20B) | β | |
| X12 parsing | β 2 versions (004010, 006040) | β | |
| HIPAA X12 005010 | β 14 transaction sets | β | β |
| EANCOM | β 50 GS1 messages | β | β |
| Validation | β Structure + code lists | β | β |
| Build (JSON β EDI) | β Round-trip | β | β |
| Business Object Mapping | β Typed JSON keys | β | β |
| TypeScript (strict) | β | β (JS) | β (JS) |
| Message types | 1,000+ across all standards | ~30 | ~20 |
| CLI tool | β | β | β |
| Actively maintained | β (2026) | β (last update 2020) | β (last update 2022) |
| License | MIT | MIT | MIT |
EDIFlow is the only TypeScript library that handles multiple EDI standards with full parse β validate β build round-trip.
Status: π Production Ready
Version: 0.3.0
Released: May 2026
Maintained by: EDIFlow Contributors
β Star us on GitHub β’ π¦ View on NPM β’ π Quick Start β’ π Report Bug