A media parsing service built with Effect-TS architecture, demonstrating modern functional programming patterns for TypeScript applications.
This project follows Effect-TS service architecture patterns with clear separation of concerns:
src/
├── config.ts # Configuration management
├── api.ts # API definition
├── client.ts # API client
├── server.ts # Server setup
├── domain/ # Domain models and schemas
│ ├── jobs/ # Job-related domain objects
│ ├── media/ # Media parsing domain objects
│ └── common/ # Shared domain objects
├── stores/ # Data access layer
│ ├── jobs/ # Job data operations
│ └── media/ # Media parsing operations
├── usecases/ # Business logic layer
│ ├── jobs/ # Job-related business logic
│ └── media/ # Media parsing business logic
└── handlers/ # HTTP request handlers
├── jobs/ # Job API handlers
└── media/ # Media parsing API handlers
- Effect-TS Architecture: Functional programming with proper error handling
- Type-Safe APIs: Full type safety from client to server
- Layered Architecture: Clear separation of stores → usecases → handlers
- Comprehensive Testing: Unit tests for all layers
- Configuration Management: Environment-based configuration with defaults
- Observability: Built-in logging and tracing
- Error Handling: Proper domain errors and HTTP error mapping
POST /media/parse
- Parse media from URL or file upload- Supports both file uploads and URL-based parsing
- Returns subtitle data in structured JSON format
GET /media/jobs
- Get all parsing jobsGET /media/job/{id}
- Get specific job detailsGET /media/job/{id}/result
- Get job results (when completed)
- Bun runtime
- Node.js 18+ (for development tools)
pnpm install
bun run dev:server
Server runs on http://localhost:3001 (or PORT environment variable)
# Run all tests
bun run test
# Watch mode
bun run test:watch
# UI mode
bun run test:ui
# Format and lint
bun run check
# Type checking
bun run typecheck
# Format only
bun run format
# Lint only
bun run lint
Environment variables:
PORT
- Server port (default: 3001)JOBS_TABLE
- Database table for job storageLOG_LEVEL
- Logging level (default: info)
Each layer includes comprehensive tests:
- Store Tests: Data access layer testing with mocked dependencies
- Usecase Tests: Business logic testing with service mocks
- Handler Tests: Request/response testing with full layer mocking
Tests follow Effect-TS patterns using @effect/vitest
for proper Effect testing.