
Company News
Andrew Becherer Joins Socket as Chief Information Security Officer
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.
@deepsel/admin
Advanced tools
React building blocks for FastAPI + deepsel backends — auth, CRUD hooks, stores, and the admin UI shell.
React building blocks for FastAPI + deepsel backends — auth, CRUD hooks, stores, and the admin UI shell.
This README covers the standalone-host case: you have a FastAPI/deepsel backend and want to build a custom React frontend that uses @deepsel/admin's hooks and views without mounting the full admin app.
npm install @deepsel/admin
The package declares these as peer dependencies — install the matching versions in your app:
npm install \
react@^18 react-dom@^18 \
@mantine/core@8.3.15 @mantine/hooks@8.3.15 @mantine/modals@8.3.15 \
@mantine/dates@8.3.15 @mantine/form@8.3.15 \
react-router-dom@^7.6 \
i18next@^25 react-i18next@^13 \
zustand@^5 dayjs@^1.11
You have three options, picked in this priority order:
1. Runtime API (recommended for consumers) — call configureAdmin at app entry, before rendering any admin component:
import { configureAdmin } from '@deepsel/admin';
configureAdmin({ backendHost: 'http://localhost:8000' });
Or wrap your tree with <DeepselAdminProvider> — it applies the value synchronously before children render, so the first request sees the configured host:
import { DeepselAdminProvider } from '@deepsel/admin';
<DeepselAdminProvider backendHost="http://localhost:8000">
<YourAdminTree />
</DeepselAdminProvider>;
2. Build-time env var — for Vite consumers, set this in .env.development (or your shell):
VITE_PUBLIC_BACKEND=http://localhost:8000
3. Global — set window.PUBLIC_BACKEND before importing @deepsel/admin.
The package auto-appends /api/v1 if the URL doesn't already include it. The default dev login for a fresh deepsel backend is admin / 1234.
Your backend needs CORS configured to allow your dev origin with credentials (the package uses credentials: 'include' and httpOnly session cookies):
app.add_middleware(
CORSMiddleware,
allow_origin_regex=r"https?://(localhost|127\.0\.0\.1)(:\d+)?",
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
The hooks and Login require this provider tree, in this order. Drop into your src/main.jsx:
import React from 'react';
import { createRoot } from 'react-dom/client';
import { MantineProvider } from '@mantine/core';
import { ModalsProvider } from '@mantine/modals';
import { BrowserRouter } from 'react-router-dom';
import { I18nextProvider, initReactI18next } from 'react-i18next';
import i18n from 'i18next';
import { BasenameProvider } from '@deepsel/admin';
import '@mantine/core/styles.css';
import '@deepsel/admin/style.css';
import App from './App.jsx';
i18n.use(initReactI18next).init({
resources: { en: { translation: {} } },
lng: 'en',
fallbackLng: 'en',
interpolation: { escapeValue: false },
});
createRoot(document.getElementById('root')).render(
<I18nextProvider i18n={i18n}>
<BasenameProvider value="/">
<BrowserRouter>
<MantineProvider>
<ModalsProvider>
<App />
</ModalsProvider>
</MantineProvider>
</BrowserRouter>
</BasenameProvider>
</I18nextProvider>,
);
The order matters: Login uses useNavigate (needs Router), t() (needs i18n), Mantine components (needs MantineProvider), and useBasename (needs BasenameProvider). useModel's deleteWithConfirm opens a Mantine modal (needs ModalsProvider).
@deepsel/admin/style.css carries the bundled Mantine + cms-utils styles — without it, components render unstyled.
// src/App.jsx
import { useEffect, useState } from 'react';
import { Login, UserState, useAuthentication } from '@deepsel/admin';
import YourApp from './YourApp.jsx';
export default function App() {
const { user } = UserState();
const { fetchUser } = useAuthentication();
const [bootstrapping, setBootstrapping] = useState(true);
useEffect(() => {
fetchUser()
.catch(() => {})
.finally(() => setBootstrapping(false));
}, []);
if (bootstrapping) return null;
if (!user) return <Login defaultRedirect="/" />;
return <YourApp />;
}
fetchUser() calls GET /user/util/me with the session cookie; a 401 means the user isn't signed in. <Login> accepts a defaultRedirect prop (default /pages) — set it to wherever your app's authenticated home lives.
import { useModel } from '@deepsel/admin';
function ItemList() {
const { data, loading, create, update, deleteWithConfirm } = useModel('your_table', {
autoFetch: true,
pageSize: 50,
});
if (loading) return <p>Loading...</p>;
return (
<ul>
{data.map((item) => (
<li key={item.id} onClick={() => deleteWithConfirm(item.id)}>
{item.name}
</li>
))}
</ul>
);
}
useModel(modelName) hits POST /{modelName}/search, POST /{modelName}, PUT /{modelName}/{id}, DELETE /{modelName}/{id}. The model name is the backend __tablename__ (e.g. ims_insight, not Insight). Field shapes use the backend's snake_case directly — no transformation.
Once on a recent published version of @deepsel/admin (≥ 1.13), no special vite config is needed — peer deps prevent duplication. If you're consuming via a local file: link to source, add a minimal dedupe to be safe:
// vite.config.js
export default defineConfig({
resolve: {
dedupe: ['react', 'react-dom', '@mantine/core', '@mantine/hooks', '@mantine/modals'],
},
});
See src/index.js for the full surface. Highlights:
useModel, useFetch, useUpload, useAuthentication, useOrganization, useUserPreferences, usePageTitle, useQuery, usePagingTableParams, …Login, RequireAuth, VisibilityControl, AppLayout, App (the full admin shell)UserState, OrganizationIdState, BackendHostURLState, NotificationState, OrganizationState, …BasenameProvider, AIProviderConfigProviderFAQs
React building blocks for FastAPI + deepsel backends — auth, CRUD hooks, stores, and the admin UI shell.
The npm package @deepsel/admin receives a total of 277 weekly downloads. As such, @deepsel/admin popularity was classified as not popular.
We found that @deepsel/admin 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.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.