reca 2.3.8 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +151 -22
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,15 +1,38 @@
1
1
  # ReCA - React Clean Architecture state manager
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/react.svg?style=flat)](https://www.npmjs.com/package/reca)
3
+ [![npm version](https://img.shields.io/npm/v/reca.svg?style=flat)](https://www.npmjs.com/package/reca)
4
4
  [![GitHub license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/LabEG/reca/blob/main/LICENSE)
5
- ![npm downloads](https://img.shields.io/npm/dm/@labeg/code-style.svg)
5
+ ![npm downloads](https://img.shields.io/npm/dm/reca.svg)
6
6
  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/e9e573d8408945168d14d83c81a103e6)](https://www.codacy.com/gh/LabEG/reca/dashboard?utm_source=github.com&utm_medium=referral&utm_content=LabEG/reca&utm_campaign=Badge_Grade)
7
- ![build status](https://github.com/LabEG/code-style/workflows/Test%20Pull%20Request/badge.svg)
8
- [![CodeQL](https://github.com/LabEG/code-style/workflows/CodeQL%20Advanced/badge.svg)](https://github.com/LabEG/code-style/security/code-scanning)
7
+ ![build status](https://github.com/LabEG/reca/workflows/Test%20Pull%20Request/badge.svg)
8
+ [![CodeQL](https://github.com/LabEG/reca/workflows/CodeQL%20Advanced/badge.svg)](https://github.com/LabEG/reca/security/code-scanning)
9
9
  [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
10
10
 
11
11
  Created at the intersection of Functional style and OOP technologies. It is based on the simplicity of the functional style of the view, enriched with OOP technologies for writing business logic. Perfect for beginner developers and complex enterprise applications
12
12
 
13
+ ## Table of Contents
14
+
15
+ - [ReCA - React Clean Architecture state manager](#reca---react-clean-architecture-state-manager)
16
+ - [Table of Contents](#table-of-contents)
17
+ - [Features](#features)
18
+ - [Comparison with Other Libraries](#comparison-with-other-libraries)
19
+ - [Why Choose ReCA?](#why-choose-reca)
20
+ - [Installation](#installation)
21
+ - [Using npm](#using-npm)
22
+ - [Using yarn](#using-yarn)
23
+ - [Using pnpm](#using-pnpm)
24
+ - [Setup](#setup)
25
+ - [Examples](#examples)
26
+ - [Quick Start - Counter Example](#quick-start---counter-example)
27
+ - [ToDo Example](#todo-example)
28
+ - [Example low-level Store](#example-low-level-store)
29
+ - [Advanced Example - Dependency Injection for Enterprise Applications](#advanced-example---dependency-injection-for-enterprise-applications)
30
+ - [Documentation and Resources](#documentation-and-resources)
31
+ - [Documentation](#documentation)
32
+ - [Community and Support](#community-and-support)
33
+ - [Contributing](#contributing)
34
+ - [License](#license)
35
+
13
36
  ## Features
14
37
 
15
38
  - **Microstores** - calculations state of components don't affect to other components, small CPU usage for update states,
@@ -21,29 +44,106 @@ Created at the intersection of Functional style and OOP technologies. It is base
21
44
  - **Code Organization** - structures the code easily even for large enterprise applications,
22
45
  - **Extra Small Size** - only 1kb of minified code.
23
46
 
24
- ## Why not Redux or Flux?
47
+ ## Comparison with Other Libraries
48
+
49
+ | Feature | ReCA | Zustand | MobX | Redux |
50
+ |---------|------|----------|------|-------|
51
+ | **Bundle Size** | ~1KB | ~1KB | ~16KB | ~8KB |
52
+ | **Boilerplate** | Minimal | Minimal | Medium | Heavy |
53
+ | **Learning Curve** | Easy | Easy | Medium | Steep |
54
+ | **TypeScript** | Built-in | Good | Good | Good |
55
+ | **Performance** | Excellent | Excellent | Excellent | Good |
56
+ | **Dependency Injection** | ✅ Built-in | ❌ Manual | ❌ Manual | ❌ Manual |
57
+ | **Clean Architecture** | ✅ Native | ❌ Limited | ⚠️ Requires setup | ⚠️ Requires setup |
58
+ | **Microstores** | ✅ Yes | ✅ Yes | ✅ Yes | ❌ Monostore |
59
+ | **SSR Support** | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
60
+ | **Middleware** | Via DI | ✅ Yes | ❌ Limited | ✅ Yes |
61
+ | **Async Actions** | ✅ Native | ✅ Native | ✅ Native | ⚠️ Requires thunk/saga |
62
+
63
+ ### Why Choose ReCA?
64
+
65
+ - **Smallest footprint** - Only 1KB minified, same as Zustand but with more features
66
+ - **Zero boilerplate** - No actions, reducers, or dispatchers needed
67
+ - **Enterprise-ready** - Built-in DI and Clean Architecture support
68
+ - **Developer-friendly** - Simple API, easy to learn and use
69
+ - **Flexible** - Choose between AutoStore (automatic) or Store (manual control)
70
+ - **Type-safe** - Full TypeScript support out of the box
71
+
72
+ ## Installation
73
+
74
+ ### Using npm
75
+
76
+ ```bash
77
+ npm install reca reflect-metadata
78
+ ```
25
79
 
26
- - **Monostore** - as the application grows, the cost of maintaining a monostore greatly exceeds the useful work.
27
- - **Reducers** - a large number of reducers makes you spend a lot of time searching for the necessary function.
28
- - **Architecture problem** - forces you to use tons of additional packages to solve problems, such as saga, thunk, toolkit and many others.
80
+ ### Using yarn
29
81
 
30
- ## Instalation
82
+ ```bash
83
+ yarn add reca reflect-metadata
84
+ ```
31
85
 
32
- npm:
86
+ ### Using pnpm
33
87
 
34
- ``` bash
35
- npm install reca
88
+ ```bash
89
+ pnpm add reca reflect-metadata
36
90
  ```
37
91
 
38
- yarn
92
+ ### Setup
93
+
94
+ After installation, import `reflect-metadata` at the entry point of your application (e.g., `index.tsx` or `main.tsx`):
95
+
96
+ ```typescript
97
+ import "reflect-metadata";
98
+ import React from "react";
99
+ import ReactDOM from "react-dom/client";
100
+ import { App } from "./App";
39
101
 
40
- ``` bash
41
- yarn add reca
102
+ ReactDOM.createRoot(document.getElementById("root")!).render(<App />);
42
103
  ```
43
104
 
105
+ > **Note:** The `reflect-metadata` package is required for dependency injection functionality. Make sure to import it before any other imports in your application entry point.
106
+
44
107
  ## Examples
45
108
 
46
- ### Example AutoStore
109
+ ### Quick Start - Counter Example
110
+
111
+ A simple example to get you started with ReCA:
112
+
113
+ ```typescript
114
+ // counter.store.ts
115
+ import { AutoStore } from "reca";
116
+
117
+ export class CounterStore extends AutoStore {
118
+ public count: number = 0;
119
+
120
+ public increment(): void {
121
+ this.count++;
122
+ }
123
+
124
+ public decrement(): void {
125
+ this.count--;
126
+ }
127
+ }
128
+
129
+ // Counter.tsx
130
+ import { useStore } from "reca";
131
+ import { CounterStore } from "./stores/counter.store";
132
+
133
+ export const Counter = () => {
134
+ const store = useStore(CounterStore);
135
+
136
+ return (
137
+ <div>
138
+ <h1>Count: {store.count}</h1>
139
+ <button onClick={store.increment}>+1</button>
140
+ <button onClick={store.decrement}>-1</button>
141
+ </div>
142
+ );
143
+ };
144
+ ```
145
+
146
+ ### ToDo Example
47
147
 
48
148
  Create your Store by inheriting from AutoStore, and use it in a component via useStore hook.
49
149
 
@@ -179,11 +279,25 @@ export const ToDoComponent = (): JSX.Element => {
179
279
  };
180
280
  ```
181
281
 
182
- ### Example using DI
282
+ ### Advanced Example - Dependency Injection for Enterprise Applications
183
283
 
184
- This example demonstrates the simplicity of the business logic and the simplified principles of code organization according to the Clean Architecture methodology. The example is simplified for readme, but following the same principles you can organize a full-fledged Clean Architecture. Through the service constructor, you can pass other DI dependencies, such as Repository, Provider, and others.
284
+ This example demonstrates how to build scalable enterprise applications using ReCA with Dependency Injection. It shows the simplicity of business logic organization following Clean Architecture principles.
185
285
 
186
- ``` typescript
286
+ The example includes:
287
+
288
+ - **Service Layer** - encapsulates business logic and external API calls
289
+ - **Model Layer** - defines data structures
290
+ - **Store Layer** - manages state and coordinates services
291
+ - **Component Layer** - pure view logic
292
+
293
+ This architecture makes your code:
294
+
295
+ - **Testable** - easily mock services for unit tests
296
+ - **Maintainable** - clear separation of concerns
297
+ - **Scalable** - add new features without modifying existing code
298
+ - **Flexible** - swap implementations through DI (e.g., Repository, Provider, Logger)
299
+
300
+ ```typescript
187
301
  // SpaceXCompanyInfo.ts
188
302
  export class SpaceXCompanyInfo {
189
303
 
@@ -284,11 +398,26 @@ export const TestStoreComponent = (): JSX.Element => {
284
398
 
285
399
  ```
286
400
 
287
- ## Support and Documentation
401
+ ## Documentation and Resources
402
+
403
+ ### Documentation
404
+
405
+ - **[Wiki](https://github.com/LabEG/reca/wiki)** - Comprehensive guides, tutorials, and API reference
406
+ - **[API Documentation](https://github.com/LabEG/reca/wiki)** - Detailed API documentation for all features
407
+
408
+ ### Community and Support
409
+
410
+ - **[Discord Server](https://discordapp.com/channels/974049080454045796/974049142022209566)** - Join our community for real-time help and discussions
411
+ - **[GitHub Discussions](https://github.com/LabEG/reca/discussions)** - Ask questions and share ideas
412
+ - **[GitHub Issues](https://github.com/LabEG/reca/issues)** - Report bugs or request features
413
+
414
+ ### Contributing
288
415
 
289
- Discord server: [click here](https://discordapp.com/channels/974049080454045796/974049142022209566)
416
+ We welcome contributions! See our:
290
417
 
291
- Wiki: [click here](https://github.com/LabEG/reca/wiki)
418
+ - **[Contributing Guide](CONTRIBUTING.md)** - Learn how to contribute to the project
419
+ - **[Code of Conduct](CODE_OF_CONDUCT.md)** - Our community guidelines
420
+ - **[Security Policy](SECURITY.md)** - How to report security vulnerabilities
292
421
 
293
422
  ## License
294
423
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reca",
3
- "version": "2.3.8",
3
+ "version": "2.4.1",
4
4
  "description": "ReCA - React Clean Architecture state manager",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",