A React frontend template tailored for enterprise applications, designed to help teams build scalable, maintainable, and well-architected UI projects.
-
Storybook integration
Seamlessly collaborate between UX designers and developers with UX guidelines embedded in the documentation. -
Atomic Design component structure
Promote reusable and consistent UI building blocks. -
Layered architecture
Cleanly separate client-side business logic from UI code. -
Command & Query Responsibility Segregation (CQRS)
Clearly separate commands (actions) from queries (data fetching), improving code organization and maintainability. -
RxJS-powered state management
Enable a reactive programming style with data streams. -
Fitness functions
Enforce and validate adherence to architectural principles during development.
- React
- TypeScript
- RxJS
- tsyringe (dependency injection)
- Tailwind CSS
- class-variance-authority (utility for managing class names)
- i18n (internationalization)
The Presentation directory follows Atomic Design principles, dividing components into:
-
Atoms
Basic UI elements without business logic (e.g., buttons, inputs). -
Molecules
Simple groups of atoms functioning together. -
Organisms and Pages
Larger components and views that can subscribe toViewModelsor dispatchEventsvia theApplicationlayer.
Note:
atomsandmolecules(inPresentation/Core) contain no business logic.organismsandpageslive in business-domain subdirectories, connect to the application layer, and handle domain interactions.
-
Presentation
UI components following atomic design. -
Application
Bridges UI and domain, prepares data for display. -
Domain
Core business models, rules, and event handling. -
Infrastructure
Technical concerns like API integration and data storage.
Inspired by Flux but using continuous event streams instead of a central store. Developers control UI updates (e.g., pause updates during user input).
Event Handler Example
import {
EventHandler,
type IEventHandler,
} from '@juwel-development/react-observable-tools';
@EventHandler("YOUR_EVENT_NAME")
class SomeEventHandler implements IEventHandler<YourEvent> {
public handle(event: YourEvent): void {
// Your business logic here
}
}In CQRS, it's a common pattern to allow the application layer to retrieve data directly from the infrastructure layer. This project follows that pattern.
Also, do not hesitate to use the Global Event Stream (GlobalEvent$) to build your view models based on application events.
This template does not use common state management patterns found in React applications, such as Redux or Zustand. Instead, it uses the approach of data streams.
Real-world example: Imagine you, as a human being, are an "observer" watching what happens in the world. Based on what you observe, you make decisions and take actions. This is the same approach used in this template.
This approach makes the application independent of the backend technology used. It can work with a REST API, GraphQL, or any streaming API ( e.g., a CQRS backend or Google Firebase) by implementing your repositories accordingly.