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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@apie/kit

v0.7.2

Published

Library template that uses Vite for building, Vitest for testing, Changesets for versioning, renovate for upgrading packages.

Downloads

187

Readme

Linting & Tests SemVer.org PaypalMe

What is @apie and @apie/kit?

An eco-system for infrastructure around REST API. @apie/kit is made for  SvelteKit  as a typed bridge between the frontend and your backend REST API.

  • Endpoints that validate JSON and URLSearchParams (query) via Zod
  • Easy to read Responses
  • Accessible frontend API with generated types

Get started

[!NOTE]
Documentation incomplete.

bun add -D @apie/kit @apie/responses @apie/pipe

Add the plugin that generates your API type

vite.config.ts

import { defineConfig } from 'vite'
import { sveltekit } from '@sveltejs/kit/vite'
import { watchAPI } from '@apie/kit'

export default defineConfig({
	plugins: [sveltekit(), watchAPI()]
})

Add a shortcut to the api

svelte.config.js

/** @type {import('@sveltejs/kit').Config} */
const config = {
	kit: {
		alias: {
			api: './src/api.ts',

Define your endpoint

src/routes/api/users

import z from 'zod'
import { OK, BadRequest } from '@apie/responses'
import { endpoint } from '@apie/kit'

import getUsers from '...'

const query = z.object({
	limit: z.number()
})

export const GET = endpoint({ /* body, */ query }, pipe => pipe(
	async e => {
		const users = await getUsers({ limit: e.query.limit })
		if(!users) {
			return BadRequest({
				error: 'Too many users!... :D'
			})
		}
		
		return OK({ users })
	}
))

Use your API in your svelte file!

src/routes/+page.svelte

<script>
	import api from '$api'

	const result = api.users.GET({ query: { limit: 5 } })
		.any(res => console.log(res))
		.$ // return the output of the following functions in order:
		.OK(res => res.json()) // result = [this, ...]
		.BadRequest(async res => (await res.json()).error) // result = [..., this]

</script>

{#await result}
	loading users...
{:then [userList, error]}
	...
{/await}

@apie/pipe

Make your life easier, and learn how to utilize @apie/pipe. This enables code-splitting patterns, inspired by the functional programming paradigm.

This is optional, but a powerful one at that.