Skip to content

rasitcolakel/refisma

Repository files navigation

Refisma

Refisma is a tool to help you create CRUD applications by using Prisma. It generates services and endpoints for you, so you can focus on the business logic.

Description

Refisma is a tool to help you create CRUD applications by using Prisma. It generates services and endpoints for you, so you can focus on the business logic.

Supported Platforms

  • Next.js
  • Node.js (Express)

Supported UI Frameworks

  • MaterialUI
  • ChakraUI
  • Ant Design
  • Mantine

Upcoming Features

  • Types will be based on the Prisma schema
  • Zod validation
  • Pagination
  • Sorting
  • Filtering
  • Generating services and endpoints for Relations
    • One to One
    • One to Many
    • Many to Many
  • Refine Pages (Only for Next.js & MaterialUI)
    • List Page
    • Create Page
    • Edit Page
    • Show Page
  • Custom identifier for resources
  • Providers
    • Auth
    • i18n
    • Access Control
  • Compiler For Refisma
    • hide fields on views (list, create, edit, show)
    • fields accessiblities (list, create, edit, show)
  • Middlewares
    • Zod validation
    • Access Control

Installation

npm install refisma

Usage

npx refisma

Packages Needed

npm install @prisma/client zod
npm install prisma --save-dev

.env file

DATABASE_URL=""
NEXT_PUBLIC_SERVER_API_URL='http://localhost:3000/api'

Adding Aliases

You need to add aliases to your tsconfig.json file.

{
  ...
    "paths": {
      "@services/*": ["services/*"],
      "@schemas/*": ["schemas/*"],
      ...
    }
  ...
}

### Adding New Resources to _app.tsx file

The example below shows how to add a new resource to the _app.tsx file.

  <Refine
    ...
    resources={[
      ...
      {
          name: '{{resourceName}}',
          list: '/{{resourceName}}',
          create: '/{{resourceName}}/create',
          edit: '/{{resourceName}}/edit/:id',
          show: '/{{resourceName}}/show/:id',
          meta: {
              canDelete: true,
          },
      }
      ...
    ]}
    ...
  >

Generating Types for Prisma

npx prisma generate

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published