Port reason-apollo bindings to Melange
Objective
Port the reason-apollo source files to a self-contained Melange package that can be potentially open-sourced.
Background
The original reason-apollo bindings were archived in May 2023. We'll extract just the source files and modernize them for Melange + Apollo Client 3.x.
Implementation Plan
Package Structure
packages/bindings/melange-apollo/
├── lib/
│ ├── dune
│ └── *.re (ported from reason-apollo/src/)
├── test/
│ ├── dune
│ └── *.re
├── package.json
├── dune-project
├── melange-apollo.opam
├── LICENSE (MIT)
└── README.md
Tasks
-
Create packages/bindings/melange-apollo directory structure -
Copy source files from https://github.com/apollographql/reason-apollo/tree/master/src -
Convert BuckleScript syntax → Melange -
Update bindings for Apollo Client 3.x API changes -
Create standalone dune-project file -
Add package.json for npm dependencies -
Write comprehensive tests with melange-jest -
Document as standalone package
Source Files to Port
From reason-apollo/src/:
- ApolloClient.re
- ApolloProvider.re
- ApolloQuery.re
- ApolloMutation.re
- ApolloSubscription.re
- ApolloTypes.re
- GraphQLTypes.re
- ApolloHooks.re (if exists, or create new)
Acceptance Criteria
-
Package works standalone (no dependencies on other template packages) -
Can be published to OPAM independently -
Proper package metadata for open-source release -
Works with Apollo Client 3.x -
All tests pass -
README with usage examples
Technical Configuration
(* lib/dune *)
(library
(public_name melange-apollo)
(name melange_apollo)
(libraries melange.js reason-react graphql_ppx)
(modes melange)
(preprocess (pps melange.ppx reason-react-ppx)))
// package.json
{
"name": "melange-apollo",
"version": "0.1.0",
"description": "Apollo Client bindings for Melange",
"peerDependencies": {
"@apollo/client": "^3.0.0"
}
}
Open Source Readiness
-
MIT License -
Proper attribution to original reason-apollo -
CI/CD workflow for standalone testing -
NPM publish configuration -
OPAM publish configuration
🔴 Critical
Priority: This blocks all GraphQL client functionality.
Estimated Effort: 3-4 days
Testing Strategy
- Unit tests for each binding
- Integration test with real Apollo Client
- Example app demonstrating usage
- Type safety verification
Future Considerations
- Can be extracted to separate repo
- Published to OPAM as melange-apollo
- Published to NPM as @melange/apollo-client
- Community contributions welcome