Version: 1.0.0 (Released 2025-01-31)
Create a new project directory with the following structure:
my-project/
├── src/
│ ├── core/ # Core JSX functionality
│ │ ├── runtime/ # JSX runtime
│ │ │ ├── jsx.js
│ │ │ └── transform.js
│ │ ├── types/ # Type system
│ │ │ ├── maybe.js
│ │ │ ├── either.js
│ │ │ └── result.js
│ │ └── functions/ # Core functions
│ │ ├── composition.js
│ │ └── transforms.js
│ │
│ ├── systems/ # Framework systems
│ │ ├── render/ # Rendering
│ │ ├── state/ # State management
│ │ ├── effects/ # Side effects
│ │ └── events/ # Event handling
│ │
│ ├── features/ # Your app features
│ │ └── counter/ # Example feature
│ │ ├── functions.js
│ │ └── index.js
│ │
│ └── utils/ # Utilities
│ ├── array.js
│ └── function.js
│
├── public/ # Static assets
│ └── index.html
│
└── tests/ # Test files
└── features/
└── counter/
└── counter.test.js
- Create your
public/index.html:
<!DOCTYPE html>
<html>
<head>
<title>FlexNet JSX Project</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="../src/core/runtime/jsx.js"></script>
<script type="module" src="../src/features/counter/index.js"></script>
</body>
</html>- Create your first feature (Counter Example):
// src/features/counter/functions.js
import { Maybe } from '../../core/types/maybe.js';
import { compose } from '../../core/functions/composition.js';
export const increment = n => n + 1;
export const decrement = n => n - 1;
export const updateCount = (count, operation) =>
Maybe.fromNullable(count)
.map(operation)
.getOrElse(0);
// src/features/counter/index.js
import { jsx } from '../../core/runtime/jsx.js';
import { increment, decrement, updateCount } from './functions.js';
const Counter = () => {
let count = 0;
return jsx('div', null, [
jsx('button', { onClick: () => count = updateCount(count, decrement) }, '-'),
jsx('span', null, count),
jsx('button', { onClick: () => count = updateCount(count, increment) }, '+')
]);
};
export default Counter;-
Pure Functions
- All operations should be pure functions
- Use composition for complex operations
- Avoid side effects outside effect system
-
Type Safety
- Use Maybe for optional values
- Use Either for error handling
- Use Result for operation outcomes
-
State Management
- Immutable state updates
- Pure state transitions
- State isolation through closures
-
Effect Handling
- Isolate side effects
- Use effect system for async operations
- Clean up effects properly
-
Feature Development
- Create feature directory in src/features/
- Implement pure functions in functions.js
- Create feature component in index.js
- Add tests in parallel
-
Testing
- Write tests in adjacent test directory
- Use property-based testing
- Test pure functions independently
- Test effects in isolation
-
Documentation
- Document function signatures
- Specify type information
- Include usage examples
- Document effects
-
File Organization
- Keep related files together
- Use clear, descriptive names
- Follow directory structure
- Maintain separation of concerns
-
Code Style
- Write pure functions
- Use functional composition
- Maintain immutability
- Document types clearly
-
Testing
- Test pure functions
- Test effect isolation
- Use property-based tests
- Maintain test coverage
-
Performance
- Optimize render functions
- Minimize state updates
- Handle effects efficiently
- Monitor performance
- Explore the examples in /examples
- Read the API documentation
- Study the architecture overview
- Join the community
For more detailed information, refer to:
- API Reference
- Architecture Overview
- Security Practices Guide