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

@alancode95/core-prisma

v1.0.0

Published

Paket inti (core package) yang membungkus berbagai fitur backend penting untuk aplikasi modern berbasis **Bun** dan **Elysia.js**. Paket ini dirancang untuk memberikan fondasi yang kuat, terstruktur, dan terskala dengan mengintegrasikan ORM, sistem antrea

Readme

@alancode95/core-prisma

Paket inti (core package) yang membungkus berbagai fitur backend penting untuk aplikasi modern berbasis Bun dan Elysia.js. Paket ini dirancang untuk memberikan fondasi yang kuat, terstruktur, dan terskala dengan mengintegrasikan ORM, sistem antrean, cache, otentikasi, dan berbagai utilitas lainnya.

🚀 Fitur Utama

Paket ini menyediakan modul-modul (Support modules) berikut:

  • Database (Prisma ORM) Mendukung berbagai dialek database relasional, dipilih saat runtime lewat DB_CONNECTION:

    • MySQL / MariaDB (provider = "mysql")
    • PostgreSQL (provider = "postgresql")
    • SQLite (provider = "sqlite") Setiap dialek punya schema Prisma sendiri di prisma-<dialek>/schema.prisma dengan client ter-generate terpisah (src/generated/prisma/<dialek>), sehingga peralihan dialek runtime tetap terjaga. Catatan: Dukungan terhadap Supabase juga tersedia karena Supabase menggunakan PostgreSQL (cukup masukkan URL database Supabase pada konfigurasi).
  • Authentication & Authorization Manajemen otentikasi (JWT / Session), hashing kata sandi dengan bcryptjs, manajemen token, dan pengaturan policy/otorisasi akses.

  • Cache Management Sistem caching yang dinamis dan mendukung beberapa driver (File, Database, dan Redis via ioredis).

  • Queue & Background Jobs Sistem antrean pekerjaan (queueing) asinkron untuk memproses background jobs menggunakan database queue.

  • Broadcasting & Events Sistem event-driven dan broadcasting data secara realtime (misalnya menggunakan RedisBroadcaster).

  • Storage & Uploads Manajemen file dan penyimpanan yang mendukung penyimpanan disk lokal (Local) maupun cloud/object storage seperti AWS S3 (S3StorageDisk).

  • Logging Sistem logging terpusat dan terstruktur menggunakan pino, lengkap dengan penyaringan error, peringatan, dan rotasi log.

  • Mail & Notifications Dukungan pengiriman email melalui SMTP dan notifikasi multi-saluran (multi-channel).

  • Scheduling Manajemen Cron Jobs atau penjadwalan tugas latar belakang.

📦 Instalasi

Jika Anda menggunakan Bun:

bun add @alancode95/core-prisma

Pastikan juga untuk menginstal peer dependencies yang diperlukan (Prisma 7):

bun add elysia @prisma/client pino zod
bun add -d prisma

Driver database di-runtime memakai Prisma Driver Adapter (Prisma 7 tidak lagi memakai URL koneksi klasik). Adapter berikut sudah menjadi dependency paket ini dan driver-nya ikut terpasang otomatis:

  • SQLite → @prisma/adapter-libsql (memakai @libsql/client; dipilih karena better-sqlite3 native gagal di-load di Bun)
  • MySQL/MariaDB → @prisma/adapter-mariadb
  • PostgreSQL/Supabase → @prisma/adapter-pg

Perkakas reset schema (db:migrate:fresh/db:migrate:reset) memakai driver mentah terpisah (opsional, hanya untuk dialek terkait):

bun add mysql2      # untuk reset MySQL/MariaDB
bun add postgres    # untuk reset PostgreSQL/Supabase

Setelah itu, generate Prisma Client untuk tiap dialek yang dipakai:

bunx prisma generate --schema=prisma-mysql/schema.prisma
bunx prisma generate --schema=prisma-postgresql/schema.prisma
bunx prisma generate --schema=prisma-sqlite/schema.prisma

🛠 Konfigurasi Database

Paket ini menggunakan Prisma ORM (v7) sebagai fondasi akses database. Konfigurasi otomatis diambil dari variabel lingkungan (.env). Perintah db:* (mis. bun run db:migrate) memilih schema prisma-<DB_CONNECTION>/schema.prisma dan menyetel DATABASE_URL yang sesuai secara otomatis; client runtime tersambung lewat driver adapter per-dialek. Path SQLite di-resolusi absolut agar CLI migrasi dan adapter runtime menunjuk file yang sama.

1. MySQL (Default)

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=nama_database
DB_USERNAME=root
DB_PASSWORD=secret

2. PostgreSQL / Supabase

Supabase menggunakan PostgreSQL sehingga cukup arahkan parameter ke pooler Supabase.

DB_CONNECTION=postgresql
DB_HOST=aws-0-ap-southeast-1.pooler.supabase.com
DB_PORT=6543
DB_DATABASE=postgres
DB_USERNAME=postgres.xxxx
DB_PASSWORD=secret_password
DB_SSL=require

3. SQLite

DB_CONNECTION=sqlite
DB_URL=database/database.sqlite

(Catatan Audit: Saat ini MongoDB belum didukung secara bawaan karena lapisan database berfokus pada database relasional SQL. Prisma sebenarnya memiliki konektor MongoDB, namun mengaktifkannya memerlukan schema/relasi terpisah di luar cakupan paket ini.)

📚 Struktur Modul (Ekspor)

Anda dapat mengimpor modul yang spesifik langsung dari sub-path yang disediakan:

// Contoh impor modul database
import { getDatabaseClient } from "@alancode95/core-prisma/Support/Database";

// Contoh impor modul cache
import { CacheManager } from "@alancode95/core-prisma/Support/Cache";

// Contoh impor modul antrean
import { QueueManager } from "@alancode95/core-prisma/Support/Queue";

Untuk melihat daftar lengkap ekspor, Anda dapat memeriksa exports field di dalam package.json.

🔒 Otentikasi dan Keamanan

Fungsi otentikasi bawaan sudah dilengkapi dengan enkripsi password (menggunakan bcrypt) dan pengelolaan token pembaharuan (reset token). Modul Encryption juga dapat dimanfaatkan untuk melakukan enkripsi dan dekripsi data sensitif dalam aplikasi.

🚦 Routing dan Middleware

Terintegrasi erat dengan Elysia, paket ini juga memiliki dukungan pengelolaan middleware bawaan untuk menyaring request seperti batasan akses (Rate Limiting), perlindungan CSRF, dan pembersihan data (Sanitization).

📄 Lisensi

Hak Cipta © 2026. Alancode95.