Skip to main content

Getting Started

Overview

@elliemae/pui-service-sdk is a TypeScript SDK for building secure, production-ready Node.js microservices. It provides a pre-configured Express application with built-in security headers, structured logging with PII redaction, Redis caching with in-memory fallback, AWS integrations, and JWT/OAuth token management.

Prerequisites

  • Node.js >= 20
  • pnpm >= 8

Installation

pnpm add @elliemae/pui-service-sdk

Quick Start

Create a minimal microservice in three steps:

import { initApp, listen, service, logger } from '@elliemae/pui-service-sdk';

// 1. Create a structured logger
const log = logger({
appName: 'my-service',
team: 'my-team',
});

// 2. Define your routes
const myRoutes = (app) => {
app.get('/api/hello', (req, res) => {
res.json({ message: 'Hello, world!' });
});
};

// 3. Initialize, wire up routes, and start
const app = initApp();
service.handleRequest({ logger: log, routes: [myRoutes] })(app);
listen(app);

Run the service and visit http://localhost:3000/health to confirm it's working.

What You Get Out of the Box

FeatureDetails
Security headersHSTS, X-Content-Type-Options, X-Download-Options, Referrer-Policy, Hide X-Powered-By (via Helmet)
CORSPre-configured for ICE/Ellie Mae domains, customizable
HTTP parameter pollutionProtected via hpp
Compressiongzip response compression
Body parsingJSON, URL-encoded, plain text, and CSP reports
Health checkBuilt-in GET /health endpoint
Error handling404 handler and unhandled exception handler with correlation IDs
Structured loggingPino-based with PII redaction and environment metadata
Graceful shutdownHandles SIGINT/SIGTERM with optional cleanup hooks
Serverless supportAWS Lambda wrapper via @vendia/serverless-express

Project Structure

A typical service built with this SDK:

my-service/
├── src/
│ ├── routes/
│ │ ├── users.ts
│ │ └── orders.ts
│ └── index.ts # Entry point
├── package.json
└── tsconfig.json

Next Steps

See the User Guide for detailed documentation on each module.