https://github.com/stone-foundation/stone-js-http-core
HTTP abstraction layer for Stone.js, provides context-aware request and response objects for all runtimes.
https://github.com/stone-foundation/stone-js-http-core
context-aware continuum-architecture javascript official-stonejs stone-foundation stonejs stonejs-core stonejs-http typescript
Last synced: 3 months ago
JSON representation
HTTP abstraction layer for Stone.js, provides context-aware request and response objects for all runtimes.
- Host: GitHub
- URL: https://github.com/stone-foundation/stone-js-http-core
- Owner: stone-foundation
- License: mit
- Created: 2023-09-10T23:09:30.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-09-14T05:06:35.000Z (9 months ago)
- Last Synced: 2025-09-24T11:30:53.040Z (9 months ago)
- Topics: context-aware, continuum-architecture, javascript, official-stonejs, stone-foundation, stonejs, stonejs-core, stonejs-http, typescript
- Language: TypeScript
- Homepage: https://stonejs.dev
- Size: 844 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Stone.js - HTTP Core
[](https://opensource.org/licenses/MIT)
[](https://www.npmjs.com/package/@stone-js/http-core)
[](https://www.npmjs.com/package/@stone-js/http-core)

[](https://github.com/stone-foundation/stone-js-http-core/actions/workflows/main.yml)
[](https://github.com/stone-foundation/stone-js-http-core/actions/workflows/release.yml)
[](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-http-core)
[](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-http-core)
[](./SECURITY.md)
[](https://github.com/stone-foundation/stone-js-http-core/security/code-scanning)
[](https://github.com/stone-foundation/stone-js-http-core/network/updates)
[](https://conventionalcommits.org)
Stone.js HTTP Core offers a simple, consistent API for handling HTTP requests and responses across any JavaScript runtime.
---
## Overview
The `@stone-js/http-core` package defines the foundational HTTP abstractions used throughout the Stone.js ecosystem. It introduces the `IncomingHttpEvent` and `OutgoingHttpResponse` classes, enabling context-aware handling of HTTP requests and responses in a runtime-agnostic way.
This module provides a normalized API for HTTP operations that works across adapters (Node.js, Lambda, etc.), serving as the bridge between the external runtime and the internal application logic.
## Key Features
- `IncomingHttpEvent`: A wrapper for incoming HTTP requests with support for headers, query, body, method, and cookies
- `OutgoingHttpResponse`: A consistent abstraction for building and sending structured HTTP responses
- First-class cookie handling with `Cookie` (secure, signed, or plain)
- Support for headers, status codes, redirection, and JSON responses
- Shared interfaces for request and response resolution across runtimes
All components are designed to be used within the **Continuum Architecture** of Stone.js, making them predictable, extensible, and runtime-neutral.
## Installation
```bash
npm install @stone-js/http-core
```
> \[!IMPORTANT]
> This package is **pure ESM**. Ensure your `package.json` includes `"type": "module"` or configure your bundler appropriately.
## Usage Example
```ts
import { IncomingHttpEvent, OutgoingHttpResponse } from '@stone-js/http-core'
// Simulate incoming request
const event = new IncomingHttpEvent({
method: 'GET',
url: URL.parse('https://example.com/api/resource'),
headers: { 'x-custom-header': 'value' },
body: {},
queryString: 'param1=value1¶m2=value2',
})
// Build response
const response = OutgoingHttpResponse.create({ content: { message: 'Hello from Stone.js' } })
response.setStatus(204)
response.setHeader('Content-Type', 'application/json')
```
## Learn More
This package is part of the Stone.js ecosystem, a modern JavaScript framework built around the Continuum Architecture.
Explore the full documentation: https://stonejs.dev
## API documentation
* [API](https://github.com/stone-foundation/stone-js-http-core/blob/main/docs)
## Contributing
See [Contributing Guide](https://github.com/stone-foundation/stone-js-http-core/blob/main/CONTRIBUTING.md)