@@ -37,8 +37,8 @@ Feel free to choose one of them and adapt it to your needs.
3737## 🚀 Inspiration 1
3838
3939The ` Style Guide 1 ` is intended for ** smaller and medium size applications**
40- with about ` 1-3 ` entities. In AgileTs, ` entities ` are things with distinct
41- and independent existence like users, posts, or todos.
40+ with about ` 1-3 ` entities. ( In AgileTs, ` entities ` are things with distinct
41+ and independent existence like users, posts, or todos.)
4242We put everything related to these entities
4343into a single file of truth called ` store.js ` or ` core.js ` .
4444In the end, the ` core ` file contains all the business logic of your application,
@@ -72,25 +72,20 @@ how it can be constructed.
7272
7373### 📝 store.ts
7474
75- In the ` store.ts ` file, we instantiate the Agile Instance (` Agile ` )
76- and define all [ Agile Sub Instances] ( ../main/Introduction.md#agile-sub-instance ) (` MY_TODOS ` ).
77- In addition, all actions (` updateTodo() ` , ` toogleTodo() ` , ..)
78- and if you are using Typescript interfaces (` TodoInterface ` ) are located here.
75+ In the ` store.ts ` file, we instantiate all [ Agile Sub Instances] ( ../main/Introduction.md#agile-sub-instance ) (` MY_TODOS ` ),
76+ define all actions (` updateTodo() ` , ` toogleTodo() ` , ..)
77+ and if you are using Typescript interfaces (` TodoInterface ` ) are located here too.
7978``` ts title="store.ts"
80- import { Agile , assignSharedAgileInstance } from " @agile-ts/core" ;
81- import reactIntegration from " @agile-ts/react" ;
79+ import { createCollection } from " @agile-ts/core" ;
8280
83- export interface TodoInterface {
81+ export interface TodoItemInterface {
8482 id: number ;
8583 text: string ;
8684 done: boolean ;
8785}
8886
89- // Create Agile Instance
90- const App = new Agile ().integrate (reactIntegration );
91-
9287// Create Collection (a dynamic set of States)
93- export const MY_TODOS = App . createCollection <TodoInterface >({
88+ export const MY_TODOS = createCollection <TodoItemInterface >({
9489 key: " todos"
9590}).persist (); // perist does store the Collection in the Local Storage
9691
@@ -138,7 +133,7 @@ We can easily differentiate between global and local States in our UI-Components
138133
139134The ` Style Guide 2 ` is intended for ** medium size and large applications**
140135with more than ` 3 ` entities.
141- In AgileTs, ` entities ` are things with distinct and independent existence like users, posts, or todos.
136+ ( In AgileTs, ` entities ` are things with distinct and independent existence like users, posts, or todos.)
142137At first glance, this way of organizing your application looks very boiler-late-ey.
143138Each entity has its own directory with a bunch of files.
144139However, there is a system behind it,
194189| └── user .controller .ts
195190| └── user .interfaces .ts
196191| └── user .routes .ts
197- | ── app .ts
198192| ── index .ts
199193.
200194```
@@ -309,15 +303,15 @@ and contains the [Agile Sub Instances](../main/Introduction.md#agile-sub-instanc
309303These Agile Sub Instances can and should then only be modified by the actions ([ actions.ts] ( #1-actionsts ) )
310304or bound to UI-Components in the UI-Layer for reactivity.
311305``` ts title="todo.controller.ts in 📁todo"
312- import {App } from ' ../../app ' ;
306+ import {createCollection , createComputed } from " @agile-ts/core " ;
313307import {TodoInterface } from ' ./todo.interfaces' ;
314308import {CURRENT_USER } from ' ../user'
315309
316310// Contains all existing TODO's
317- export const TODOS = App . createCollection <TodoInterface >()();
311+ export const TODOS = createCollection <TodoInterface >()();
318312
319313// Contains all TODO's that belong to the current logged in USER
320- export const USER_TODOS = App . createComputed (() => {
314+ export const USER_TODOS = createComputed (() => {
321315 return TodosCollection .getGroup (CURRENT_USER .value .id ).output ;
322316});
323317```
@@ -377,33 +371,6 @@ export const ADD_TODO = async (payload: AddTodoPayloadInterface): Promise<TodoIn
377371// ..
378372```
379373
380- ## 📝 app.ts
381-
382- ::: note
383-
384- If you decided to use the
385- [ shared Agile Instance] ( ../packages/core/api/agile-instance/Introduction.md#-shared-agile-instance )
386- you can skip this part.
387-
388- :::
389-
390- In the ` app.ts ` file, we create our main ` Agile Instance ` and configure it to meet our needs.
391- For example, we determine here with which UI-Framework AgileTs should work together.
392-
393- ``` ts title="app.ts"
394- import {Agile , Logger , assignSharedAgileInstance } from " @agile-ts/core" ;
395- import reactIntegration from " @agile-ts/react" ;
396-
397- export const App = new Agile ({
398- logConfig: {
399- level: Logger .level .WARN
400- }
401- }).integrate (reactIntegration );
402-
403- // Assign created Agile Instance as shared Agile Instance
404- assignSharedAgileInstance (App );
405- ```
406-
407374## 📝 index.ts
408375
409376Here we export our ` core ` entities, so that each entity
0 commit comments