Skip to content

matheuslanduci/effect-by-example

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Effect by Example: Complete Module Documentation [WIP]

Completion Status Documentation Examples

Comprehensive, real-world focused guides for 110 modules in the Effect ecosystem, including core modules, platform abstractions, and experimental features. Each guide is crafted with practical examples, testing strategies, and integration patterns that developers can immediately apply to production applications.

Current Progress: 42/110 modules documented (38% complete) with 68 modules remaining.

πŸ—‚οΈ Repository Structure

effect-by-example/
β”œβ”€β”€ effect/                    # Core module guides (29/97 guides)
β”‚   β”œβ”€β”€ Effect-Guide.md       # Essential computation type
β”‚   β”œβ”€β”€ Schema-Guide.md       # Type-safe validation
β”‚   └── ...                   # All other core modules
β”œβ”€β”€ @effect/
β”‚   β”œβ”€β”€ platform/             # Platform module guides (13 guides)
β”‚   β”‚   β”œβ”€β”€ HttpClient-Guide.md
β”‚   β”‚   β”œβ”€β”€ HttpServer-Guide.md
β”‚   β”‚   └── ...               # All platform modules
β”‚   └── experimental/         # Experimental module guides
β”‚       └── VariantSchema-Guide.md
└── CLAUDE.md                # Documentation template

πŸ“Š Completion Status

🚧 Project In Progress: 42/110 Modules Documented (38% Complete)

Core Effect Modules

Tier Category Status Count
Tier 1 Foundation Modules ⚠️ Partial 8/20
Tier 2 Data Structures ⚠️ Partial 9/25
Tier 3 Advanced Features ⚠️ Partial 9/18
Tier 4 STM Modules ❌ Missing 0/12
Tier 5 System & Infrastructure ⚠️ Partial 3/15
Tier 6 Specialized & Advanced ❌ Missing 0/7
Core Total All Effect Core Modules 🚧 In Progress 29/97

Effect Platform Modules

Tier Category Status Count
Tier 1 Core Platform βœ… Complete 5/5
Tier 2 System Integration βœ… Complete 5/5
Tier 3 Specialized βœ… Complete 3/3
Platform Total All Platform Modules βœ… Complete 13/13

Grand Total: 42/110 Modules 🚧

Remaining Work: 68 modules to document

  • 68 Core Effect modules requiring comprehensive guides
  • Target completion: Q2 2025

πŸ“š Module Documentation

Current Modules (42/110 Complete)

βœ… Tier 1 - Foundation Modules (8/20 Complete)

Currently Documented:

  1. Effect - Core computation type for async operations with proper error tracking
  2. Schema - Type-safe schema validation and data transformation
  3. Stream - Async streaming data processing for large datasets
  4. Layer - Dependency injection and service management system
  5. Option - Safe handling of optional values without null/undefined
  6. Either - Explicit error handling with Left/Right pattern
  7. Array - Functional array operations with safe transformations
  8. Context - Type-safe dependency management and service configuration

Tier 2 - Advanced Features βœ…

Advanced modules for sophisticated use cases, concurrency, and performance optimization.

  1. Fiber - Lightweight concurrency primitives and green threads
  2. Schedule - Retry and repeat patterns with exponential backoff strategies
  3. Queue - Concurrent message passing and producer-consumer patterns
  4. STM - Software Transactional Memory for atomic operations
  5. Exit - Effect completion handling and result analysis
  6. FiberRef - Fiber-local state management and context propagation
  7. Scope - Resource management and automatic cleanup
  8. Config - Configuration management with environment variables
  9. Channel - Low-level streaming primitives and channel operations

Tier 3 - Data Structures & Utilities βœ…

Specialized data structures, time operations, and utility modules for specific use cases.

  1. Chunk - High-performance immutable sequences with array-like operations
  2. HashMap - Immutable hash-based key-value collections
  3. HashSet - Immutable hash-based unique value collections
  4. List - Immutable linked lists with functional operations
  5. SortedMap - Ordered key-value collections with custom comparators
  6. SortedSet - Ordered unique value collections with range operations
  7. Duration - Type-safe time span handling with arithmetic operations
  8. DateTime - Date/time operations with timezone support
  9. Clock - Time operations and virtual time for testing
  10. Random - Pseudo-random generation with reproducible seeds
  11. Runtime - Effect execution environment configuration
  12. Function - Function composition and utility operations

Effect Platform Modules πŸ—οΈ

Cross-platform abstractions for building applications that run consistently across Node.js, Deno, Bun, and browsers.

Tier 1 - Core Platform βœ…

Essential platform modules for HTTP communication, file operations, and storage.

  1. HttpClient - HTTP client requests with authentication, retries, and caching
  2. HttpServer - HTTP server creation, middleware, and request handling
  3. FileSystem - Cross-platform file system operations and streaming
  4. KeyValueStore - Unified key-value storage with multiple backend implementations
  5. Path - Safe cross-platform file path operations and manipulation

