Data & Backend
A collection of robust, platform-agnostic libraries for building the backend infrastructure of your LSSM applications.
Libraries
@lssm/app.cli-database
Prisma Wrapper & CLI. Provides a unified way to manage database schemas, migrations, and clients. Includes seeders and factory patterns for testing.
@lssm/lib.bus
Type-Safe Event Bus. Decouple your architecture with typed events. Supports in-memory dispatch for monoliths and can be extended for distributed message queues (Redis, SQS).
@lssm/lib.logger
High-Performance Logging. Optimized for Bun and structured JSON output. Includes plugins for ElysiaJS to log HTTP requests automatically.
@lssm/lib.error
Standardized Errors. Use `AppError` with standard codes (NOT_FOUND, UNAUTHORIZED) to ensure consistent HTTP responses and error handling across services.
@lssm/lib.exporter
Data Export. Generate CSV and XML files from your data. Platform-agnostic and streaming-friendly.
Example: Unified Backend Flow
import { logger } from '@lssm/lib.logger';
import { AppError } from '@lssm/lib.error';
import { db } from '@lssm/app.cli-database';
import { EventBus } from '@lssm/lib.bus';
export async function createUser(email: string) {
logger.info({ email }, 'Creating user');
const existing = await db.user.findUnique({ where: { email } });
if (existing) {
throw new AppError('User already exists', 'CONFLICT');
}
const user = await db.user.create({ data: { email } });
await EventBus.publish('user.created', { userId: user.id });
return user;
}