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

atsim-db

v6.0.0

Published

Uma database simples baseada em JSON para Node.js - sem SQLite, sem compilação nativa

Readme

🤖 ATSIM-DB - Database para Discord.js

Uma database simples e otimizada para bots Discord.js - sem SQLite, sem compilação nativa!

✨ Características Especiais para Discord

  • 🤖 Feito para Discord.js - funções específicas para bots
  • 👥 Sistema de usuários completo - moedas, XP, levels, daily rewards
  • 🏰 Configurações por servidor - prefix personalizado, canais, auto-role
  • 🏆 Rankings automáticos - top moedas e levels
  • Cache inteligente - performance otimizada
  • 💾 Backup automático - seus dados sempre seguros
  • 📦 Zero dependências - apenas JavaScript puro

📥 Instalação

npm install atsim-db

🚀 Uso Rápido no seu Bot

const { Client, GatewayIntentBits } = require('discord.js');
const db = require('atsim-db');

const client = new Client({ 
    intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] 
});

client.on('messageCreate', async (message) => {
    if (message.author.bot) return;
    
    const prefix = db.getPrefix(message.guild.id);
    if (!message.content.startsWith(prefix)) {
        // Adicionar XP por mensagem
        const xpResult = db.addXP(message.author.id, 5);
        if (xpResult.levelUp) {
            message.reply(`🎉 Parabéns! Você subiu para o **Level ${xpResult.newLevel}**!`);
        }
        return;
    }
    
    const args = message.content.slice(prefix.length).split(' ');
    const command = args.shift().toLowerCase();
    
    if (command === 'coins') {
        const user = db.getUser(message.author.id);
        const coins = user?.coins || 0;
        message.reply(`💰 Você tem **${coins}** moedas!`);
    }
});

📚 API Completa

Operações Básicas

get(key)

Busca um valor na database.

const valor = db.get('minha_chave');

set(key, value)

Define um valor na database.

db.set('nome', 'João');
db.set('config', { theme: 'dark', lang: 'pt' });

delete(key)

Remove uma chave da database.

db.delete('chave_antiga'); // retorna true se removido

Sistema de Usuários

getUser(userId)

Busca dados completos de um usuário.

const user = db.getUser('123');
// Retorna: { id: '123', coins: 50, created_at: '...', last_seen: '...' }

addCoins(userId, amount)

Adiciona moedas a um usuário.

const totalCoins = db.addCoins('user123', 50); // retorna total após adição

setUser(userId, userData)

Define dados personalizados para um usuário.

db.setUser('user123', {
    name: 'João',
    level: 5,
    inventory: ['sword', 'potion']
});

getAllUsers()

Lista todos os usuários.

const users = db.getAllUsers(); // Array com todos os usuários

Utilitários

getStats()

Obtém estatísticas da database.

const stats = db.getStats();
console.log(stats);
// {
//   total_users: 10,
//   total_keys: 25,
//   database_size: 2048,
//   created_at: '2024-01-01T00:00:00.000Z',
//   last_updated: '2024-01-01T12:00:00.000Z'
// }

backup(path)

Cria backup manual.

db.backup('./meu_backup.json'); // retorna true se sucesso

🔧 Configuração Avançada

const AtsimDB = require('atsim-db');

// Instância personalizada
const customDB = new AtsimDB({
    dbPath: './custom_database.json',
    backupPath: './custom_backup.json',
    autoBackup: true // padrão: true
});

customDB.set('test', 'valor');

📁 Estrutura dos Dados

A database é salva como JSON com a seguinte estrutura:

{
  "users": {
    "user123": {
      "id": "user123",
      "coins": 150,
      "created_at": "2024-01-01T00:00:00.000Z",
      "last_seen": "2024-01-01T12:00:00.000Z"
    }
  },
  "data": {
    "minha_chave": "meu_valor",
    "config": { "theme": "dark" }
  },
  "created_at": "2024-01-01T00:00:00.000Z",
  "last_updated": "2024-01-01T12:00:00.000Z"
}

💾 Backup Automático

Por padrão, a ATSIM-DB cria um backup automático antes de cada escrita:

  • Arquivo principal: database.json
  • Backup automático: database.backup.json

⚡ Exemplos Práticos

Bot de Discord com Sistema de Moedas

const db = require('