Skip to main content

CRUD Package

The @repo/crud package extends the data package with additional features like permissions, auditing, and plugins. It provides a comprehensive framework for building CRUD (Create, Read, Update, Delete) operations in your application.

Features

  • Enhanced CRUD Operations: Built on top of the data package with additional functionality
  • Permissions System: Fine-grained access control for CRUD operations
  • Audit Logging: Track changes to data with detailed audit logs
  • Plugin Architecture: Extend functionality with custom plugins
  • React Integration: Hooks and components for seamless React integration
  • Internationalization: Support for multiple languages
  • Customizable UI: Flexible UI components for building admin interfaces

Installation

This package is part of the zopio monorepo and is available to all applications in the workspace.

Package Structure

The CRUD package is organized into several subpackages:
  • Engine: Core CRUD functionality built on top of data providers
  • Hooks: React hooks for CRUD operations
  • UI: UI components for CRUD operations
  • Permissions: Access control for CRUD operations
  • Plugins: Extensibility points for CRUD operations
  • Audit: Tracking changes to data

Dependencies

The CRUD package depends on the following packages:
  • @repo/data: Core data management and provider packages
  • next-intl: Internationalization support

Basic Usage

Creating a CRUD Engine

Performing CRUD Operations

Using React Hooks

Using UI Components

Detailed Documentation

For more detailed information on using the CRUD package, see the following pages:

Core Concepts

CRUD Engine

The CRUD Engine is the core of the package, providing enhanced CRUD operations with support for plugins, permissions, and auditing. It wraps a data provider from the @repo/data package and adds additional functionality.

Plugin System

The plugin system allows you to extend the functionality of the CRUD engine with custom hooks that run before and after CRUD operations:

Permissions System

The permissions system provides fine-grained access control for CRUD operations, allowing you to define who can perform which operations on which resources:

Audit System

The audit system tracks changes to data, recording who made what changes and when:

Environment Variables

The CRUD package may use the following environment variables:

API Reference

For a complete API reference, please refer to the TypeScript definitions in the package or explore the detailed documentation pages.