@airoom/nextmin-react
v1.4.3
Published
Plug‑and‑play React Admin Panel that connects to a `@airoom/nextmin-node` backend. Render an authenticated dashboard with lists, forms, file uploads, settings, and live updates — generated from your JSON schemas.
Readme
@airoom/nextmin-react
Plug‑and‑play React Admin Panel that connects to a @airoom/nextmin-node backend. Render an authenticated dashboard with lists, forms, file uploads, settings, and live updates — generated from your JSON schemas.
- “From JSON schema to REST API + Admin”
- 1 month → 1 hour
- Works out of the box with Next.js (App Router and Pages Router)
Documentation
Read the full documentation at: https://nextmin.gscodes.dev/
Features
<NextMinProvider>: initializes store, loads schemas, and opens a live socket<AdminApp>: full admin shell with auth, sidebar, dashboard, list/create/edit, profile, settings- Built‑in router:
<NextMinRouter>and<AdminRouteNormalizer>for admin routes - Components: Sidebar, SchemaForm, FileUploader, reference selectors, phone/password inputs, table & filters
- Hooks/utils: Google address autocomplete, list data helpers, formatters
- Styling included; no extra CSS import needed
Installation
# npm
npm install @airoom/nextmin-react
# yarn
yarn add @airoom/nextmin-react
# pnpm
pnpm add @airoom/nextmin-reactConfigure environment
Create or update your frontend env file (e.g., .env.local) with the server base URL and client API key:
NEXT_PUBLIC_NEXTMIN_API_URL=http://localhost:8081/rest
# IMPORTANT: Use the API key stored in your database → Settings.apiKey
NEXT_PUBLIC_NEXTMIN_API_KEY=your_api_key_hereNotes
NEXT_PUBLIC_NEXTMIN_API_URLshould point to your nextmin-node REST base (e.g., http://host:port/rest)NEXT_PUBLIC_NEXTMIN_API_KEYmust match the value in your backend DB Settings document’sapiKeyfield
Where to find the API key
- Start your nextmin-node server once
- Open the database and locate the Settings collection/table
- Copy the first Settings document’s
apiKeyvalue and paste it here
Next.js setup (App Router)
Wrap only the admin area with the provider and render the AdminApp. Mark these files as client components.
// app/admin/layout.tsx
'use client'
import { NextMinProvider } from '@airoom/nextmin-react';
export default function AdminLayout({ children }: { children: React.ReactNode }) {
return <NextMinProvider>{children}</NextMinProvider>;
}// app/admin/page.tsx
'use client'
import { AdminApp } from '@airoom/nextmin-react';
export default function AdminIndex() {
return <AdminApp />;
}// app/admin/[...slug]/page.tsx
'use client'
import { AdminApp } from '@airoom/nextmin-react';
export default function AdminCatchAll() {
return <AdminApp />;
}Behavior
- Unauthenticated users are redirected to
/admin/auth/sign-in - Authenticated users visiting
/admin/auth/*are redirected to/admin/dashboard - Sidebar and pages are rendered according to the schemas loaded from your backend
Pages Router (alternative)
// pages/admin.tsx
import dynamic from 'next/dynamic';
const Admin = dynamic(() => import('@airoom/nextmin-react').then(m => m.AdminApp), { ssr: false });
export default Admin;Wrap with <NextMinProvider> at a top level where appropriate (e.g., _app.tsx) and ensure it runs on the client.
Default admin credentials (after setup)
After completing the backend setup, sign in with the default super user and change the password immediately:
- Email: [email protected]
- Username: superadmin
- Password: supersecurepassword
Usage notes
- No extra CSS import required; the package bundles its styles
- Backend auth/paths are configured via env vars (see above)
- Add custom links to routes like
/admin/<model>/createor/admin/<model>/<id> - The first Settings document (model name "Settings") controls site name, logo, and Google Maps key for address autocomplete
TypeScript
Types are bundled with the package.
import type { ApiItemResponse } from '@airoom/nextmin-react/types';Troubleshooting
- 401 Unauthorized: ensure
NEXT_PUBLIC_NEXTMIN_API_KEYmatches your DBSettings.apiKey - Cannot load schemas: verify
NEXT_PUBLIC_NEXTMIN_API_URLpoints to/restand the backend is reachable - Address autocomplete: set
NEXT_PUBLIC_GOOGLE_MAPS_KEYin your environment and in the Settings document if applicable - Blank page on Next.js: ensure admin files are client components (
'use client') and dynamic imports havessr: falsewhere necessary
License
Licensed under the Nextmin Proprietary License. © 2025 GSCodes. For commercial licensing or extended rights, contact: [email protected].
