Skip to content

HideInHere/mern-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mern-utils

A lightweight utility library for MERN stack development. Provides essential helpers for authentication, API calls, validation, and state management to accelerate development workflows.

Installation

npm install mern-utils

Quick Start

import { validateEmail, asyncHandler, withAuth } from 'mern-utils';

// Validate email
if (validateEmail('user@example.com')) {
  console.log('Valid email');
}

// Wrap async route handlers to catch errors
const handler = asyncHandler(async (req, res) => {
  const user = await User.findById(req.params.id);
  res.json(user);
});

// Protect routes with authentication middleware
app.get('/profile', withAuth, (req, res) => {
  res.json(req.user);
});

Features

  • Email, phone, and password validation utilities
  • Async error handling middleware
  • JWT authentication helpers
  • API response formatting
  • Environment configuration loader
  • Request rate limiting utilities

Documentation

Full documentation available at docs/

License

MIT

About

Reusable MERN stack utilities — React hooks, Express middleware, MongoDB helpers, and more

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors