
Security News
/Company News
Socket Is Sponsoring Composer and Packagist
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.
@abpjs/core
Advanced tools
Core infrastructure package for ABP Framework in React
@abpjs/core is the foundational package of the ABP React ecosystem. It provides the essential infrastructure, state management, authentication, localization, and API communication layers that power all other @abpjs/* packages.
This package is a React translation of the original @abp/ng.core Angular package, maintaining API compatibility while leveraging modern React patterns including hooks, context, and Redux Toolkit.
oidc-client-ts# Using npm
npm install @abpjs/core
# Using yarn
yarn add @abpjs/core
# Using pnpm
pnpm add @abpjs/core
Ensure you have the following peer dependencies installed:
npm install react react-dom react-redux @reduxjs/toolkit axios oidc-client-ts
Wrap your application with the ABP Core provider:
import { CoreProvider } from '@abpjs/core';
const environment = {
production: false,
application: {
name: 'My ABP App',
},
oAuthConfig: {
issuer: 'https://your-identity-server.com',
clientId: 'MyApp_React',
scope: 'openid profile email MyApp',
responseType: 'code',
},
apis: {
default: {
url: 'https://your-api-server.com',
},
},
};
function App() {
return (
<CoreProvider environment={environment}>
<YourApp />
</CoreProvider>
);
}
import { useAuth } from '@abpjs/core';
function LoginButton() {
const { isAuthenticated, login, logout, user } = useAuth();
if (isAuthenticated) {
return (
<div>
<span>Welcome, {user?.name}</span>
<button onClick={logout}>Logout</button>
</div>
);
}
return <button onClick={login}>Login</button>;
}
import { usePermission } from '@abpjs/core';
function AdminPanel() {
const { hasPermission } = usePermission();
if (!hasPermission('MyApp.Admin.Dashboard')) {
return <div>Access Denied</div>;
}
return <div>Admin Dashboard Content</div>;
}
import { useLocalization } from '@abpjs/core';
function WelcomeMessage() {
const { t } = useLocalization();
return <h1>{t('::Welcome')}</h1>;
}
Note:
t()is the primary translation function (React convention). Aninstant()alias is also available for developers familiar with ABP Angular.
import { useRestService } from '@abpjs/core';
function UsersList() {
const rest = useRestService();
const [users, setUsers] = useState([]);
useEffect(() => {
rest.request({
method: 'GET',
url: '/api/app/users',
}).then(response => setUsers(response.items));
}, []);
return (
<ul>
{users.map(user => <li key={user.id}>{user.name}</li>)}
</ul>
);
}
| Hook | Description |
|---|---|
useAuth() | Authentication state and methods (login, logout, user info) |
useConfig() | Access application configuration |
useDirection() | RTL/LTR direction based on current language |
useLocalization() | Localization and translation functions |
usePermission() | Permission checking utilities |
useProfile() | Current user profile management |
useSession() | Session state management |
The useDirection() hook provides RTL (Right-to-Left) support for Arabic, Hebrew, Persian, Urdu, and other RTL languages:
import { useDirection } from '@abpjs/core';
function MyComponent() {
const { direction, isRtl, startSide, endSide } = useDirection();
return (
<div dir={direction}>
{/* direction: 'rtl' or 'ltr' */}
{/* isRtl: boolean */}
{/* startSide: 'left' (LTR) or 'right' (RTL) */}
{/* endSide: 'right' (LTR) or 'left' (RTL) */}
<Menu.Root positioning={{ placement: `${endSide}-start` }}>
{/* Menu opens on opposite side of content */}
</Menu.Root>
</div>
);
}
| Service | Description |
|---|---|
ApplicationConfigurationService | Fetches and manages ABP application configuration |
ConfigService | Handles runtime configuration state |
ProfileService | User profile API operations |
LocalizationService | Translation and localization services |
RestService | HTTP client abstraction with interceptors |
LazyLoadService | Dynamic module and script loading |
| Slice | Description |
|---|---|
configSlice | Application configuration state |
profileSlice | User profile state |
sessionSlice | Session and authentication state |
The package exports comprehensive TypeScript models for:
ApplicationConfiguration)PagedResultDto, ListResultDto)| Feature | @abp/ng.core (Angular) | @abpjs/core (React) |
|---|---|---|
| State Management | NgRx + RxJS | Redux Toolkit |
| DI Pattern | Angular DI | React Context + Hooks |
| Reactivity | RxJS Observables | React hooks + useEffect |
| Bundle Size | Larger (Angular overhead) | Smaller (React focused) |
| Learning Curve | Angular knowledge required | React developers friendly |
interface Environment {
production: boolean;
application: {
name: string;
logoUrl?: string;
};
oAuthConfig: {
issuer: string;
clientId: string;
scope: string;
responseType: string;
redirectUri?: string;
postLogoutRedirectUri?: string;
};
apis: {
default: {
url: string;
rootNamespace?: string;
};
[key: string]: {
url: string;
rootNamespace?: string;
};
};
localization?: {
defaultResourceName?: string;
};
}
This package is part of the ABP React monorepo. Contributions are welcome!
LGPL-3.0 - See LICENSE for details.
FAQs
ABP Framework Core for React - Translation of @abp/ng.core
The npm package @abpjs/core receives a total of 42 weekly downloads. As such, @abpjs/core popularity was classified as not popular.
We found that @abpjs/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Company News
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.

Research
/Security News
Benign-looking npm packages split malicious functionality across a dependency chain that deploys a cross-platform RAT targeting Alibaba developers.

Research
/Security News
Two Joyfill npm beta releases contain an import-time implant that uses blockchain transactions to retrieve a remote-access trojan.