Skip to content

Commit 81c99c8

Browse files
committed
docs: adds first version of readme
1 parent d6dd2eb commit 81c99c8

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# @evit/core
2+
3+
> A lightweight, type-safe, stateless event system for building reactive UIs. Designed to enable feature-level communication in large-scale applications using frameworks like React.
4+
5+
> evit = event it!
6+
7+
---
8+
9+
## Features
10+
11+
- **Fully type-safe** payloads and event tags
12+
- **Zero re-renders** — events are just callbacks, not state
13+
- Built for **cross-feature communication**
14+
- **Framework-agnostic core** (`@evit/core`)
15+
- Optional React bindings via [`@evit/react`](https://www.npmjs.com/package/@evit/react)
16+
- **No external dependencies**
17+
18+
---
19+
20+
## Installation
21+
22+
Core library:
23+
24+
### npm
25+
26+
```sh
27+
npm install @evit/core
28+
```
29+
30+
### pnpm
31+
32+
```sh
33+
pnpm add @evit/core
34+
```
35+
36+
### yarn
37+
38+
```sh
39+
yarn add @evit/core
40+
```
41+
42+
React bindings:
43+
44+
You can also install react bindings `@evit/react`.
45+
46+
---
47+
48+
## 🔧 Example
49+
50+
```ts
51+
import { defineEvent, withPayload } from '@evit/core'
52+
53+
// Define an event with a payload
54+
const userCreated = defineEvent('user.created', withPayload<{ id: number }>())
55+
56+
// Subscribe to the event
57+
userCreated.on((payload, tag) => {
58+
console.log(payload.id) // → 123
59+
})
60+
61+
// Trigger the event
62+
userCreated({ id: 123 })
63+
```
64+
65+
---
66+
67+
## Use Cases
68+
69+
- Decoupled communication between features, widgets, or UI layers
70+
- Declarative side-effect triggers (e.g. analytics, logging, DOM focus)
71+
- Ideal for [Feature-Sliced Design](https://github.com/feature-sliced/documentation) or modular frontend architectures
72+
- Works alongside any state management — or none at all
73+
74+
---
75+
76+
## Packages
77+
78+
| Package | Description |
79+
|------------------|----------------------------------------------|
80+
| `@evit/core` | Framework-agnostic core event system |
81+
| `@evit/react` | React bindings (`useEventEffect` hook, etc.) |
82+
83+
---
84+
85+
## License
86+
87+
MIT
88+

0 commit comments

Comments
 (0)