Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spin-up-ping

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spin-up-ping

Keep your server awake and prevent it from spinning down due to inactivity! Perfect for free-tier hosting platforms like Render, Heroku, etc.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
50
decreased by-84.85%
Maintainers
0
Weekly downloads
 
Created
Source

spin-up-ping 🚀

Keep your server awake and prevent it from spinning down due to inactivity! Perfect for free-tier hosting platforms like Render, Heroku, etc.

NPM Version GitHub Issues License

Why spin-up-ping? 🤔

Free-tier hosting services often spin down your server after a period of inactivity (usually 15-30 minutes). This can lead to slow response times when the server needs to spin up again. spin-up-ping solves this by sending periodic pings to keep your server alive.

Features ✨

  • 🔄 Configurable ping intervals (minimum 5 minutes)
  • 📊 Success and error callbacks for monitoring
  • 🛡️ Built-in abuse prevention
  • 💪 Written in TypeScript with full type support
  • 🎯 Zero dependencies (except axios for HTTP requests)

Installation 📦

# Using npm
npm install spin-up-ping

# Using yarn
yarn add spin-up-ping

# Using pnpm
pnpm add spin-up-ping

Usage 💻

import {SpinUp} from "spin-up-ping";

const pinger = new SpinUp({
  url: "https://your-server.com", // Your server URL
  intervalMinutes: 5, // Minimum 5 minutes
  onSuccess: (response) => {
    // Optional success callback
    console.log("Ping successful:", response);
  },
  onError: (error) => {
    // Optional error callback
    console.error("Ping failed:", error);
  },
});

// Start pinging
pinger.start();

// Stop pinging (if needed)
pinger.stop();

API Reference 📚

Constructor Options
interface SpinUpOptions {
  url: string; // URL to ping
  intervalMinutes: number; // Interval between pings (min: 5)
  onSuccess?: (response: any) => void; // Success callback
  onError?: (error: Error) => void; // Error callback
}
Methods
  • start(): Start the ping service
  • stop(): Stop the ping service

Common Use Cases 🎯

  1. Free Hosting Services

    • Prevent Render, Railway.app etc from sleeping
  2. Development & Testing

    • Keep development servers active
    • Monitor server health

Best Practices 💡

  1. Set interval slightly lower than your hosting platform's timeout
  2. Implement error handling for network issues
  3. Use environment variables for server URLs

Contributing 🤝

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License 📄

ISC © Muhsin Abdul Nissar

Support ⭐

If you found this package helpful, please consider giving it a star on GitHub!

Keywords

FAQs

Package last updated on 10 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc