Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bayudc/waifuseum-api

🌸 Store anime picture collection in a Discord server
https://github.com/bayudc/waifuseum-api

anime discordjs express mongodb

Last synced: about 2 months ago
JSON representation

🌸 Store anime picture collection in a Discord server

Awesome Lists containing this project

README

        

# WaifuseumAPI

![Banner](https://media.discordapp.net/attachments/946013429200723989/946013554472013884/banner.png)

> This project is slowly migrating to: https://github.com/BayuDC/waifuseum-next. Why? so many bad code.

Waifuseum (Museum Waifu) is a simple REST API for storing and managing
anime picture collection. This project use combinaton of ExpressJS,
Discord.js, and MongoDB. This uses Discord server as a place to store
picture file and MongoDB to save the picture url. When we upload a file
to discord server, we can right click the message and get the file url
then we can save the file url in a database, and yeah **free cloud
storage to store picture file**. So, I made this project to automate
it. Btw, this project is inspired by
[Waifu.pics](https://github.com/Waifu-pics/waifu-api) and
[Nekos.life](https://github.com/Nekos-life/nekos-dot-life).

#### 💡 How it works

1. User upload the picture file to the http endpoint
2. The program send the file to Discord server via discord bot
3. The program save the url(obtained from discord bot) to database

Very simple right?

#### 📦 How are they stored

The logic is album as channel then picture as message.

![Discord Server](https://media.discordapp.net/attachments/946013429200723989/1131976837522792569/image.png)

Join my discord server if you want to see it.
Here is the link: https://discord.gg/8sSfCNCXHW.

#### â›” Limitations

~~The main drawback of this API is the file size limitation. Due to
Discord rules, This API can't save files with size more than 8 mb.
_Server Boost_ is needed to increase the maximum file size limit.~~
The limit increased to 25mb now! It's more than enough to store 4K image files.

## 🔖 API Docs

Base URL: https://api.waifuseum.art

| Path | Method | Body or Query |
| ----------------------- | ------ | ---------------------------------------- |
| `/` | GET | - |
| `/pictures` | GET | `?full` `?filter` `?page` `?count` |
| `/pictures/mine` | GET | `?full` `?filter` `?page` `?count` |
| `/pictures/all` | GET | `?full` `?filter` `?page` `?count` |
| `/pictures/` | GET | - |
| `/pictures` | POST | `{ file/fileUrl, album, source? }` |
| `/pictures/` | PUT | `{ file/fileUrl?, album?, source? }` |
| `/pictures/` | DELETE | - |
| `/albums` | GET | `?full` `?filter` `?page` `?count` |
| `/albums/mine` | GET | `?full` `?filter` `?page` `?count` |
| `/albums/all` | GET | `?full` `?filter` `?page` `?count` |
| `/albums/` | GET | - |
| `/albums//pictures` | GET | `?full` `?page` `?count` |
| `/albums` | POST | `{ name, slug?, private?, community? }` |
| `/albums/` | PUT | `{ name?, slug?, private?, community? }` |
| `/albums/` | DELETE | - |
| `/auth` | GET | - |
| `/auth/me` | GET | - |
| `/auth/login` | POST | `{ email, password }` |
| `/auth/logout` | POST | - |
| `/profile` | GET | - |
| `/profile/password` | PATCH | `{ oldPassword, newPassword }` |
| `/users` | GET | `?full` |
| `/users/` | GET | - |
| `/users` | POST | `{ name, email, password, abilities }` |
| `/users/` | PUT | `{ name?, email?, abilities? }` |
| `/users/` | DELETE | - |

Sorry i am too lazy to make Swagger UI.

## 🚧 Development

Requirements: A Discord bot that has **Worker** role in Waifuseum Discord server

```
$ git clone https://github.com/BayuDC/waifuseum.git
$ copy .env.example .env
$ pnpm install
$ pnpm dev
```