ExpressPro

ExpressPro is an enhanced version of Express.js that provides additional utilities and middleware for building robust web applications. It extends Express with authentication, error handling, and response utilities out of the box.
Features
- 🔐 JWT Authentication - Built-in JWT authentication system
- 🛡️ Error Handling - Global error handler and custom error class
- 🔄 Async Handler - Clean async/await error handling
- 🔒 Password Hashing - Built-in bcrypt integration
- 🌐 CORS Support - Easy CORS configuration
- 📦 TypeScript Support - Full TypeScript support with type definitions
Installation
npm install expresspro
yarn add expresspro
pnpm add expresspro
Quick Start
import express from 'expresspro';
const app = express();
app.use(express.cors());
const auth = new express.auth('your-secret-key', 'token');
app.get('/protected', auth.authMiddleware(), (req, res) => {
res.json({ message: 'Protected route accessed' });
});
app.listen(3000, () => {
console.log('Server running on port 3000');
});
Documentation
For detailed documentation, please visit our documentation directory:
Available Extensions
Authentication (express.auth)
const auth = new express.auth('secret', 'token');
app.get('/protected', auth.authMiddleware(), (req, res) => {
res.json({ user: req.user });
});
Builtin JWT (express.jwt)
const token=express.jwt.sign({id: 1, name: 'Suryansh'});
const decoded = express.jwt.verify(token, 'secret');
Error Handling (express.error)
app.use(express.error);
throw new express.AppError('Not found', 404);
Response Utilities (express.resp)
express.resp(res, 200, 'Success', { data });
Async Handler (express.asyncHandler)
app.get('/async', express.asyncHandler(async (req, res) => {
const data = await someAsyncOperation();
res.json({ data });
}));
TypeScript Support
ExpressPro is written in TypeScript and includes type definitions. The types are available in the @types directory.
import express from 'expresspro';
import { Request, Response } from 'express';
app.get('/users', express.asyncHandler(async (req: Request, res: Response) => {
const users = await User.findAll();
res.json({ users });
}));
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Changelog
See our Changelog for a list of changes.
License
This project is licensed under the ISC License - see the LICENSE file for details.
Author
Suryansh Verma
Repository
GitHub Repository
Support
Related Projects
Security
If you discover any security-related issues, please email suryanshverma.dev.official@gmail.com instead of using the issue tracker.
Acknowledgments
- Express.js team for the amazing framework
- All contributors who have helped shape ExpressPro