Setup guide for Reflaxe.Elixir development with lix package management and dual-ecosystem workflows.
- Node.js 16+ - For lix package management and npm scripts
- Elixir 1.14+ - For Phoenix/Ecto ecosystem and generated code testing
- Git - For repository cloning and dependency management
# Verify prerequisites
node --version # Should be 16.0.0 or higher
elixir --version # Should be 1.14.0 or higher
git --version # Any recent versiongit clone <repository-url>
cd reflaxe.elixir# Install all Node.js dependencies (including lix)
npm installThis automatically installs:
- lix - Modern Haxe package manager
- Local project dependencies for build orchestration
# Check lix is available
npx lix --version
# Check Haxe is available
haxe --version
# If `haxe` is not on your PATH, use the project-local shim (provided by `lix` + `.haxerc`):
./node_modules/.bin/haxe --versionExpected Output:
Haxe Compiler 4.3.7
# Download the pinned toolchain + libraries (per `.haxerc` + `haxe_libraries/*.hxml`)
npx lix downloadThis ensures the compiler/test/example dependencies are available (for example tink_macro, tink_parse, and other tink_* libs).
# Install Phoenix, Ecto, and other Elixir dependencies
mix deps.get# Run comprehensive test suite
npm testThis should complete without failures.
Reflaxe.Elixir has a source mapping design (to map generated .ex back to .hx), but it is
currently experimental and not fully wired end‑to‑end in the AST pipeline.
See docs/04-api-reference/SOURCE_MAPPING.md for the current status and next steps.
❌ Traditional Haxe Installation Problems:
- Global Haxe versions cause "works on my machine" issues
- Different projects need different Haxe versions
- Library version conflicts between projects
- Manual dependency management
✅ lix Package Manager Benefits:
- Project-specific Haxe versions defined in
.haxerc - Locked dependency versions in
haxe_libraries/ - GitHub + haxelib sources for latest libraries
- Zero global conflicts between projects
{
"version": "4.3.7",
"resolveLibs": "scoped"
}Pins the Haxe compiler version and enables scoped library resolution for lix.
Pins Haxe library versions and classpaths for reproducible builds (managed by lix).
{
"scripts": {
"test": "npm test",
"test:quick": "npm run test:quick",
"test:examples": "npm run test:examples"
}
}This repo uses lix to manage the Haxe toolchain (via .haxerc) and Haxe libraries (via haxe_libraries/*.hxml).
Use either a normal haxe install on your PATH or the lix-provided shim at ./node_modules/.bin/haxe.
# ✅ Correct
haxe build.hxml
haxe --version
# ✅ Also correct (lix shim)
./node_modules/.bin/haxe build.hxml
./node_modules/.bin/haxe --version# Compile a simple example
cd examples/01-simple-modules
haxe BasicModule.hxml
# Run full tests
npm testReflaxe.Elixir’s source mapping design (mapping generated .ex back to .hx) is currently
experimental and not yet fully wired end‑to‑end in the AST pipeline.
See docs/04-api-reference/SOURCE_MAPPING.md for the current status and next steps.
# 1. Start file watcher
mix haxe.watch
# 2. Make changes to Haxe files
vim src_haxe/MyModule.hx
# Files automatically recompile
# 3. Debug compile errors
mix haxe.errors --format json# 1. Make changes to compiler
vim src/reflaxe/elixir/ElixirCompiler.hx
# 2. Test Haxe compiler changes
npm run test:quick
# 3. Test generated Elixir code integration
npm run test:mix
# 4. Full validation
npm testreflaxe.elixir/
├── .haxerc # Haxe version specification
├── package.json # npm dependencies and scripts
├── mix.exs # Elixir dependencies and config
├── haxe_libraries/ # lix-managed Haxe dependencies
├── src/reflaxe/elixir/ # Compiler source code
├── std/ # Phoenix/Elixir type definitions
├── test/ # Snapshot tests for compiler
├── examples/ # Working example applications
│ ├── todo-app/ # Main Phoenix LiveView example
│ └── simple-modules/ # Basic compilation examples
└── docs/ # Complete documentation (you are here!)
Solution: Install Haxe and/or add it to your PATH.
# Preferred
haxe --version
# Project-local shim (provided by `lix` + `.haxerc`)
./node_modules/.bin/haxe --versionSolution: Run lix download to install dependencies
npx lix downloadSolution: Verify all prerequisites and run setup in order
# Complete setup sequence
npm install
npx lix download
mix deps.get
npm testSolution: This is a self-referential library issue. See Troubleshooting Guide for detailed solutions.
Solution: Path resolution issue with test setup. This occurs when test configurations reference incorrect paths. Verify you're in the correct directory and all paths in .hxml files are accurate.
Solution: Ensure you're in the project root directory
# Check you're in the right directory
ls .haxerc # Should exist
pwd # Should end with /reflaxe.elixirSolution: Source mapping is currently experimental; .ex.map files are not emitted by default builds yet.
See docs/04-api-reference/SOURCE_MAPPING.md.
Solution: Source mapping is currently experimental; if you’re working on it, start from
docs/04-api-reference/SOURCE_MAPPING.md and add integration coverage under test/snapshot/core/source_map_validation/.
# Verify each component
node --version # Node.js
npx lix --version # lix package manager
haxe --version # Haxe (project toolchain)
mix --version # Elixir/Mix# Re-download the toolchain + libraries (lix cache)
npx lix download
# If your lix cache is corrupted, remove it and retry:
# rm -rf ~/haxe
# Clean reinstall Elixir dependencies
mix deps.clean --all
mix deps.get
# Verify with tests
npm testreflaxe.elixir/
├── .haxerc # Haxe version specification
├── package.json # npm dependencies and scripts
├── mix.exs # Elixir dependencies and config
├── haxe_libraries/ # lix-managed Haxe deps (pinned via *.hxml)
├── src/reflaxe/elixir/ # Haxe→Elixir compiler source
├── std/ # Elixir extern definitions
├── test/ # Haxe compiler tests
├── examples/ # Working examples
└── node_modules/ # npm dependencies (including lix)
Reflaxe.Elixir uses a dual-ecosystem architecture:
- Purpose: Develop and test the compiler itself
- Tools: lix (Haxe toolchain) + snapshot test runner under
test/ - Command:
npm run test:quick
- Purpose: Test and run generated code
- Tools: Phoenix, Ecto, ExUnit, GenServer
- Command:
npm run test:mix
- Purpose: Validate end-to-end workflow
- Command:
npm test(runs both ecosystems)
This setup ensures that both the compiler development and generated code quality are thoroughly validated.
After successful installation:
- Quickstart Tutorial - Build your first Haxe→Elixir project in 5 minutes
- Project Structure - Understand the directory layout and conventions
- Development Workflow - Learn day-to-day development practices
- Phoenix Integration - Build Phoenix applications with Haxe
- User Guide - Complete application development documentation
- Troubleshooting Guide - Comprehensive problem-solving reference
- API Reference - Technical reference for annotations and APIs
- Compiler Development - For contributors to the compiler itself
Ready to code? Continue to Quickstart Tutorial for your first Haxe→Elixir project.