Jopi Modules
Discover the standard modules included in the JopiJS ecosystem.
JopiJS is built on a modular architecture where critical functionalities are encapsulated in specialized modules. These modules provide the foundation for your application.
Installation
To install a standard module in your JopiJS project, follow these steps:
-
Add to devDependencies: Open your
package.jsonfile and add the module to thedevDependenciessection. -
Install Modules: Run the command
npm install. This acts as the first pass, downloading the modules. -
Install Dependencies: Run
npm installa second time. This works recursively to install the dependencies of the newly added modules.Result: The modules will be installed in your
src/mod_[ModuleName]directory, ready for use.
Here is an overview of the primary modules available:
UI Core (@jopijs/jopimod_uicore)
Acting as the "Standard Library" of JopiJS, this module provides the essential tools and components for frontend development.
- Role: Standardizes routing, client-server communication, and user session management.
- Key Features:
- Routing: Exports standard hooks
useNavigate,useLocation, and the<Link>component. - Session Management: Includes
useGetInfosto access user profile data anduseHasAllRoles/<CheckRoles>for permission handling. - Utilities: Features
CrossTabEventfor synchronizing state across multiple browser tabs.
- Routing: Exports standard hooks
User Authentication (@jopijs/jopimod_user_auth)
A comprehensive authentication module that provides both server-side security and client-side interfaces.
- Role: Manages the entire authentication lifecycle, from registration to login and session maintenance.
- Key Features:
- JWT Security: Implements secure Json Web Token authentication by default.
- Ready-to-Use UI: Provides functional (albeit unstyled) Login and Register pages to get started quickly.
- Extensibility: The
AuthControlleris designed to be overridden, allowing seamless integration with any database (MySQL, PostgreSQL, MongoDB) while keeping the same API. - Server Protection: Automatically initializes security middleware to protect API routes.
Menu Management (@jopijs/jopimod_menu)
This module is the backbone of navigation within a JopiJS application. It separates menu logic from UI rendering, allowing for dynamic and reactive menu structures.
- Role: Centralizes the creation, manipulation, and rendering of menus (Top Menu, Sidebar, etc.).
- Key Features:
- Active State Detection: Automatically highlights the current menu item based on the browser URL.
- Reactivity: Menus update in real-time in response to system events (e.g., user login).
- Override System: External modules can inject or modify items in existing menus without changing the original code.
- Hooks: Provides
useMenuanduseMatchingItemfor easy integration in React components.