A collection of reusable utilities, middleware, and services for Node.js server projects.
This package helps you quickly add common server functionality such as authentication, messaging, file handling, logging, and more.
npm install @eloritzkovitz/server-essentials
Import what you need from the package.
Set required environment variables in your .env
file:
# RabbitMQ
RABBITMQ_URL=amqp://localhost
# SMTP for OTP
SMTP_HOST=smtp.example.com
SMTP_PORT=465
SMTP_USER=your@email.com
SMTP_PASS=yourpassword
SMTP_FROM=your@email.com
# JWT
TOKEN_SECRET=your_jwt_secret
# Firebase Messaging
GOOGLE_APPLICATION_CREDENTIALS=path/to/serviceAccount.json
Run all tests and view coverage reports using Jest:
npm test
npx jest --coverage
The coverage report will be generated in the coverage/
folder (which is gitignored by default).
You can add or run tests for any module in the test/
directory.
Tests are organized to match the source code structure for easy maintenance.
Full API documentation is available in the docs
folder and can be viewed online via GitHub Pages.
MIT