Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@surfskip/api-types
Advanced tools
Gives up-to-date typings for our SurfSkip API to use with @elysiajs/eden to provide a full client with type safety.
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.
@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.
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
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
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. |
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 !
FAQs
Gives up-to-date typings for our SurfSkip API to use with @elysiajs/eden to provide a full client with type safety.
The npm package @surfskip/api-types receives a total of 43 weekly downloads. As such, @surfskip/api-types popularity was classified as not popular.
We found that @surfskip/api-types demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.