If you build backend applications with Node.js regularly, you’ve probably noticed a pattern.
Every new project seems to require the same set of utilities:
Error classes
JWT helpers
Logging utilities
And most of the time, developers end up copy-pasting the same code from previous projects.
I’ve done this more times than I can count.
After repeating this process across several projects, I decided to stop rewriting the same utilities and instead package them into a reusable toolkit.
That’s how nodecore-kit was born.
What is nodecore-kit?
nodecore-kit is a lightweight utility toolkit designed to simplify backend development in Node.js applications.
Instead of recreating common backend helpers in every project, you can install one package and get access to a collection of reusable utilities designed for modern backend workflows.
The goal is simple:
Reduce boilerplate and keep your backend code clean and consistent.
Why I Built It
While working on multiple backend services, I noticed the same problems:
- Utilities scattered across projects
- Slightly different implementations of the same logic
- Rewriting helper functions every time a new project starts
For example, almost every project needed:
- Custom error handling
- JWT token utilities
- Logging helpers Instead of copying these utilities from one repository to another, I decided to centralize them in a single reusable package. This also helps maintain consistency across different services and codebases.
Installation
You can install nodecore-kit from npm:
npm install nodecore-kit
or with yarn:
yarn add nodecore-kit
Example Usage
Here are a few examples of how nodecore-kit can simplify common backend tasks.
- jwt helpers:
import { jwtService } from "nodecore-kit";
// Encode
const token = await jwtService.encode({
data: { userId: 123, role: "admin" },
secretKey: process.env.JWT_SECRET!,
expiresIn: "7d",
});
// Decode + verify
const payload = await jwtService.decode<{ userId: number }>({
token,
secretKey: process.env.JWT_SECRET!,
});
- Joi Validation:
import Joi from "joi";
import {joiMiddleware, joiValidate } from "nodecore-kit"l
const createUserSchema = Joi.object({
name: Joi.string().required(),
email: Joi.string().email().required(),
});
// As Express middleware
router.post(
"/users",
joiMiddleware({
body: { schema: createUserSchema },
params: { schema: Joi.object({ id: Joi.string().uuid().required() }) },
query: { schema: paginationSchema, options: { allowUnknown: true } },
}),
createUser,
);
- Http and async utilites:
import {makeRequest, sleep, retry } from nodecore-kit;
// Simple GET
const user = await makeRequest<User>({ url: "/api/users/1" });
// POST with typed body
const post = await makeRequest<Post, CreatePostDto>({
url: "/api/posts",
method: "POST",
data: { title: "Hello", body: "World" },
token: "my-jwt-token",
});
// With retry + timeout
const data = await makeRequest<Data>({
url: "/api/slow-endpoint",
timeout: 5000,
retries: 3,
});
Also nodecore-kit also include some popular infras like redis, sqs, s3 etc. Making it easy to simply plug and play.
import { SQS, S3, Redis } from "nodecore-kit";
const redis = new Redis("redis://localhost:6379");
await redis.start();
// Core ops
await redis.set("key", { foo: "bar" });
await redis.setEx("key", { foo: "bar" }, "1 hour");
const value = await redis.get<MyType>("key");
await redis.delete("key");
SQS
const sqs = new SQS({
region: "us-east-1",
accessKeyId: process.env.AWS_KEY!,
secretAccessKey: process.env.AWS_SECRET!,
});
// Enqueue
await sqs.enqueue({
queueUrl: "https://sqs.us-east-1.amazonaws.com/1234/my-queue",
message: { event: "user.created", userId: 1 },
});
sqs.dequeue({
queueUrl: "https://sqs.us-east-1.amazonaws.com/1234/my-queue",
consumerFunction: async (message) => {
await processMessage(message);
},
dlqUrl: "https://sqs.us-east-1.amazonaws.com/1234/my-dead-letter-queue",
useRedrivePolicy: false,
});
When Should You Use nodecore-kit?
You might find nodecore-kit useful if you:
- Build Node.js APIs frequently
- Want consistent utilities across projects
- Prefer cleaner backend code with less boilerplate
- Work on microservices or multiple backend services Instead of rewriting the same helper functions repeatedly, you can rely on a centralized toolkit.
The Goal
The goal of nodecore-kit isn’t to replace frameworks.
It’s simply to provide small, practical utilities that most backend projects need. Think of it as a developer toolkit for common backend patterns.
Feedback and Contributions
I’m actively improving nodecore-kit and would love feedback from other developers.
If you find it useful, feel free to:
⭐ Star the repository
🐛 Report issues
🔧 Submit pull requests
Open source tools get better through collaboration.
Check it out
Github repo:
Rockhillz
/
nodeCore-kit
A utility for nodejs developers
nodecore-kit
A modular backend SDK for Node.js services.
Provides infrastructure helpers, utilities, and microservice building blocks in a clean, scalable, and framework-agnostic way.
📦 Features
Infrastructure
- Redis — get/set/expire, scan, hash ops, auth cache helpers
- SQS — enqueue, long-poll dequeue, DLQ support, graceful stop
- S3 — upload, download, stream, copy, signed URLs
- Cron — job scheduler with human-readable shorthands, overlap protection, per-job status tracking, and graceful shutdown
- Mailer — provider-agnostic email adapter with SMTP, Resend, and SendGrid support
- (Future: Kafka, etc.)
HTTP Utilities
-
makeRequest— typed, generic fetch wrapper with retry and timeout - Pagination helpers
Core Utilities
-
uuid— binary/string conversion, generation, FIFO support, validation - String utilities —
camelCase,snakeCase,kebabCase,pascalCase,truncate,maskString, and more - Validator utilities —
isEmail,isURL,isUUID,isEmpty,isNil, and more - Object utilities —
flattenObject,unflattenObject - Async utilities —
sleep…
npm library: https://www.npmjs.com/package/nodecore-kit
Final Thoughts
Building backend services often involves repeating the same patterns over and over again.
Creating nodecore-kit helped me eliminate a lot of repetitive setup work and focus more on building actual application logic. If you also find yourself rewriting the same utilities across projects, a small toolkit like this might save you some time.
Happy coding 🚀
Top comments (0)