• Stars
    star
    297
  • Rank 140,075 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 1 year ago
  • Updated 28 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

▲ Full-featured admin for Next.js and Prisma

Next Admin

License Version

next-admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your project.

https://next-admin.js.org

Features

  • 💅 Customizable admin dashboard
  • 💽 Database relationships management
  • 👩🏻‍💻 User management (CRUD operations)
  • 🎨 Dashboard widgets and customizable panels
  • ⚛️ Integration with Prisma ORM
  • 👔 Customizable list and form
  • ⚙️ Supports App Router and Page Router

Installation

To install the library, run the following command:

yarn add @premieroctet/next-admin prisma-json-schema-generator

Documentation

For detailed documentation, please refer to the documentation.

Usage

To use the library in your Next.js application, follow these steps:

  1. Create an admin route in your Next.js application.
  2. Add the file [[...nextadmin]].js to the pages/admin directory.
  3. Export the NextAdmin component from the file.
  4. Use getServerSideProps to pass the props from the nextAdminRouter to the NextAdmin component.

Bonus: Customize the admin dashboard by passing the NextAdminOptions options to the router and customize the admin dashboard by passing dashboard props to NextAdmin component. (More details in the documentation)

Example

Here's a basic example of how to use the library:

App router

// app/admin/[[...nextadmin]]/page.tsx
import { NextAdmin } from "@premieroctet/next-admin";
import { getPropsFromParams } from "@premieroctet/next-admin/dist/appRouter";
import "@premieroctet/next-admin/dist/styles.css";
import Dashboard from "../../../components/Dashboard";
import { options } from "../../../options";
import { prisma } from "../../../prisma";
import schema from "../../../prisma/json-schema/json-schema.json"; // generated by prisma-json-schema-generator on yarn run prisma generate
import "../../../styles.css";
import { submitFormAction } from "../../../actions/nextadmin";

export default async function AdminPage({
  params,
  searchParams,
}: {
  params: { [key: string]: string[] };
  searchParams: { [key: string]: string | string[] | undefined } | undefined;
}) {
  const props = await getPropsFromParams({
    params: params.nextadmin,
    searchParams,
    options,
    prisma,
    schema,
    action: submitFormAction,
  });

  return <NextAdmin {...props} dashboard={Dashboard} />;
}

Page Router

import { PrismaClient } from "@prisma/client";
import schema from "./../../../prisma/json-schema/json-schema.json"; // generated by prisma-json-schema-generator on yarn run prisma generate
import "@premieroctet/next-admin/dist/styles.css";
import {
  AdminComponentProps,
  NextAdmin,
  NextAdminOptions,
} from "@premieroctet/next-admin";

const prisma = new PrismaClient();

export default function Admin(props: AdminComponentProps) {
  return <NextAdmin {...props} />;
}

export const getServerSideProps: GetServerSideProps = async ({ req, res }) => {
  const { nextAdminRouter } = await import(
    "@premieroctet/next-admin/dist/router"
  );

  const adminRouter = await nextAdminRouter(prisma, schema);
  return adminRouter.run(req, res) as Promise<
    GetServerSidePropsResult<{ [key: string]: any }>
  >;
};

Demonstration

You can find the library code in the next-admin repository.

Also you can find a deployed version of the library here.

License

This library is open source and released under the MIT License.

More Repositories

1

openchakra

⚡️ Full-featured visual editor and code generator for React using Chakra UI
TypeScript
2,963
star
2

screen-guru

🔮 Screen Guru takes clean screenshot of any websites
TypeScript
516
star
3

next-crud

Full-featured CRUD routes for Next.js
TypeScript
253
star
4

reactivated-app

Reactivated.app is an open-source app that scans your JS dependencies every 4 hours and generates cool dashboards
TypeScript
69
star
5

firstcommit

🎈 Dig up the first commit of any GitHub repo
TypeScript
56
star
6

digestclub

The frontpage of teams knowledge 🧞‍♂️
TypeScript
44
star
7

gatsby-remark-images-zoom

👀 Bring medium-zoom to gatsby-remark-images
JavaScript
35
star
8

directus-extension-sql-panel

This is a custom interface for Directus that allows you to display result of your SQL queries in a table
TypeScript
21
star
9

react-native-video-controls

Controls elements and utilities for react-native video players (react-native-video, expo-av, etc.).
TypeScript
19
star
10

training-platform

A tool to build courses and training decks.
TypeScript
14
star
11

wonder-wheel

🎡 IKEA LUSTIGT Wheel of Fortune hack with Particle Photon + RFID
TypeScript
12
star
12

final-form-persist

🏁 Persist your final-form values into a storage
TypeScript
9
star
13

react-native-wallet

A React-Native wrapper for Apple PassKit and Google Wallet API
Java
9
star
14

ai-filter-demo

Let's see how to integrate a smart filtering system into a Next.js application using the Vercel AI SDK. The idea is to allow the user to filter data using a simple description.
TypeScript
6
star
15

react-native-core-ml-post

React Native project for CoreML + React Native blog post
Objective-C
5
star
16

react-workspaces

⚛ Yarn workspaces with React & React Native projects for blog post
PHP
3
star
17

escape-game

🐇 Follow the white rabbit
JavaScript
2
star
18

save-the-stickmans

GDScript
1
star
19

demo-maestro

TypeScript
1
star