Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.github
dist
node_modules
redoc-static.html
8 changes: 4 additions & 4 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- name: find pnpm cache path
id: cache
run: echo "::set-output name=path::$(pnpm store path)"
run: echo "path=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
with:
Expand All @@ -47,7 +47,7 @@ jobs:

- name: find pnpm cache path
id: cache
run: echo "::set-output name=path::$(pnpm store path)"
run: echo "path=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
with:
Expand All @@ -74,7 +74,7 @@ jobs:

- name: find pnpm cache path
id: cache
run: echo "::set-output name=path::$(pnpm store path)"
run: echo "path=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
with:
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
- name: Declare some variables
id: sha
shell: bash
run: echo "::set-output name=short::$(git rev-parse --short HEAD)"
run: echo "short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Push to dokku
uses: dokku/github-action@v1.4.0
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.env
coverage/
sqlite/
redoc-static.html

# Logs
logs
Expand Down
36 changes: 0 additions & 36 deletions .insomnia/ApiSpec/spc_7e10a96013aa4a42a2bddbea58e3626e.yml

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions .insomnia/Environment/env_d6d79d18524a4e5787f0737b11191e39.yml

This file was deleted.

This file was deleted.

34 changes: 0 additions & 34 deletions .insomnia/Request/req_783d4852615e4f1985560e1f8019ffc8.yml

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions .insomnia/Workspace/wrk_215de5f85350491cb7eb1dd32c66969e.yml

This file was deleted.

1 change: 1 addition & 0 deletions CHECKS
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ TIMEOUT=60
ATTEMPTS=10

/api/ids?source=anilist&id=145815 145815
/api/v2/ids?source=anilist&id=145815 145815
39 changes: 35 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,47 @@
FROM node:18-alpine
FROM node:18-alpine as runtime_deps

RUN corepack enable

WORKDIR /app

COPY . .
COPY package.json .
COPY pnpm-lock.yaml .
COPY .npmrc .

# Source maps enabled, since it does not affect performance from what I found
ENV HUSKY=0
ENV CI=1
ENV NODE_ENV=production
# Install dependencies
RUN pnpm install --frozen-lockfile


FROM node:18-alpine as docs

RUN corepack enable

WORKDIR /app

COPY package.json .
COPY pnpm-lock.yaml .
COPY .npmrc .
COPY docs/openapi.yaml docs/openapi.yaml

ENV CI=1
# Install dependencies
RUN pnpm install --frozen-lockfile

RUN pnpm --silent run docs


FROM node:18-alpine

RUN corepack enable

WORKDIR /app

COPY . .
COPY --from=runtime_deps /app/node_modules node_modules
COPY --from=docs /app/redoc-static.html .

# Run with...
# Source maps enabled, since it does not affect performance from what I found
ENV NODE_OPTIONS="--enable-source-maps"
Expand Down
63 changes: 18 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
[![](https://img.shields.io/github/actions/workflow/status/BeeeQueue/arm-server/cicd.yml?branch=master)](https://github.com/BeeeQueue/arm-server/actions?query=branch%3Amaster+workflow%3ACI)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FBeeeQueue%2Fupptime%2FHEAD%2Fapi%2Farm-server-arm-haglund-dev%2Fuptime-week.json)](https://status.haglund.dev/history/arm-server-arm-haglund-dev)

This app uses data from [`anime-offline-database`](https://github.com/manami-project/anime-offline-database/) - fetching
This app uses data from [`Fribb/anime-lists`](https://github.com/Fribb/anime-lists) - fetching
and updating itself every 24 hours.

[`Fribb/anime-lists`](https://github.com/Fribb/anime-lists) is an automatic merged copy of
[`anime-offline-database`](https://github.com/manami-project/anime-offline-database)
and
[`Anime-Lists/anime-lists`](https://github.com/Anime-Lists/anime-lists).


#### Get notifications on important API changes

Subscribe to new releases in this repo:
Expand All @@ -20,57 +26,24 @@ cannot fix them due to complexity. Therefore this service has manual rules that
You can help add rules by submitting
a [manual rule request](https://github.com/BeeeQueue/arm-server/issues/new?template=manual-rule-request.md).

## API

**Base URL:** `https://arm.haglund.dev`

```ts
enum Source {
anilist,
anidb,
myanimelist,
kitsu,
}
```

### Get IDS:

`GET/POST` `/api/ids`

Either use GET with query parameters:
`?source={Source}&id={number}`

or use POST with a JSON body:

`{ "anilist": 1337 }`

`[{ "anilist": 1337 }, { "anilist": 69 }, { "anidb": 420 }]`

#### Response

```ts
interface Entry {
anilist: number | null
anidb: number | null
myanimelist: number | null
kitsu: number | null
}

// If JSON body is a single object
// { "anilist": 1337 } => Entry | null
// // If JSON body is an array of objects
// [{ ... }] => Array<Entry | null>
```

**The response code will always be 200 (OK).**
If an entry is not found `null` is returned instead.
## [API Docs](https://arm.haglund.dev/docs)

## Development

### Server

1. Clone the project
1. Install dependencies - `pnpm`
1. Run database migrations - `pnpm migrate`
1. Download data (optional) - `pnpm fetch-data`
1. Start the server - `pnpm dev`

If the database connection fails double check that your `NODE_ENV` is set to `development`.

### Docs

1. Clone the project
1. Install dependencies - `pnpm`
1. Start the build - `pnpm docs:dev`
1. Open the file in a browser - `redoc-static.html`
1. Edit `docs/openapi.yaml` file
Loading