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:

  1. Add to devDependencies: Open your package.json file and add the module to the devDependencies section.

  2. Install Modules: Run the command npm install. This acts as the first pass, downloading the modules.

  3. Install Dependencies: Run npm install a 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 useGetInfos to access user profile data and useHasAllRoles / <CheckRoles> for permission handling.
    • Utilities: Features CrossTabEvent for synchronizing state across multiple browser tabs.

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 AuthController is 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.

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 useMenu and useMatchingItem for easy integration in React components.