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

@surfskip/api-types

v0.57.0

Published

Gives up-to-date typings for our SurfSkip API to use with @elysiajs/eden to provide a full client with type safety.

Downloads

50

Readme

surfskip-api

An API written using Bun and Elysia for our web application.

This repository hosts the server code, but as you can see, we export typings for our NPM package to use them with @elysiajs/eden to deliver a full type safe client.

Usage of the NPM package with @elysiajs/eden

Install the packages using...

# With pnpm...
pnpm add @surfskip/api-types @elysiajs/eden

and import them wherever in your code...

import type { SurfSkipApi } from "@surfskip/api-types";
import { edenTreaty } from "@elysiajs/eden";

export const api = edenTreaty<SurfSkipApi>("https://api.surfskip.com");

You're setup! You can now use this api object to call whatever function from our API. If needed, you can read more about how @elysiajs/eden works.

Contributing to repository

We use Bun for that API. That means that we have to use WSL for development on Windows, else a Linux or macOS machine works fine.

Windows support is currently in development.

Bun can be installed with the following command:

curl -fsSL https://bun.sh/install | bash

If you have Bun installed, you can now install the dependencies with the following command:

bun install

Add environment variables

Make a copy of .env.example to .env. This file will contain the secrets variables, and should not be pushed to GitHub.

cp .env.example .env

Scripts

Here's an overview of the scripts defined in package.json.

| Command | Description | | ------- | ----------- | | bun start | Starts the development servers without hot reloading. | | bun run dev | Starts the development servers with hot reloading. | | bun release | Starts the development servers with hot reloading. | | bun run build:types | Creates the typings for the actual server code and put them into the /dist folder. These are the typings we'll publish to NPM. | | bun run build:binary | Creates a binary for the actual server code. The binary built is then used in our production servers. |

Install as a service on Linux

Bundle the app using bun run build:binary, this will create a binary named bin in the root folder.

We'll now create a service to run the binary. Run...

sudo nano /lib/systemd/system/surfskip-api.service

and input in that file, the following content...

[Unit]
Description=
After=network.target

[Service]
Type=simple
ExecStart=/home/ubuntu/surfskip-api/bin

[Install]
WantedBy=multi-user.target

Don't forget to change the ExecStart property with the one for your case.

Now, we'll start and enable the service using systemctl.

sudo systemctl enable --now surfskip-api

Now you can check its logs using...

sudo systemctl status surfskip-api

and restart using...

sudo systemctl restart surfskip-api

You're now good to go !