
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@smkdev/geolocation
Advanced tools
Biblioteca Node.js completa para geolocalização com mapas interativos e WebSockets em tempo real
Biblioteca Node.js completa para geolocalização com mapas interativos, WebSockets em tempo real e funcionalidades de geocodificação. Perfeita para integração entre apps React Native (Expo) e frontends Next.js.
npm install @smkdev/geolocation
import { GeoLocationLib } from '@smkdev/geolocation';
const geoLib = new GeoLocationLib({
port: 3001,
cors: {
origin: ["http://localhost:3000", "exp://192.168.1.100:19000"] // Next.js + Expo
}
});
await geoLib.start();
console.log('🌍 Servidor de geolocalização rodando!');
import { createServices } from '@smkdev/geolocation';
const services = createServices();
// Calcular distância entre dois pontos
const distance = services.geolocation.calculateDistance(
{ lat: -23.5505, lng: -46.6333 }, // São Paulo
{ lat: -22.9068, lng: -43.1729 } // Rio de Janeiro
);
console.log(`Distância: ${Math.round(distance/1000)}km`);
// Geocodificação
const locations = await services.geocoding.geocode('São Paulo, Brasil');
console.log('Coordenadas:', locations[0]);
import { io } from 'socket.io-client';
import * as Location from 'expo-location';
const useRealTimeTracking = (serverUrl) => {
const [socket, setSocket] = useState(null);
useEffect(() => {
const newSocket = io(serverUrl);
setSocket(newSocket);
const startTracking = async () => {
const { status } = await Location.requestForegroundPermissionsAsync();
if (status === 'granted') {
await Location.watchPositionAsync({
accuracy: Location.Accuracy.High,
timeInterval: 5000, // 5 segundos
distanceInterval: 10 // 10 metros
}, (location) => {
newSocket.emit('location_update', {
userId: 'user123',
latitude: location.coords.latitude,
longitude: location.coords.longitude,
timestamp: Date.now()
});
});
}
};
startTracking();
return () => newSocket.close();
}, [serverUrl]);
return socket;
};
import { useEffect, useState } from 'react';
import { io } from 'socket.io-client';
export default function TrackingPage() {
const [users, setUsers] = useState(new Map());
useEffect(() => {
const socket = io('http://seu-backend.com:3001');
socket.on('location_update', (data) => {
setUsers(prev => {
const updated = new Map(prev);
updated.set(data.userId, {
...data,
lastUpdate: new Date()
});
return updated;
});
});
socket.on('user_disconnected', (data) => {
setUsers(prev => {
const updated = new Map(prev);
updated.delete(data.userId);
return updated;
});
});
return () => socket.close();
}, []);
return (
<div>
<h1>📍 Rastreamento em Tempo Real</h1>
{Array.from(users.values()).map(user => (
<div key={user.userId} style={{
padding: '10px',
border: '1px solid #ccc',
margin: '5px',
borderRadius: '5px'
}}>
<strong>👤 {user.userId}</strong><br/>
📍 Lat: {user.latitude.toFixed(6)}<br/>
📍 Lng: {user.longitude.toFixed(6)}<br/>
🕐 {user.lastUpdate.toLocaleTimeString()}
</div>
))}
</div>
);
}
// Enviar (cliente → servidor)
socket.emit('location_update', locationData);
socket.emit('location_share', { userId, latitude, longitude, message });
socket.emit('join_room', { userId, roomId });
// Receber (servidor → cliente)
socket.on('location_update', handleLocationUpdate);
socket.on('user_connected', handleUserConnected);
socket.on('geofence_alert', handleGeofenceAlert);
// Geocodificação
GET /api/geocoding/forward?q=São Paulo, Brasil
GET /api/geocoding/reverse?lat=-23.5505&lng=-46.6333
// Cálculos de distância
POST /api/geolocation/distance
{
"from": {"lat": -23.5505, "lng": -46.6333},
"to": {"lat": -23.5506, "lng": -46.6334}
}
import { GeoLocationLib } from '@smkdev/geolocation';
const geoLib = new GeoLocationLib({
port: 3001,
cors: {
origin: process.env.ALLOWED_ORIGINS?.split(',') || ["*"]
},
security: {
rateLimit: {
windowMs: 15 * 60 * 1000, // 15 minutos
max: 100 // máximo 100 requests por IP
}
},
geocoding: {
providers: ['openstreetmap', 'nominatim'],
cacheTimeout: 60 * 60 * 1000, // 1 hora
maxRequestsPerMinute: 60
}
});
Para documentação completa, exemplos avançados e guias de implementação, visite:
MIT © smkdev
🌍 Construa aplicações de geolocalização em tempo real de forma simples e rápida!
FAQs
Biblioteca Node.js completa para geolocalização com mapas interativos e WebSockets em tempo real
The npm package @smkdev/geolocation receives a total of 0 weekly downloads. As such, @smkdev/geolocation popularity was classified as not popular.
We found that @smkdev/geolocation demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.