Repository navigation
v0.1.0-alpha - Echo Platform, Explicit HTTP Contracts, Application Hosting | Echo 플랫폼, 명시적 HTTP 계약, 앱 호스팅
🦴 Spine Echo Platform v0.1.0
Echo Platform, Explicit HTTP Contracts, Application Hosting | Echo 플랫폼, 명시적 HTTP 계약, 앱 호스팅
spine-echo-platform v0.1.0은 Spine v0.6.0의 공개 HTTP v2 계약을 구현하는 Echo 플랫폼의 첫 릴리즈입니다. 사용자는 플랫폼 모듈을 설치하고 platform.New()로 기존 Spine App을 생성합니다. 실행은 같은 App의 Run 또는 RunContext가 담당합니다.
Go 패키지 이름은 platform이며 Echo v5.4.4와 Spine v0.6.0을 의존성으로 사용합니다. 별도의 계약 모듈이나 로컬 replace는 필요하지 않습니다.
spine-echo-platform v0.1.0 is the first release of the Echo platform implementing the public HTTP v2 contract in Spine v0.6.0. Install the platform module and create the existing Spine App through platform.New(). The same App owns execution through Run or RunContext.
The Go package is named platform and depends on Echo v5.4.4 and Spine v0.6.0. No separate contract module or local replacement is required.
✨ 주요 변경 사항 | Highlights
- Spine과 Echo를 함께 구성하는
platform.New(options...) - 표준 라이브러리 기반 공개
spine.http-adapter/v2계약 구현 - native Echo 설정을 위한 typed
WithEcho(func(*echo.Echo))옵션 - DTO·multipart 바인딩과 HTTP 오류 상태·원인 보존
json.RawMessage출력과 Echo의 개행·pretty·사용자 serializer 경로 유지- 리스너 없는 Handler 제공과 관리 서버의 Serve·Shutdown 분리
- 기존 Spine의 응답 staging과 WS 메시지·종료 책임 유지
- Added
platform.New(options...)to configure Spine and Echo together - Implemented the standard-library-based public
spine.http-adapter/v2contract - Added typed native configuration through
WithEcho(func(*echo.Echo)) - Preserved DTO and multipart binding, HTTP error status, and error causes
- Added
json.RawMessageoutput while retaining Echo newline, pretty-printing, and custom serializer behavior - Separated a listener-free Handler from managed Serve and Shutdown
- Kept response staging and WebSocket message/shutdown ownership in Spine
🚀 주요 변경 사항 상세 | Detailed Changes
플랫폼 선택과 동일한 Spine App | Platform Selection and the Same Spine App
platform.New(options...)는spine.New(platform.Option(options...))와 같은 구성을 제공합니다.- Option은
NewFactory(options...)를spine.WithHTTPAdapter로 주입합니다. 플랫폼 전용 App이나 별도 Run 구현은 만들지 않습니다. - 생성자와 기능 조회는 포트를 열거나 native 설정 함수를 실행하지 않습니다.
platform.New(options...)provides the same configuration asspine.New(platform.Option(options...)).- Option injects
NewFactory(options...)throughspine.WithHTTPAdapter. The platform does not introduce a separate App or Run implementation. - Constructors and capability queries neither open ports nor execute native configuration callbacks.
Echo 구성과 요청 처리 | Echo Configuration and Request Handling
- 각 준비 과정에서 fallback, WS GET 경로, native 설정 순서로 등록합니다. WithEcho 함수는 준비마다 한 번 실행합니다.
- DTO와 multipart 입력을 기존 Echo API로 바인딩하고, 입력 오류를 공개 계약으로 전달하면서 상태와 원인을 보존합니다.
- native Echo store와 Spine의 요청 store는 별개입니다. 공유 요청 값에는 표준 request context를 사용합니다.
- Each preparation registers the fallback, WebSocket GET routes, and native configuration in that order. Each WithEcho callback runs once per preparation.
- DTO and multipart input use Echo's binding APIs. Input errors retain their status and cause across the public contract.
- Native Echo storage remains separate from Spine request storage. Use the standard request context for shared request values.
HTTP 출력과 서버 수명 | HTTP Output and Server Lifecycle
- JSON writer는 커널이 직렬화한
json.RawMessage를 받습니다. Echo의 JSON 출력 경로를 사용해 개행·pretty 출력과 사용자 JSONSerializer를 유지합니다. Handler()는 준비된 동일 Echo 진입점을 반환합니다.Serve(listener)는 인스턴스당 한 번 실행하고 전달받은 listener를 모든 반환 경로에서 닫습니다.Shutdown(ctx)는 새 요청 수용을 중단하고 활성 HTTP 요청을 기다립니다. 시간 초과 뒤에는 새 context로 다시 기다릴 수 있습니다.- The JSON writer receives
json.RawMessageserialized by the kernel. Echo's JSON output path retains newline, pretty-printing, and custom JSONSerializer behavior. Handler()returns the same prepared Echo entry point.Serve(listener)runs once per instance and closes the supplied listener on every return path.Shutdown(ctx)stops accepting requests and waits for active HTTP requests. Waiting can be retried with a new context after a timeout.
외부 서버와 WebSocket 연결 | External Hosting and WebSocket Integration
app.Prepare(ctx, options)가 제공하는 Handler는 외부 HTTP 서버나 httptest에 연결할 수 있습니다. 준비 결과는 호출자가Close(ctx)로 정리합니다.- 외부 서버의 listener·TLS·timeout은 호출자가 관리합니다. 준비 결과는 Close 시작 뒤 새 요청을 거부하고 진행 요청과 앱 자원을 정리합니다.
- WS 업그레이드는 raw HTTP 입출력을 기존 Spine 런타임에 전달합니다. WS 메시지 실행과 연결 종료는 커널이 관리합니다.
- The Handler returned through
app.Prepare(ctx, options)can be attached to an external HTTP server or httptest. The caller closes the preparation result throughClose(ctx). - The caller owns the external listener, TLS, and timeouts. The preparation result rejects new requests after Close starts and cleans up active requests and application resources.
- WebSocket upgrades forward raw HTTP input/output to the existing Spine runtime. Message execution and connection shutdown remain in the kernel.
🆕 새 설정과 API | New Configuration and APIs
platform.New(options ...EchoOption) spine.Appplatform.Option(options ...EchoOption) spine.Optionplatform.NewFactory(options ...EchoOption) adapter.Factoryplatform.WithEcho(configure func(*echo.Echo)) EchoOption- 공개 HTTP v2 계약을 구현하는
EchoAdapter EchoAdapterimplementing the public HTTP v2 contract
package main
import (
"log"
platform "github.com/NARUBROWN/spine-echo-platform"
"github.com/NARUBROWN/spine/pkg/boot"
)
func main() {
app := platform.New()
if err := app.Run(boot.Options{Address: ":8080", HTTP: &boot.HTTPOptions{}}); err != nil {
log.Fatal(err)
}
}native 설정은 platform.New(platform.WithEcho(func(e *echo.Echo) { ... }))로 전달합니다. 외부 서버에 연결할 때는 Run 대신 app.Prepare(ctx, options)의 Handler와 Close를 사용합니다.
Pass native configuration through platform.New(platform.WithEcho(func(e *echo.Echo) { ... })). For external hosting, use the Handler and Close from app.Prepare(ctx, options) instead of Run.
🧩 호환성/마이그레이션 메모 | Compatibility Notes
지원 버전과 API | Supported Versions and APIs
- Spine
v0.6.0, HTTP 계약spine.http-adapter/v2, Echov5.4.4를 사용합니다. - native handler와 middleware는
*echo.Context를 받습니다. 오류 처리기는(ctx *echo.Context, err error)순서이며 logger는log/slog입니다. - 사용자 JSONSerializer는 원래 DTO 대신
json.RawMessage입력을 처리해야 합니다. - Supports Spine
v0.6.0, HTTP contractspine.http-adapter/v2, and Echov5.4.4. - Native handlers and middleware take
*echo.Context. Error handlers use(ctx *echo.Context, err error), and logging useslog/slog. - Custom JSONSerializer implementations must handle
json.RawMessagerather than the original DTO.
개발 스냅샷에서 전환 | Migrating from Development Snapshots
app.Transport(func(any))와 공통 native-hook 설정 대신WithEcho옵션을 사용합니다.- 준비는 별도
spine.Prepare함수가 아니라app.Prepare(ctx, options)로 호출합니다. - CLI
v0.4.0의new는 Spinev0.6.0, Echo 플랫폼v0.1.0과 Echov5.4.4를 구성하고 HTTP 어댑터 v2 계약을 검사합니다. - 이번 구현은 ASGI의 앱·서버 경계를 참고하지만 Python ASGI와의 호환을 의미하지 않습니다.
- Use
WithEchoinstead ofapp.Transport(func(any))and shared native-hook configuration. - Call
app.Prepare(ctx, options)instead of a separate package-levelspine.Preparefunction. - CLI
v0.4.0configures Spinev0.6.0, Echo platformv0.1.0, and Echov5.4.4throughnew, and checks the HTTP adapter v2 contract. - The design draws on ASGI application/server boundaries but does not provide Python ASGI compatibility.
상세 안내: 플랫폼 README, Spine 전환 안내.
Details: Platform README, Spine migration guide.
📬 전달 의미와 트랜잭션 경계 | Delivery Semantics and Transaction Boundaries
- 요청 store, EventBus, 라우팅과 응답 staging은 Spine 커널이 소유합니다. 플랫폼은 실제 HTTP 출력과 서버 수명을 맡습니다.
- 응답 staging은 데이터베이스 commit과 socket write 또는 broker publish를 원자적으로 묶지 않습니다.
- 사용자 Echo serializer와 실제 writer의 오류는 최종 출력 단계에서도 발생할 수 있습니다.
- Spine owns request storage, EventBus, routing, and response staging. The platform owns physical HTTP output and server lifecycle.
- Response staging does not make database commits atomic with socket writes or broker publication.
- Custom Echo serializer and transport writer errors can still occur during final output.
🧪 테스트 범위 | Test Coverage Boundary
- 공개 Spine
v0.6.0기준 플랫폼 race: 최상위 24개와 하위 사례 9개 통과 GOWORK=off의 module tidy/verify, vet, U1000 검사 통과- 준비 커밋
6b2e898의 원격 CI 성공 - Platform race tests against public Spine
v0.6.0: 24 top-level tests and 9 subtests passed - Passed module tidy/verify, vet, and U1000 with
GOWORK=off - Successful remote CI for preparation commit
6b2e898
GitHub의 v0.1.0 태그는 준비 커밋 6b2e898을 가리킵니다. 태그 자체는 빈 모듈 캐시에서 공개 Go 프록시 다운로드와 체크섬 검증을 통과했습니다. 정식 태그를 사용하는 실제 demo 소비자도 빈 모듈 캐시와 로컬 replace 없는 환경에서 vet/race, HTTP/WS, SIGINT와 Prepare E2E를 통과했습니다.
The GitHub v0.1.0 tag points to preparation commit 6b2e898. The tag itself passed public Go proxy download and checksum verification with an empty module cache. The actual demo consumer also passed vet/race, HTTP/WS, SIGINT, and Prepare E2E using the release tags, an empty module cache, and no local replacements.
위 소스 테스트와 별도로 CLI v0.4.0 설치, 기본 new의 공개 의존성 선택과 빌드, 계약 검사와 verify, spine dev의 /health 응답(200 OK)과 SIGINT 정상 종료를 확인했습니다. 실제 운영 인프라 전체를 검증한 결과는 아닙니다.
Separately from the source tests above, validation covered CLI v0.4.0 installation, default new dependency selection and build, contract checks and verify, a 200 OK response from /health through spine dev, and clean SIGINT shutdown. This does not validate a complete production infrastructure deployment.
📦 설치 | Installation
Spine v0.6.0부터 새 프로젝트의 공식 시작 경로는 **Spine CLI의 new**입니다. Spine CLI v0.4.0의 spine 명령을 설치하세요.
From Spine v0.6.0, the official way to start a new project is Spine CLI new. Install the spine command from Spine CLI v0.4.0.
CLI v0.4.0의 new가 Spine v0.6.0, Echo 플랫폼 v0.1.0과 Echo v5.4.4를 함께 구성합니다.
CLI v0.4.0 configures Spine v0.6.0, Echo platform v0.1.0, and Echo v5.4.4 together through new.
go install github.com/NARUBROWN/spine-cli/cmd/spine@v0.4.0
spine version
spine new todo-api --module github.com/acme/todo-api
cd todo-api
spine dev다른 터미널에서 기본 health endpoint를 확인합니다. 200 OK와 {"status":"ok"}가 반환됩니다.
In another terminal, check the default health endpoint. It returns 200 OK and {"status":"ok"}.
curl http://localhost:8080/healthnew는 플랫폼 연결, 의존성 설치, 정적 계약 검사와 빌드를 완료한 뒤 프로젝트를 생성합니다. 서버는 spine dev로 시작합니다. --skip-install로 파일만 생성했다면 go mod tidy를 별도로 실행하세요.
new configures the platform, installs dependencies, checks the static contract, and builds the app before creating the project. Start the server with spine dev. Run go mod tidy separately if you use --skip-install to generate files only.
기존 Go 모듈에 직접 연결할 때는 플랫폼 의존성을 추가합니다. 플랫폼 v0.1.0은 Spine v0.6.0과 Echo를 가져옵니다.
For manual integration into an existing Go module, add the platform dependency. Platform v0.1.0 brings in Spine v0.6.0 and Echo.
go get github.com/NARUBROWN/spine-echo-platform@v0.1.0최소 Go 버전은 1.25.5이고 권장 개발 버전은 1.27.3입니다.
The minimum Go version is 1.25.5; the recommended development version is 1.27.3.
Source: https://github.com/NARUBROWN/spine-echo-platform/tree/v0.1.0