0.57.0 • Published 3 months ago

@surfskip/api-types v0.57.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

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.

CommandDescription
bun startStarts the development servers without hot reloading.
bun run devStarts the development servers with hot reloading.
bun releaseStarts the development servers with hot reloading.
bun run build:typesCreates 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:binaryCreates 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 !

0.57.0

3 months ago

0.56.9

4 months ago

0.56.8

4 months ago

0.56.7

4 months ago

0.56.5

4 months ago

0.56.6

4 months ago

0.56.3

4 months ago

0.56.4

4 months ago

0.56.1

4 months ago

0.56.2

4 months ago

0.56.0

4 months ago

0.55.3

4 months ago

0.55.2

4 months ago

0.55.0

4 months ago

0.55.1

4 months ago

0.53.0

4 months ago

0.54.0

4 months ago

0.52.0

4 months ago

0.51.1

4 months ago

0.51.0

5 months ago

0.50.0

5 months ago

0.48.0

5 months ago

0.49.1

5 months ago

0.49.2

5 months ago

0.49.0

5 months ago

0.46.0

5 months ago

0.44.0

5 months ago

0.43.11

5 months ago

0.43.10

5 months ago

0.43.8

5 months ago

0.47.0

5 months ago

0.45.0

5 months ago

0.43.9

5 months ago

0.43.7

6 months ago

0.43.6

6 months ago

0.43.5

6 months ago

0.43.4

6 months ago

0.42.4

6 months ago

0.42.3

6 months ago

0.42.2

6 months ago

0.42.1

6 months ago

0.42.0

6 months ago

0.41.0

6 months ago

0.40.0

6 months ago

0.39.0

7 months ago

0.38.0

7 months ago

0.37.0

7 months ago

0.36.0

7 months ago

0.35.0

7 months ago

0.34.1

7 months ago

0.34.0

7 months ago

0.33.0

8 months ago

0.32.0

8 months ago

0.31.0

8 months ago

0.30.0

8 months ago

0.29.0

8 months ago

0.28.0

8 months ago

0.27.1

8 months ago

0.27.0

8 months ago

0.26.0

8 months ago

0.25.0

8 months ago

0.24.0

8 months ago

0.23.0

8 months ago

0.22.1

8 months ago

0.22.0

8 months ago

0.21.0

8 months ago

0.20.0

8 months ago

0.19.0

8 months ago

0.18.0

8 months ago

0.17.0

9 months ago

0.16.0

9 months ago

0.15.3

9 months ago

0.15.2

9 months ago

0.15.1

9 months ago

0.15.0

9 months ago

0.14.0

9 months ago

0.13.0

9 months ago

0.12.1

9 months ago

0.12.0

9 months ago

0.11.1

9 months ago

0.11.0

9 months ago

0.10.1

9 months ago

0.10.0

9 months ago

0.9.0

9 months ago

0.8.0

9 months ago

0.7.6

9 months ago

0.7.5

9 months ago

0.7.4

9 months ago

0.7.3

9 months ago

0.7.2

9 months ago

0.7.1

9 months ago

0.7.0

9 months ago

0.6.0

9 months ago

0.5.0

9 months ago

0.4.0

9 months ago

0.3.1

9 months ago

0.3.0

9 months ago

0.2.3

9 months ago

0.2.2

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.1.0

9 months ago