
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
@lemur-bookstores/secure-stack-core
Advanced tools
Core framework - Foundation of SecureStack
npm install @lemur-bookstores/secure-stack-core
# or
pnpm add @lemur-bookstores/secure-stack-core
import { SecureStack, router, ServiceType } from '@lemur-bookstores/secure-stack-core';
import { z } from 'zod';
const app = new SecureStack({
name: 'my-service',
port: 3000,
type: ServiceType.Microservice,
});
const userRouter = router()
.query('getUser', {
input: z.string(),
handler: async ({ input }) => {
return { id: input, name: 'John Doe' };
}
});
app.router('user', userRouter);
await app.start();
SecureStack includes built-in middlewares:
import { logger, errorHandler, cors } from '@lemur-bookstores/secure-stack-core';
app.use(errorHandler());
app.use(logger());
app.use(cors({ origin: '*' }));
app.use(async (ctx, next) => {
console.log('Before');
await next();
console.log('After');
});
Create and extend contexts:
import { createContext } from '@lemur-bookstores/secure-stack-core';
const contextBuilder = createContext<{ user?: User }>();
app.setContextFactory((initial) => {
return contextBuilder.create(initial);
});
Use built-in error types:
import { SecureStackError } from '@lemur-bookstores/secure-stack-core';
// Throw errors
throw SecureStackError.notFound('User not found');
throw SecureStackError.unauthorized();
throw SecureStackError.forbidden('Access denied');
throw SecureStackError.validationError('Invalid input');
Define type-safe procedures:
const router = router()
.query('getName', {
input: z.string(),
handler: async ({ input }) => {
return { name: input };
}
})
.mutation('create', {
input: z.object({ name: z.string() }),
handler: async ({ input }) => {
return { id: '123', ...input };
}
});
Enable the service mesh:
import { ServiceType, EncryptionMode, DiscoveryMode } from '@lemur-bookstores/secure-stack-core';
const app = new SecureStack({
name: 'user-service',
port: 50051,
type: ServiceType.Microservice,
mesh: {
enabled: true,
security: {
encryption: EncryptionMode.Hybrid,
rsaKeySize: 4096,
aesKeySize: 256,
},
discovery: {
mode: DiscoveryMode.Static,
services: [
{ id: 'auth-service', host: 'auth.internal', port: 50052 }
]
}
}
});
// Connect to other services
const authService = app.mesh.connect('auth-service');
const response = await authService.call('verify', { token: 'abc' });
Main framework class.
Methods:
router(name, router) - Register a routeruse(middleware) - Add middlewaresetContextFactory(factory) - Set context factorycreateContext(initial) - Create context instancestart() - Start the serverstop() - Stop the serverCreate a new router.
Methods:
query(name, config) - Define a query proceduremutation(name, config) - Define a mutation proceduresubscription(name, config) - Define a subscription proceduremiddleware(fn) - Add middleware to routerServiceType - Microservice | GatewayEncryptionMode - Hybrid | TLS | NoneDiscoveryMode - Static | DNS | Consul | EtcdErrorCode - All error codesSee the examples/ directory for complete examples:
examples/basic - Basic usageexamples/advanced - Middleware, errors, validationMIT © @elkincp5
FAQs
Core framework - Foundation of SecureStack
We found that @lemur-bookstores/secure-stack-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.