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

turso-db-plugin

v1.0.1

Published

Turso ve Drizzle için yeniden kullanılabilir eklenti paketi

Readme

turso-db-plugin

Bu eklenti, React/Node.js projelerinde Turso (LibSQL) ve Drizzle ORM kullanımını standartlaştırmak, tekrar eden veritabanı bağlantı kodlarını önlemek ve proje bazlı Drizzle CLI komutlarını tek bir merkezden yönetmek amacıyla oluşturulmuştur.

🚀 Özellikler

  • Merkezi Veritabanı Bağlantısı: Her projede tekrar Drizzle başlatma kodunu yazmanızı engeller.
  • Vite Proxy Desteği: Vite kullanan projelerde Turso URL'inize ve Auth Token'ınıza özel güvenli ve hazır proxy yapılandırması sunar.
  • Yerleşik CLI Komutları: Drizzle Studio, Push ve Generate işlemlerini turso-db komutu üzerinden otomatize eder.

📦 Kurulum

Bu eklentiyi yerel olarak projenize dahil etmek için projenizin kök dizininde aşağıdaki komutu çalıştırabilirsiniz:

yarn add file:../turso-db-plugin
# Veya npm kullanıyorsanız:
# npm install file:../turso-db-plugin

Not: Eğer paketi NPM'de yayınladıysanız, yarn add turso-db-plugin şeklinde normal kurulum da yapabilirsiniz.


🛠️ Kullanım Rehberi

1. Vite Proxy Yapılandırması (vite.config.js)

React / Vue projenizdeki vite.config.js dosyasına girerek veritabanı API yönlendirmesini tek satırda çözümleyebilirsiniz:

import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import { getTursoProxy } from 'turso-db-plugin';

export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd(), '');
  return {
    plugins: [react()],
    server: {
      proxy: {
        // Eklentiden gelen proxy ayarını dahil ediyoruz
        ...getTursoProxy(env.TURSO_URL, env.TURSO_AUTH_TOKEN)
      }
    }
  }
});

2. Veritabanı Bağlantısı (src/db/db.js)

libsql/client veya drizzle-orm yapılandırmasını tekrar tekrar yazmak yerine sadece bilgilerinizi gönderip bağlantınızı kurun:

import { initTursoDb } from 'turso-db-plugin';
import * as schema from './schema.js';

// .env dosyanızdan bilgilerinizi çekin
const dbConfig = {
    url: import.meta.env.VITE_TURSO_URL,
    authToken: import.meta.env.VITE_TURSO_TOKEN,
    schema: schema // (Opsiyonel) Projeye özel Drizzle tablolarınız
};

export const db = initTursoDb(dbConfig);

3. Komut Kullanımları (package.json Scripts)

Ana projenizin package.json dosyasındaki karmaşık drizzle-kit komutları yerine kısaltılmış turso-db komutlarımızı kullanabilirsiniz:

  "scripts": {
    "db:push": "turso-db push",
    "db:studio": "turso-db studio",
    "db:generate": "turso-db generate"
  }

Özel ismiyle bir migration üretmek isterseniz terminalde şöyle kullanabilirsiniz (-- ayırıcısı önemlidir):

yarn db:generate -- users_table_added

⚙️ Gereksinimler

Projenizde kullanılacak çevresel değişkenler (Environment Variables):

  • VITE_TURSO_URL veya TURSO_URL
  • VITE_TURSO_TOKEN veya TURSO_AUTH_TOKEN