open-index/open-npm huggingface dataset:
npm package: @saas-platform/shared-database
Description: Enhanced multi-tenant database utilities with AWS ElastiCache integration
Latest version: 1.1.0

# @saas-platform/shared-database

Enhanced multi-tenant database utilities with AWS ElastiCache integration, performance monitoring, and audit trails.

## 🚀 Features

- **Multi-Tenant Query Builder** - Automatic tenant isolation
- **AWS ElastiCache Integration** - Redis caching with auto-configuration
- **Performance Monitoring** - Query performance tracking and optimization
- **Audit Trail** - Complete change tracking for compliance
- **Bulk Operations** - Efficient batch processing
- **Read/Write Splitting** - Database load balancing
- **Type Safety** - Full TypeScript support

## 📦 Installation

```bash
npm install @saas-platform/shared-database
```

## 🔧 Quick Start

```typescript
import { ElastiCacheIntegration } from '@saas-platform/shared-database';

// Auto-configuration from environment variables
const cache = await ElastiCacheIntegration.createOptimizedCache();

// Create tenant-aware query builder
const queryBuilder = await ElastiCacheIntegration.createTenantQueryBuilder(
  db,
  'tenant-123'
);

// Query with automatic caching and tenant isolation
const users = await queryBuilder.findMany(usersTable, {
  where: [eq(usersTable.status, 'active')],
  limit: 100
});
```

## 🌍 Environment Configuration

```bash
# AWS ElastiCache
AWS_REGION=us-east-1
ELASTICACHE_ENDPOINT=my-cluster.cache.amazonaws.com
ELASTICACHE_AUTH_TOKEN=your-redis-auth-token
ELASTICACHE_TLS_ENABLED=true

# Cache Settings
CACHE_TTL_DEFAULT=300
CACHE_ENABLED=true
```

## 🏗️ Development

```bash
# Start development environment
docker-compose up -d

# Install dependencies
npm install

# Build library
npm run build

# Run tests
npm test

# Development mode
npm run dev
```

## 📊 Performance Monitoring

The library includes built-in performance monitoring:

```typescript
import { PerformanceTracker } from '@saas-platform/shared-database';

const tracker = new PerformanceTracker();
const slowQueries = tracker.getSlowQueries(1000); // > 1 second
const avgTime = tracker.getAverageQueryTime('users');
```

## 🔒 Security & Compliance

- Automatic tenant isolation prevents data leakage
- Complete audit trails for compliance requirements
- Encrypted connections to ElastiCache
- Input validation and SQL injection prevention

## 📚 Documentation

See the [examples](./src/examples/) directory for comprehensive usage examples.

## 🤝 Contributing

1. Fork the repository
2. Create your feature branch
3. Add tests for new functionality
4. Run the test suite
5. Submit a pull request

## 📄 License

MIT License - see LICENSE file for details.
npm package: @saas-platform/shared-lib
Description: Shared library for SaaS platform microservices
Author: SaaS Platform Team
Latest version: 1.0.1

# @saas-platform/shared-lib

Shared library for SaaS platform microservices built with TypeScript, Fastify, and modern observability tools.

## Features

- 🚀 **TypeScript-first** with strict type checking
- 🔌 **Fastify integration** with plugins and middleware
- 🗄️ **Multi-tenant architecture** with automatic isolation
- 💾 **Database support** with Prisma ORM and connection pooling
- 🗃️ **Caching** with Redis and ElastiCache support
- 📨 **Messaging** with SQS and EventBridge
- 📊 **Observability** with OpenTelemetry, Prometheus, and structured logging
- ☁️ **Cloud-native** with Lambda and container support
- ⚙️ **Environment-based configuration** with validation

## Installation

```bash
npm install @saas-platform/shared-lib
```

## Quick Start

```typescript
import { createApp } from '@saas-platform/shared-lib'

const { app, config } = await createApp()

await app.listen({
  port: config.service.port,
  host: config.service.host,
})
```

## Documentation

See [docs/](./docs/) for detailed documentation and examples.

## License

MIT
npm package: @saas-platform/shared-types
Description: Common TypeScript interfaces and types for Multi-Tenant SaaS Platform
Author: SaaS Platform Team
Latest version: 1.0.1

# @saas-platform/shared-types

Common TypeScript interfaces and types for the Multi-Tenant SaaS Platform.

## Installation

```bash
npm install @saas-platform/shared-types
```

## Usage

