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

@davidhuanca/sga-core

v1.0.0

Published

Core package with business logic for SGA (Sistema de Gestión Académica)

Readme

@david-huanca/sga-core

Paquete Core del Sistema de Gestión Académica (SGA). Contiene toda la lógica de negocio, servicios, repositorios, validadores y tipos compartidos.

Instalación

En un Monorepo (Recomendado)

Si estás usando npm workspaces, el paquete ya está disponible:

{
  "dependencies": {
    "@david-huanca/sga-core": "*"
  }
}

Como Paquete NPM

npm install @david-huanca/sga-core

Desde Git (Para proyectos externos)

{
  "dependencies": {
    "@david-huanca/sga-core": "git+https://github.com/david-huanca/sga-nextjs.git#packages/core"
  }
}

Uso

Importar Servicios

import { UserService, ClassroomService } from "@david-huanca/sga-core";
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();
const userService = new UserService(prisma);
const classroomService = new ClassroomService(prisma);

// Usar los servicios
const users = await userService.getAllUsers();
const user = await userService.getUserById(1);

Importar Validadores

import { createUserSchema, updateUserSchema } from "@david-huanca/sga-core";

// Validar datos
const validatedData = createUserSchema.parse(userData);

Importar Errores

import { NotFoundError, ValidationError } from "@david-huanca/sga-core";

try {
  const user = await userService.getUserById(999);
} catch (error) {
  if (error instanceof NotFoundError) {
    // Manejar error 404
  }
}

Importar Tipos

import type { ApiResponse, UserWithRelations } from "@david-huanca/sga-core";

const response: ApiResponse<UserWithRelations> = {
  success: true,
  data: user,
};

Estructura

packages/core/
├── src/
│   ├── services/        # Servicios de negocio
│   ├── repositories/    # Repositorios de datos
│   ├── errors/          # Errores personalizados
│   ├── types/           # Tipos compartidos
│   ├── validators/      # Validadores Zod
│   └── index.ts         # Exportaciones públicas
├── package.json
└── tsconfig.json

Desarrollo

Build

npm run build

Esto genera los archivos compilados en dist/.

Desarrollo con Watch

npm run dev

Compila en modo watch para desarrollo.

Requisitos

  • Node.js 18+
  • TypeScript 5+
  • @prisma/client (peer dependency)

API

UserService

  • getUserById(id: number): Obtiene un usuario por ID
  • getAllUsers(): Obtiene todos los usuarios
  • getUsersByType(userType: UserType): Obtiene usuarios por tipo
  • createUser(input: CreateUserInput): Crea un nuevo usuario
  • updateUser(id: number, input: UpdateUserInput): Actualiza un usuario
  • deleteUser(id: number): Elimina un usuario

ClassroomService

  • getClassroomById(id: number): Obtiene una clase por ID
  • getAllClassrooms(): Obtiene todas las clases
  • getClassroomsByTeacher(teacherId: number): Obtiene clases por profesor
  • getClassroomsByStudent(studentId: number): Obtiene clases por estudiante
  • getClassroomsByProgram(programId: number): Obtiene clases por programa
  • createClassroom(input: CreateClassroomInput): Crea una nueva clase
  • updateClassroom(id: number, input: UpdateClassroomInput): Actualiza una clase
  • deleteClassroom(id: number): Elimina una clase
  • addStudentToClassroom(classroomId: number, userId: number): Agrega estudiante
  • removeStudentFromClassroom(classroomId: number, userId: number): Remueve estudiante
  • updateStudentScore(classroomId: number, userId: number, score: number, comment?: string): Actualiza calificación

Licencia

ISC