# @gzl10/nexus-sdk

[![npm version](https://img.shields.io/npm/v/@gzl10/nexus-sdk.svg)](https://www.npmjs.com/package/@gzl10/nexus-sdk)
[![npm downloads](https://img.shields.io/npm/dm/@gzl10/nexus-sdk.svg)](https://www.npmjs.com/package/@gzl10/nexus-sdk)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

> **Warning**: This project is currently in testing/experimental phase. Use at your own risk.

SDK types for creating Nexus plugins and modules. Provides TypeScript interfaces and type definitions for building modular backends.

**Repository**: [https://gitlab.gzl10.com/oss/nexus](https://gitlab.gzl10.com/oss/nexus)

## Installation

```bash
pnpm add @gzl10/nexus-sdk
```

## Usage

```typescript
import type {
  ModuleManifest,
  PluginManifest,
  EntityDefinition,
  ModuleContext
} from '@gzl10/nexus-sdk'

// Define a module
const manifest: ModuleManifest = {
  name: 'my-module',
  label: 'My Module',
  description: 'A custom Nexus module',
  type: 'core',
  dependencies: []
}

// Define entity
const entity: EntityDefinition = {
  name: 'products',
  type: 'collection',
  label: 'Products',
  fields: [
    { name: 'title', type: 'string', required: true },
    { name: 'price', type: 'decimal', required: true }
  ]
}
```

## Exported Types

| Type | Description |
| ---- | ----------- |
| `ModuleManifest` | Module metadata definition |
| `PluginManifest` | Plugin metadata definition |
| `EntityDefinition` | Entity schema definition |
| `ModuleContext` | Context passed to module lifecycle hooks |
| `ModuleRequirements` | Module dependencies and requirements |
| `ModuleMiddlewares` | Express middleware configuration |
| `ModuleAbilities` | CASL ability definitions |
| `Request` | Express Request type |
| `Response` | Express Response type |
| `Router` | Express Router type |
| `Category` | Entity category type |

## Development

```bash
pnpm build      # Build library
pnpm typecheck  # Type check
pnpm lint       # Linting
pnpm clean      # Clean build artifacts
```

## Support

<a href="https://www.buymeacoffee.com/gzl10g" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>

## License

MIT