```typescript
import { User, Tenant, ApiResponse, UserCreatedEvent } from '@saas-platform/shared-types';

// Use types in your service
const user: User = {
  id: '123',
  tenantId: 'tenant-456',
  email: 'user@example.com',
  status: UserStatus.ACTIVE,
  // ... other properties
};

// API response formatting
const response: ApiResponse<User> = {
  success: true,
  data: user,
  metadata: {
    requestId: 'req-123',
    timestamp: new Date().toISOString(),
    version: '1.0.0',
    service: 'user-service'
  }
};
```

## Available Types

### Core Types
- `UUID`, `TenantId`, `UserId`, `ApplicationId`
- `Status`, `Environment`, `ErrorCode`
- `PaginationParams`, `PaginationMeta`

### API Types
- `ApiRequest<T>`, `ApiResponse<T>`
- `PaginatedResponse<T>`, `ErrorResponse`
- `ValidationError`, `RequestContext`

### Authentication Types
- `AccessTokenPayload`, `RefreshTokenPayload`
- `UserSession`, `AuthContext`
- `DeviceType`, `LoginMethod`, `MFASetup`

### User Types
- `User`, `UserProfile`, `UserGroup`
- `UserDepartment`, `CreateUserRequest`
- `UserStatus`, `GroupMemberStatus`

### Tenant Types
- `Application`, `Tenant`, `Plan`
- `TenantProfile`, `Role`, `RoleMaster`
- `ApplicationStatus`, `TenantStatus`, `PlanType`

### Billing Types
- `TenantBilling`, `Invoice`, `PaymentTransaction`
- `UsageBilling`, `InvoiceLineItem`
- `SubscriptionType`, `SubscriptionStatus`

### Branding Types
- `BrandingSettings`, `SEOSettings`
- `ThemeMode`, `LayoutStyle`, `ButtonStyle`
- `ColorPalette`, `FontConfiguration`

### Event Types
- `BaseEvent<T>`, `EventHandler<T>`
- User events: `UserCreatedEvent`, `UserUpdatedEvent`
- Tenant events: `TenantCreatedEvent`, `TenantPlanChangedEvent`
- Billing events: `SubscriptionCreatedEvent`, `PaymentSucceededEvent`

### Database Types
- `DatabaseConfig`, `PoolConfig`
- `BaseRepository<T>`, `TenantAwareRepository<T>`
- `Migration`, `TransactionContext`

## Development

```bash
# Build the package
npm run build

# Watch for changes
npm run build:watch

# Lint code
npm run lint

# Format code
npm run format
```

## License

MIT
# saas-platform-shared-types
# saas-platform-shared-types
# saas-platform-shared-types
npm package: @saas-power-factory/express-response-kit
Description: Tiny helper to send consistent API responses (status, message, data, error)
Author: SaaS Power Factory
Latest version: 0.1.1

# @saas-power-factory/response-kit

Tiny Express helper to send consistent API responses with configurable required keys and default envelopes.

## Quick Start

```ts
import express from 'express'
import { sendResponse, defaultMiddleware } from '@saas-power-factory/response-kit'

const app = express()
app.use(express.json())

// Option 1: Direct helper (no middleware needed)
app.get('/simple', (req, res) => {
  sendResponse(res, { status: 200, message: 'ok', data: { hello: 'world' } })
})

// Option 2: Use middleware to attach res.api.send
app.use(defaultMiddleware)
app.get('/middleware', (req, res) => {
  res.api.send({ status: 200, message: 'ok', data: { hello: 'world' } })
})
```

## Configurable Response Kit

Create a configured response helper that ensures required keys are always present:

```ts
import { createResponseKit } from '@saas-power-factory/response-kit'

const { sendResponse, middleware } = createResponseKit({
  requiredKeys: ['status', 'message', 'error'],
  defaultEnvelope: { message: 'default message' },
  defaultStatus: 200
})

app.use(middleware)

app.get('/api/data', (req, res) => {
  // Only provide data - required keys will be filled automatically
  res.api.send({ data: { items: [] } })
  // Result: { status: 200, message: 'default message', error: null, data: { items: [] } }
})

app.get('/api/replace', (req, res) => {
  // Replace mode: custom payload replaces defaults but required keys are ensured
  sendResponse(res, { status: 201, custom: 'field' }, { replace: true })
  // Result: { status: 201, message: null, error: null, custom: 'field' }
})
```

## Features

- **Consistent shape**: All responses follow the same JSON structure
- **Required keys**: Ensure specific fields are always present
- **Default values**: Set fallback values for common fields
- **Replace mode**: Option to override default envelope completely
- **TypeScript friendly**: Proper types, no `as any` needed
- **Flexible**: Accept custom fields alongside standard ones