npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sidekick-server-2

v0.1.3

Published

A reusable Node.js server library with authentication, organization management, and payment integration

Downloads

337

Readme

SideKick Server

A reusable Node.js server library with built-in authentication, organization management, and payment integration. Built with Express, TypeScript, and MySQL.

Features

  • 🔐 Authentication System - JWT-based authentication with OTP support
  • 👥 Organization Management - Multi-tenant organization structure with invitations
  • 💳 Payment Integration - Razorpay integration for subscription plans
  • 🌍 CORS Configuration - Flexible CORS setup
  • 📧 Email Support - Nodemailer integration
  • 🔌 Extensible - Add custom routes and middleware

Installation

npm install sidekick-server

Peer Dependencies

You need to install these peer dependencies in your project:

npm install express cors mysql2

Quick Start

import mysql from 'mysql2/promise';
import { initSideKick } from 'sidekick-server';
import { APP_INFO_ACCOUNT_TYPE } from 'sidekick-server/dist/utils/enums.js';

// Create database connection pool
const dbPool = mysql.createPool({
  host: 'localhost',
  user: 'root',
  password: 'your-password',
  database: 'your-database',
  waitForConnections: true,
  connectionLimit: 10,
  queueLimit: 0,
});

// Initialize SideKick server
const server = initSideKick({
  database: dbPool,
  appInfo: {
    appName: 'My App',
    appDescription: 'My awesome application',
    version: '1.0.0',
    CLIENT_URL: 'http://localhost:3000',
    account_type_txt: {
      singular: 'Team',
      plural: 'Teams',
      value: APP_INFO_ACCOUNT_TYPE.TEAM,
    },
  },
  cors: {
    allowedOrigins: ['http://localhost:3000', 'https://myapp.com'],
  },
  jwt: {
    secret: 'your-jwt-secret',
    expiresIn: '24h',
  },
});

// Start the server
const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
  console.log(`Server running on port ${PORT}`);
});

Configuration

SideKickConfig

| Property | Type | Required | Description | | -------------- | --------------------- | -------- | --------------------------- | | database | Pool | Yes | MySQL2 connection pool | | appInfo | AppInfo | Yes | Application information | | cors | CorsConfig | Yes | CORS configuration | | jwt | JwtConfig | Yes | JWT configuration | | customRoutes | CustomRoutesHandler | No | Custom route handler | | port | number | No | Port number (for reference) |

AppInfo

{
  appName: string;
  appDescription: string;
  version: string;
  logo?: string;              // SVG or image URL
  primaryThemeColor?: string; // Hex color
  CLIENT_URL: string;         // Frontend URL
  account_type_txt: {
    singular: string;
    plural: string;
    value: typeof APP_INFO_ACCOUNT_TYPE.TEAM;
  };
}

Custom Routes

You can add custom routes to extend the server functionality:

const server = initSideKick({
  // ... other config
  customRoutes: (app) => {
    app.get('/custom-endpoint', (req, res) => {
      res.json({ message: 'Custom route!' });
    });

    app.post('/custom-action', async (req, res) => {
      // Your custom logic
      res.json({ success: true });
    });
  },
});

Built-in Routes

The library includes the following routes:

Public Routes (No Authentication Required)

  • POST /send-otp - Send OTP for verification
  • POST /user-registration - Register new user
  • POST /login - User login
  • POST /reset-password - Reset password
  • GET /get-plans - Get available subscription plans

Protected Routes (Authentication Required)

  • GET /check-session - Verify session
  • POST /organization - Create organization
  • GET /org-member - Get organization members
  • POST /invitation - Send invitation
  • GET /get-countries - Get countries list
  • POST /payment-gateway - Payment gateway integration
  • GET /purchased-plans - Get purchased plans

Environment Variables

While the library doesn't use .env files directly, you may want to use them in your application:

PORT=3000
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your-password
DB_NAME=your-database
JWT_SECRET=your-jwt-secret
CLIENT_URL=http://localhost:3000

TypeScript Support

The library is written in TypeScript and includes type definitions. Import types as needed:

import { SideKickConfig, AppInfo, CorsConfig, JwtConfig, CustomRoutesHandler, DatabaseConnection } from 'sidekick-server';

Development

If you want to contribute or modify the library:

# Clone the repository
git clone <repository-url>

# Install dependencies
npm install

# Install peer dependencies for development
npm install express cors mysql2

# Build the library
npm run build

# Run in development mode
npm run dev

Local Testing with Yalc

For local testing before publishing to npm, use yalc:

# Install yalc globally (if not already installed)
npm install -g yalc

# In the library directory
npm run build:yalc
# or
yalc publish

# In your test project
yalc add sidekick-server
npm install

# After making changes to the library
npm run build:yalc  # Automatically builds and pushes to yalc

# To remove from test project
yalc remove sidekick-server
npm install

License

ISC

Author

Trinesh Lokhande