Tier 2 - System Integration βœ…

Advanced modules for system-level operations, process management, and infrastructure.

  1. Terminal - Terminal input/output, CLI applications, and interactive interfaces
  2. Command - Process execution, build automation, and system command integration
  3. Socket - TCP/UDP networking, real-time communication, and inter-process messaging
  4. Worker - Parallel processing, CPU-intensive tasks, and background job management
  5. Runtime - Application lifecycle management, graceful shutdown, and error handling

Tier 3 - Specialized Platform βœ…

Specialized modules for advanced HTTP patterns, API design, and logging.

  1. HttpRouter - Advanced HTTP routing, middleware composition, and REST API patterns
  2. HttpApi - Declarative API definition, OpenAPI generation, and type-safe client generation
  3. PlatformLogger - File-based logging, structured logging, and log rotation strategies

🚧 Missing Core Effect Modules (68 Remaining)

Priority 1 - Essential Foundation (12 modules)

πŸ“‹ Predicate, Struct, Record, String, Number, Boolean, Tuple, Types, Equal, Equivalence, Order, Match

Priority 2 - Data Structures (16 modules)

πŸ“‹ Iterable, NonEmptyIterable, RedBlackTree, Trie, MutableHashMap, MutableHashSet, MutableList, MutableQueue, MutableRef, Ref, SynchronizedRef, SubscriptionRef, ScopedRef, Deferred, PubSub, Pool

Priority 3 - STM & Concurrency (15 modules)

πŸ“‹ TArray, TMap, TQueue, TRef, TSet, TDeferred, TPubSub, TPriorityQueue, TSemaphore, TReentrantLock, TSubscriptionRef, TRandom, KeyedPool, RateLimiter, Cache

Priority 4 - System Infrastructure (15 modules)

πŸ“‹ ScopedCache, Logger, LogLevel, LogSpan, Tracer, Metric, MetricKey, MetricLabel, Resource, Reloadable, ManagedRuntime, Cause, Data, Brand, Supervisor

Priority 5 - Specialized Utilities (10 modules)

πŸ“‹ Secret, Redacted, Pretty, Encoding, RegExp, BigInt, BigDecimal, Cron, Take, Sink

Next Phase: Creating foundation modules (Predicate, Struct, Record, String) starting immediately.


🎯 Learning Paths

For Beginners

Start Here β†’ Build Foundation β†’ Practice

  1. Effect β†’ Option β†’ Either
  2. Array β†’ Schema
  3. Context β†’ Layer

For Intermediate Developers

Master Advanced Patterns β†’ Handle Concurrency β†’ Optimize Performance

  1. Stream β†’ Fiber β†’ Schedule
  2. Queue β†’ STM
  3. Config β†’ Scope

For Advanced Use Cases

Specialized Data Structures β†’ System Integration β†’ Performance Tuning

  1. Data-Heavy Applications: Chunk β†’ HashMap β†’ SortedMap
  2. Time-Sensitive Systems: Duration β†’ DateTime β†’ Clock
  3. Testing & Debugging: Random β†’ Runtime β†’ Exit

For Platform Development

Cross-Platform Applications β†’ System Integration β†’ Infrastructure

  1. Web Development: HttpServer β†’ HttpClient β†’ HttpRouter β†’ HttpApi
  2. System Integration: FileSystem β†’ Path β†’ Command β†’ Terminal
  3. Infrastructure & Performance: KeyValueStore β†’ Socket β†’ Worker β†’ Runtime

By Use Case

  • Web APIs: Effect β†’ Schema β†’ HttpServer β†’ HttpRouter β†’ HttpApi
  • Data Processing: Array β†’ Stream β†’ Chunk β†’ FileSystem β†’ Worker
  • Real-time Systems: Fiber β†’ Queue β†’ STM β†’ Socket β†’ Clock
  • CLI Tools: Effect β†’ Terminal β†’ Command β†’ FileSystem β†’ Config
  • System Integration: Layer β†’ Context β†’ KeyValueStore β†’ Runtime β†’ PlatformLogger
  • Testing: Random β†’ Clock β†’ Runtime β†’ Function β†’ Channel

🎯 Guide Characteristics

Each guide follows a rigorous standard designed for immediate practical application:

Content Structure

  • Problem-Solution Pattern: Starts with real problems developers face before introducing solutions
  • Progressive Complexity: Simple β†’ Intermediate β†’ Advanced examples that build upon each other
  • Real-World Focus: Every example solves actual production problems with realistic domains
  • Heavy Code Examples: 60-70% executable code with comprehensive inline documentation

