Skip to content

cyberskill-world/shared

CyberSkill Logo

CyberSkill Shared

Enterprise-grade utility library for consistent, scalable development across CyberSkill projects

πŸ“¦ npm version πŸ“₯ npm downloads πŸ“š JSDoc Documentation πŸ“„ License: MIT


🎯 Overview

CyberSkill Shared is a comprehensive TypeScript-first utility library that standardizes development across CyberSkill projects. It provides shared utilities, configurations, and components for both frontend and backend development.

Feature Benefit
πŸ”„ Consistency Standardized patterns and utilities across all projects
⚑ Productivity Pre-built solutions for common development tasks
πŸ›‘οΈ Reliability Type-safe implementations with comprehensive testing
πŸ“ˆ Scalability Modular architecture that grows with your needs
πŸš€ Performance Optimized for production with minimal bundle impact
πŸ”’ Security Built-in security best practices and npm provenance

✨ Key Features

Module Highlights
config/ ESLint, Vitest, Commitlint, env parsing, GraphQL Codegen, Storybook
node/ Express middleware, MongoDB ODM, WebSocket, CLI tools, file upload, logging
react/ Apollo Client, i18n (i18next + next-intl), Loading, Toast, Storage hooks
util/ String processing, object manipulation, validation, serialization

For the full module map and architecture, see CODEBASE.md.


πŸš€ Installation

Prerequisites: Node.js β‰₯ 24.0.0 Β· pnpm β‰₯ 10.0.0 Β· TypeScript β‰₯ 5.0.0

pnpm add @cyberskill/shared

Add to your tsconfig.json:

{
    "compilerOptions": {
        "baseUrl": ".",
        "paths": {
            "@cyberskill/shared/*": ["node_modules/@cyberskill/shared/src/*"]
        }
    }
}

πŸƒ Quick Start

Utility Functions

import { validateEmail } from '@cyberskill/shared/util';
import { RESPONSE_STATUS } from '@cyberskill/shared/constant';

validateEmail('user@example.com'); // true

React Integration

import { ApolloProvider } from '@cyberskill/shared/react/apollo-client';
import { LoadingProvider, useLoading } from '@cyberskill/shared/react/loading';

function App() {
    return (
        <ApolloProvider options={{ uri: 'https://api.example.com/graphql' }}>
            <LoadingProvider>
                <MyApplication />
            </LoadingProvider>
        </ApolloProvider>
    );
}

Node.js Integration

import { createCorsOptions } from '@cyberskill/shared/node/express';
import { mongo } from '@cyberskill/shared/node/mongo';
import { RESPONSE_STATUS } from '@cyberskill/shared/constant';
import cors from 'cors';
import express from 'express';

const app = express();
app.use(cors(createCorsOptions({
    isDev: process.env.NODE_ENV === 'development',
    whiteList: ['https://example.com']
})));

await mongo.connect({ uri: process.env.MONGODB_URI });

πŸ› οΈ Development

git clone https://github.com/cyberskill-world/shared.git && cd shared
pnpm install && pnpm run build
Command Description
pnpm run dev Start development mode with hot reload
pnpm run build Build for production
pnpm run lint Check for linting issues
pnpm run lint:fix Fix linting issues automatically
pnpm run test Run tests
pnpm run inspect Inspect project dependencies
pnpm run reset Reset project state
pnpm run ready Prepare project for development

πŸ“š Documentation

Document Description
API.md API reference and usage examples
CODEBASE.md Architecture, modules, and conventions
CONTRIBUTING.md Development guidelines, code standards, and release process
SECURITY.md Vulnerability disclosure policy
CHANGELOG.md Release history

πŸ†˜ Support


πŸ“„ License

MIT β€” see LICENSE for details.


Made with ❀️ by the CyberSkill Team

Website Β· Issues Β· Discussions

If this project helps you, please consider giving us a ⭐ on GitHub!

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors