
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
socket-template
Advanced tools
This repository provides a template for setting up a Socket.IO server with adapter options for distributed deployment. It is designed to help you quickly deploy a scalable real-time communication system.
git clone https://github.com/nivandres/socket-template.git
cd socket-template
bun install
bun run dev
The server can be configured using environment variables. Here's an example configuration:
PORT=3000
CORS_ORIGIN=*
AUTH_SECRET=
INSTRUMENT_USERNAME=
INSTRUMENT_PASSWORD=
ADAPTER=redis
ADAPTER_URL=redis://localhost:6379
PORT: The port number to listen on.CORS_ORIGIN: The origins to allow for cross-origin requests. Use a comma-separated list for multiple origins.AUTH_SECRET: The secret key for authentication (jsonwebtoken).INSTRUMENT_USERNAME: The username for the SocketIO and Redis instrumentation.INSTRUMENT_PASSWORD: The password for the SocketIO and Redis instrumentation.ADAPTER: The adapter to use for distributed pub/sub messaging.ADAPTER_URL: The URL for accessing the adapter.To deploy the server locally, you can use Docker Compose:
docker-compose up -d
This will start the server and Redis containers, and expose the server on port 3000.
You can access the server at http://localhost:3000.
Test the server here introducing your localhost url.
You can deploy the server to production using services such as Fly.io to scale easily.
fly launch
fly secrets set AUTH_SECRET=your_secret_key
fly secrets set INSTRUMENT_USERNAME=your_instrument_username
fly secrets set INSTRUMENT_PASSWORD=your_instrument_password
fly secrets set ADAPTER_URL=redis://redis:6379
fly deploy
Here's an example of how to use the server:
// Path: /src/socket.ts
export function handleSocket(socket: Socket) {
socket.on("message", message => {
socket.broadcast.emit("message", message);
});
}
Here's an example of how to connect to the server using Socket.IO:
const socket = io("http://localhost:3000");
socket.on("message", message => {
addMessage(message);
});
Here's an example of how to connect to the server using an external Node.js process:
import { Emitter } from "@socket.io/redis-emitter";
import { createClient } from "redis";
const client = createClient();
const io = new Emitter(client);
io.emit("message", "Hello, world!");
FAQs
Unknown package
We found that socket-template demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.