A monorepo containing reusable components and utilities for Next.js, Node.js, and Python applications.
Reusable React UI components built with shadcn/ui patterns and Tailwind CSS.
Features:
- Button component with variants
- Built on Radix UI primitives
- Tailwind CSS styling
- TypeScript support
Usage:
import { Button } from '@cortex-shared/ui';
export default function App() {
return <Button variant="default">Click me</Button>;
}Authentication utilities for Node.js and Next.js applications.
Features:
- JWT token generation and verification
- Password hashing and verification
- Email and password validation
- Password strength checker
Usage:
import { generateToken, verifyPassword } from '@cortex-shared/auth';
const token = generateToken({ id: '123', email: 'user@example.com' }, secret);
const isValid = await verifyPassword('password', hash);See python/README.md for Python package structure and development.
- Node.js >= 18
- pnpm >= 8.0
- Python >= 3.9 (for Python packages)
- Install pnpm (if you haven't already):
npm install -g pnpm- Install dependencies:
pnpm install- Build all packages:
pnpm build- View unified documentation with Storybook:
pnpm storybookThis opens the Storybook documentation at http://localhost:6006 with all components and guides.
# Development mode (watch all packages)
pnpm dev
# Build all packages
pnpm build
# Lint all packages
pnpm lint
# Type check all packages
pnpm type-check
# Test all packages
pnpm testInteractive documentation for all components and utilities:
pnpm storybook # View Storybook (http://localhost:6006)
pnpm storybook:build # Build static site for deploymentThe Storybook includes:
- UI Components - Interactive component explorer with live examples
- Auth Utilities - Complete API reference with code examples
- Python Packages - Setup and usage guides
- Guides - Additional documentation and best practices
shared-components/
βββ packages/
β βββ ui/ # UI components
β β βββ src/
β β βββ .storybook/ # Component stories
β β βββ package.json
β β βββ tsconfig.json
β β βββ vite.config.ts
β βββ auth/ # Auth utilities
β βββ src/
β βββ package.json
β βββ tsconfig.json
βββ docs/ # Storybook documentation
β βββ Welcome.mdx
β βββ Auth.mdx
β βββ Python.mdx
βββ .storybook/ # Root Storybook config
β βββ main.ts
β βββ preview.ts
βββ python/ # Python packages directory
β βββ pyproject.toml
β βββ setup.cfg
βββ .github/
β βββ workflows/
β β βββ ci.yml # Run tests on PR/push
β β βββ publish.yml # Publish to npm
β β βββ publish-python.yml # Publish to PyPI
β β βββ storybook.yml # Deploy docs to Pages
β βββ WORKFLOWS.md
βββ package.json # Root workspace config
βββ tsconfig.json # Shared TypeScript config
βββ turbo.json # Turbo repo config
βββ .eslintrc.json # Shared ESLint config
βββ .prettierrc # Shared Prettier config
βββ .gitignore
All packages share a base TypeScript configuration from tsconfig.json. Individual packages can extend this configuration in their own tsconfig.json files.
- ESLint:
.eslintrc.json- Shared linting rules - Prettier:
.prettierrc- Shared formatting rules
- Turbo:
turbo.json- Monorepo task orchestration - pnpm Workspaces:
package.json- Workspace configuration
Before publishing, ensure:
- Version numbers are updated in each package's
package.json - All tests pass
- All builds are successful
Publish with:
cd packages/ui
npm publish
cd ../auth
npm publishCreate individual pyproject.toml files in subdirectories under python/ for each Python package. See python/README.md for details.
The unified Storybook is automatically built and deployed to GitHub Pages on every push to main.
View the live documentation at: https://<your-username>.github.io/shared-components/
To enable GitHub Pages:
- Go to Settings β Pages
- Set source to "GitHub Actions"
- Documentation will deploy automatically
The workflow (.github/workflows/storybook.yml):
- Builds all packages
- Generates the Storybook static site
- Deploys to GitHub Pages
To clean up all build artifacts and node_modules:
pnpm clean # Remove all node_modules and build outputs- Create directory:
mkdir -p packages/my-package/src - Create
package.json:
{
"name": "@cortex-shared/my-package",
"version": "0.0.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"dev": "tsc --watch"
}
}- Create
tsconfig.jsonextending the root config - Run
pnpm installto add to workspace
- Create subdirectory:
mkdir -p python/my-package/src/my_package - Create
pyproject.tomlwith package configuration - See python/README.md for details
MIT
When contributing to this monorepo:
- Create a feature branch
- Make changes to relevant packages
- Update versions appropriately
- Run
pnpm build && pnpm lint && pnpm test - Create a pull request