Quality Standards

  • βœ… Complete & Runnable: All 400+ examples include imports and are immediately executable
  • βœ… Effect Best Practices: Follows official Effect patterns and idiomatic usage
  • βœ… Comprehensive Error Handling: Proper error management patterns throughout
  • βœ… Type-Safe: Full TypeScript integration with inference demonstrations
  • βœ… Production-Ready: Realistic domain models (User, Product, Order, Event, etc.)

Coverage Areas per Guide

  • Basic Usage Patterns: 3+ fundamental patterns for getting started
  • Real-World Examples: 3-5 comprehensive scenarios demonstrating practical applications
  • Advanced Features: Deep dive into powerful capabilities and edge cases
  • Practical Patterns: Reusable helpers, abstractions, and utility functions
  • Integration Examples: Working with other Effect modules and popular external libraries
  • Testing Strategies: Unit testing, property-based testing, and mocking approaches

πŸš€ Quick Start

New to Effect?

Essential Learning Sequence:

  1. Effect - Master the core computation type
  2. Option - Handle optional values safely
  3. Either - Manage errors explicitly
  4. Schema - Validate and transform data

Building Applications?

Application Development Track:

  1. Layer - Structure your application with dependency injection
  2. Context - Manage services and configuration
  3. Config - Handle environment-specific settings
  4. HttpServer - Build web applications and APIs

Platform & Infrastructure?

Platform Development Track:

  1. FileSystem - Handle files and directories across platforms
  2. HttpClient - Consume APIs and external services
  3. KeyValueStore - Implement caching and storage
  4. Worker - Process intensive tasks in the background

Performance & Concurrency?

Advanced Patterns Track:

  1. Fiber - Implement lightweight concurrency
  2. Schedule - Add resilience with retry patterns
  3. Queue - Enable async communication
  4. STM - Coordinate concurrent state changes

πŸ’‘ Real-World Domains Covered

The guides include comprehensive examples from these production scenarios:

Backend Development

  • REST APIs: HttpServer routing, HttpClient consumption, rate limiting, retry logic, circuit breakers
  • HTTP Services: Middleware composition, request validation, response transformation, error handling
  • GraphQL: Query building, schema validation, resolver patterns, subscription handling
  • Database Operations: CRUD with transactions, connection pooling, migration handling
  • Authentication: JWT handling, session management with KeyValueStore, multi-factor auth flows

Data Processing

  • ETL Pipelines: Stream processing, data transformation, error recovery
  • File Processing: FileSystem operations, log analysis, CSV parsing, large file streaming with Worker
  • Analytics: Real-time metrics, aggregation patterns, PlatformLogger integration, reporting systems
  • Message Queues: Producer-consumer patterns with Socket, dead letter handling, backpressure

Web Applications

  • E-commerce: Shopping cart logic, inventory management, order processing, payment flows
  • Multi-tenant SaaS: Tenant isolation, feature flags, usage billing, plan management
  • Real-time Systems: WebSocket handling, live updates, event sourcing, CQRS
  • Form Validation: Progressive enhancement, field-level errors, complex business rules

System Integration

  • Configuration Management: Environment variables with Config, feature toggles, A/B testing
  • Command Line Tools: Terminal interfaces, Command execution, cross-platform Path handling
  • Process Management: Worker coordination, Runtime lifecycle, graceful shutdown patterns
  • Testing: Unit tests, integration tests, property-based testing, snapshot testing
  • Monitoring: Health checks, metrics collection, PlatformLogger, distributed tracing, alerting
  • Deployment: Blue-green deployments, canary releases, rollback strategies

πŸ§ͺ Testing Approach

Every guide includes comprehensive testing strategies:

  • Unit Testing: Testing individual module functions with Effect's testing utilities
  • Property-Based Testing: Using generators for comprehensive input coverage
  • Integration Testing: Testing module interactions and real-world scenarios
  • Performance Testing: Benchmarking and optimization techniques
  • Mock Strategies: Creating testable abstractions and dependency injection

🀝 Contributing

These guides represent the most comprehensive Effect documentation available. Contributions are welcome!

How to Contribute

  1. Improvement Suggestions: Open issues for areas that need clarification
  2. Additional Examples: Submit PRs with new real-world scenarios
  3. Bug Reports: Report any incorrect examples or outdated patterns
  4. Template Usage: Use CLAUDE.md for creating additional guides

Quality Standards

All contributions must maintain the established quality standards:

  • Follow the documented template structure
  • Include complete, runnable examples
  • Focus on real-world, practical applications
  • Maintain consistency with existing guides

πŸ“– Additional Resources

Official Effect Resources

This Repository

Learning Resources

  • Beginner: Start with Effect β†’ Option β†’ Either β†’ Array sequence
  • Intermediate: Focus on Stream β†’ Fiber β†’ Schedule β†’ Layer progression
  • Advanced: Explore STM β†’ Channel β†’ Runtime β†’ specialized data structures
  • Testing: Random β†’ Clock β†’ comprehensive testing patterns across all modules

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published