{"id":33510033,"url":"https://github.com/boris-fouomene/reslib","last_synced_at":"2026-04-10T11:02:22.634Z","repository":{"id":325905627,"uuid":"1102708993","full_name":"boris-fouomene/reslib","owner":"boris-fouomene","description":"Lightweight TypeScript library providing decorator-based resource management and utilities. Offers auth, i18n, validation, sessions, observables, and cross-platform support (web, Node.js, React Native, NestJS) with strong typing and modular design.","archived":false,"fork":false,"pushed_at":"2026-02-19T08:20:47.000Z","size":3032,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-11T19:37:52.283Z","etag":null,"topics":["api","authentication","dynamic","expo","extensible","i18n","javascript","nestjs","nextjs","nodejs","object-oriented-programming","react-native","reactjs","resources","safety","types","typescript","validation","web"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boris-fouomene.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-23T23:41:40.000Z","updated_at":"2026-02-19T08:20:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"22eac9a5-4b20-4704-95fc-7b144b4a1948","html_url":"https://github.com/boris-fouomene/reslib","commit_stats":null,"previous_names":["boris-fouomene/reslib"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/boris-fouomene/reslib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boris-fouomene%2Freslib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boris-fouomene%2Freslib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boris-fouomene%2Freslib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boris-fouomene%2Freslib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boris-fouomene","download_url":"https://codeload.github.com/boris-fouomene/reslib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boris-fouomene%2Freslib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31639524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","authentication","dynamic","expo","extensible","i18n","javascript","nestjs","nextjs","nodejs","object-oriented-programming","react-native","reactjs","resources","safety","types","typescript","validation","web"],"created_at":"2025-11-26T04:03:07.101Z","updated_at":"2026-04-10T11:02:22.621Z","avatar_url":"https://github.com/boris-fouomene.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"**ResLib** is a lightweight, production-ready TypeScript library for decorator-based resource management and application utilities. ResLib provides a modular framework for building scalable applications with features like authentication, internationalization, validation, session management, and observable patterns.\nIt is fully cross-platform—compatible with web, Node.js, React Native (including Expo), and server environments like NestJS—while delivering strong type safety, high flexibility, and optimized performance without relying on platform-specific dependencies.\n\n## **Table of Contents**\n\n- [Key Features](#key-features)\n- [Supported Platforms](#supported-platforms)\n- [Getting Started](#getting-started)\n- [Usage](#usage)\n- [Advanced Examples](#advanced-examples)\n- [Contributing](#contributing)\n- [License](#license)\n\n## 🚀 Key **Features**\n\n- **Decorator-Driven Resource Management**: Use decorators to intuitively define and manage resources, resulting in cleaner, more expressive code.\n- **Modular Architecture**: Treat every component as a resource, promoting reusability and better organization of application logic.\n- **Extensible Framework**: Effortlessly extend core functionalities by adding custom field types, decorators, and plugins tailored to specific project needs.\n- **Customizable FieldMeta Types**: Support for various built-in field types (such as number, dropdown, selectResource) that can be customized with specific properties for flexible data handling.\n- **Type Safety**: Developed with TypeScript, ensuring robust type-checking for a reliable foundation for scalable applications.\n- **Intuitive API**: Enjoy a developer-friendly API that leverages TypeScript features for smooth auto-completion and type hints.\n- **Dynamic Ecosystem**: Easily adapt to evolving project requirements by integrating external decorators and features, allowing for a responsive and flexible development environment.\n- **Production Ready**: Optimized for performance, with comprehensive testing, documentation, and support for major platforms.\n\n## 🌐 Supported Platforms\n\n- **Web**: Full browser support with modern bundlers\n- **React Native**: Seamless integration with Expo and bare React Native\n- **NestJS**: Server-side framework support for backend applications\n- **Node.js**: Server-side JavaScript runtime compatibility\n\n## ⚙️ **Getting Started**\n\nTo begin using **ResLib**, follow these steps:\n\n### **1\\. Prerequisites**\n\nMake sure you have the following installed on your machine:\n\n- Node.js (version 16 or higher)\n- npm (Node Package Manager)\n\n### **2\\. 🛠️ Install Required Packages**\n\nTo set up ResLib, run the following command:\n\n```typescript\nnpm install reslib reflect-metadata\n# or\nyarn add reslib reflect-metadata\n```\n\nFor Expo/React Native projects:\n\n```typescript\nnpx expo install reslib reflect-metadata\n```\n\nFor NestJS projects:\n\n```typescript\nnpm install reslib reflect-metadata @nestjs/common\n```\n\nAlso, install the necessary TypeScript dev dependencies:\n\n```plaintext\nnpm install --save-dev typescript @types/node # or yarn add -D typescript @types/node\n```\n\n### **3\\. TypeScript Configuration**\n\nCreate a `tsconfig.json` file in your project root with the following configuration:\n\nCreate a `tsconfig.json` file in your project root with the following configuration:\n\n```typescript\n{\n    \"compilerOptions\": {\n      \"esModuleInterop\": true,\n      \"forceConsistentCasingInFileNames\": true,\n      \"target\": \"es6\",                          // Use ES6 or higher\n      \"module\": \"commonjs\",                     // Use commonjs module system\n      \"experimentalDecorators\": true,           // Enable experimental support for decorators\n      \"emitDecoratorMetadata\": true,             // Enable emitting design:type metadata\n      \"strict\": true,                            // Enable all strict type checking options\n      \"skipLibCheck\": true                       // Skip type checking of declaration files\n    },\n    \"include\": [\"src/**/*\"],\n    \"exclude\": [\"node_modules\"]\n}\n```\n\n### 4\\. **Import** `reflect-metadata`\n\nIn your entry file (usually `index.ts` or `app.ts`), ensure that you import `reflect-metadata` at the very top of the file. This is required to enable metadata reflection for decorators.\n\n```typescript\nimport 'reflect-metadata';\n```\n\n## 📚 **Documentation**\n\n### Resources\n\n- **Resources** are the foundation of ResLib. Use the `@ResourceMeta` decorator to define any logical entity (models, components, etc.).\n- **Fields**: Add fields to your resources using the `@FieldMeta` decorator, specifying field types and options.\n\n- **symbol** : Simple symbol field;\n- **switch** : Can be a number of a boolean;\n- **checkbox**: Can be a number of a boolean;\n\n### Validation\n\nPowerful validation system with 70+ rules, decorators, functional schemas, and batch processing.\n\n- **Decorator-based**: `@IsRequired()`, `@IsEmail()`, etc.\n- **Object-based (Zod-like)**: `Validator.object({ email: ['Required', 'Email'] })`.\n- **Batch validation**: `Validator.validateBulk(User, data)`.\n- **Async \u0026 i18n support**.\n\nOnce you have installed the necessary packages and set up TypeScript, you can start defining resources and fields using ResLib decorators.\n\n### **Basic Example**\n\n```typescript\nimport 'reflect-metadata';\nimport { ResourceMeta, FieldMeta } from 'reslib';\n\n@ResourceMeta()\nclass User {\n  @FieldMeta({ type: 'string' })\n  name: string;\n\n  @FieldMeta({ type: 'number' })\n  age: number;\n\n  @FieldMeta({ type: 'email' })\n  email: string;\n}\n```\n\n## **Examples**\n\n### **Defining Custom FieldMeta Types**\n\n```typescript\n@FieldMeta({ type: 'dropdown', options: ['Admin', 'User', 'Guest'] })\nrole: string;\n\n@FieldMeta({ type: 'selectResource', resourceName: 'Product' })\nfavoriteProduct: string;\n```\n\n### **Creating Extensible Decorators**\n\nYou can easily create and register new decorators to extend the functionality of your resources.\n\n```typescript\nfunction CustomField(options: { customProp: string }) {\n  return function (target: any, propertyKey: string) {\n    // Custom decorator logic\n    Reflect.defineMetadata(\n      'customProp',\n      options.customProp,\n      target,\n      propertyKey\n    );\n  };\n}\n```\n\n## **Advanced Examples**\n\n### 🔄 **Extending the Framework**\n\nResLib is designed for flexibility. You can add your own custom field types or extend existing ones with full TypeScript support.\n\n### **Extending FieldMeta Types**\n\nYou can easily extend the field types available in ResLib by creating custom decorators. To extend field types and register custom options (e.g., a `rating` field), use TypeScript's **declaration merging**.\n\n```typescript\nfunction ExtendedField(type: string, options: any) {\n    return function (target: any, propertyKey: string) {\n        Reflect.defineMetadata('design:type', type, target, propertyKey);\n        Reflect.defineMetadata('field:options', options, target, propertyKey);\n    };\n}\n\n// Define a new field type for a color picker\n@ExtendedField('colorPicker', { defaultColor: '#000000' })\ncolor: string;\n```\n\n### This allows ResLib to recognize new custom field types, complete with IntelliSense support.\n\n### **Adding New Resources**\n\nYou can create new resources and leverage the existing decorators for rich resource definitions.\n\n```typescript\n@ResourceMeta()\nclass Product {\n  @FieldMeta({ type: 'string' })\n  productName: string;\n\n  @FieldMeta({ type: 'number' })\n  price: number;\n\n  @FieldMeta({\n    type: 'string',\n    options: { enum: ['In Stock', 'Out of Stock'] },\n  })\n  availability: string;\n}\n```\n\n### **Custom Decorator for Advanced Logic**\n\nYou can also create custom decorators that implement advanced logic, such as validation or transformation.\n\n```typescript\nfunction IsPositive(target: any, propertyKey: string) {\n    const value = target[propertyKey];\n    if (value \u0026lt; 0) {\n        throw new Error(`${propertyKey} must be a positive number.`);\n    }\n}\n\n@ResourceMeta()\nclass Order {\n    @FieldMeta({ type: 'number' })\n    @IsPositive\n    totalAmount: number;\n\n    @FieldMeta({ type: 'string' })\n    customerName: string;\n}\n```\n\n### **Using Extended FieldMeta Types**\n\nHere’s how you can use the newly defined field types in a resource:\n\n```typescript\n@ResourceMeta()\nclass EnhancedUser {\n  @FieldMeta({ type: 'string' })\n  name: string;\n\n  @ExtendedField('colorPicker', { defaultColor: '#FF0000' })\n  favoriteColor: string;\n}\n```\n\n## 🔌 **Plugins \u0026 Extensions**\n\nResLib can be extended with plugins and custom modules. Define new decorators, extend resource behavior, and add complex validation logic as needed.\n\n### Example: Custom Decorator Plugin\n\n```typescript\nimport { ResourceMeta, FieldMeta, customDecorator } from 'reslib';\n\nfunction LogField() {\n  return customDecorator((target, key) =\u0026gt; {\n    console.log(`FieldMeta '${key}' has been initialized.`);\n  });\n}\n\n@ResourceMeta\nclass Product {\n  @LogField()\n  @FieldMeta({ type: \"number\" })\n  price: number;\n}\n```\n\n## 🧩 **Contributing**\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on how to get started.\n\n## 📜 **License**\n\nResLib is licensed under the MIT License.\n\n## 🛠 **Built With**\n\n- **TypeScript**: Type-safe, scalable development.\n- **Reflect-metadata**: For decorator metadata reflection.\n- **Custom Decorators**: A clean and declarative way to extend functionality.\n\n## 👏 **Acknowledgements**\n\nThanks to the open-source community for contributions and inspiration.\n\n## 📬 **Contact**\n\nFor support or inquiries:\n\n- GitHub:  [GitHub Link](https://github.com/boris-fouomene/reslib)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboris-fouomene%2Freslib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboris-fouomene%2Freslib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboris-fouomene%2Freslib/lists"}