---
# System prepended metadata

title: Doko App API and Tech Spec Specs（どこアプリAPI及び技術スタック仕様書）

---

## ERD
![](https://hackmd.io/_uploads/Hk5R_JYFn.png)

## Tech Stack 技術スタック
- Frontend　フロントエンド
    - *Framework*: **React Native**
    - *Mobile*: **Expo**
    - *CSS*: **Tailwind**
    - *Map*: **Mapbox**
    - *Ads（広告）*: **Admob**
- Backend　バックエンド
    - *Runtime（ランタイムエンジン）:* **Node JS**
    - *API:* **Express JS**
    - *DB:*
        - SQL: PosgreSQL
        - ORM: Prisma
        - Db Service: Supabase
    - Admin Panel（管理者画面）: **[Supabase Admin](https://supabase.com/)** (プロジェクトに招待するのでメールアドレスをください。)
- Infrastructure　インフラ
    - *Image Hosting（画像ホスティング）:* **Supabase Storage**
    - *Server Deployment（サーバーデプロイメント）:*
        - API: [render](https://dashboard.render.com/)　**（こちらは僕の個人のgitubアカウントを使っています。チームを使う場合は有料みたいです。）**
        - Admin Panel: Supabase
        - DB: Cloud Database by Supabase

## APIs
### Create（登録） API 
**`Method: POST`**
- Garbage Bin ゴミ箱登録
    - `https://doko-api.onrender.com/api/garbage-bins`
```typescript=
// example
{
      "longitude": 1,
      "latitude": 1,
      "description": "test2",
      "imageAddress": "test",
      "garbageTypes": [{"id": "606cd25f-2aaa-4fbe-97b3-bb3ff87fe84d", "name": "Combustible"}]
}

// garbage types
[
    {
        "id": "b99470c0-409c-4549-9617-2127ec8595e7",
        "name": "Recyclable"
    },
    {
        "id": "606cd25f-2aaa-4fbe-97b3-bb3ff87fe84d",
        "name": "Combustible"
    },
    {
        "id": "b49d8168-cc4e-4fe4-a2c0-dd52318ed4ba",
        "name": "Incombustible"
    },
]

```
- Somking Area　喫煙所登録
    - `https://doko-api.onrender.com/api/smoking-areas`
```typescript=
// example
{
  "longitude": 1,
  "latitude": 1,
  "description": "test",
  "imageAddress": "test",
  "type": "INDOOR"
}

enum SmokingAreaType {
  INDOOR
  OUTDOOR
}
```
- Restroom　トイレ登録
    - `https://doko-api.onrender.com/api/restrooms`
```typescript=
// example
{
      "longitude": 1,
      "latitude": 1,
      "description": "test",
      "imageAddress": "test",
      "type": "WITHBIDET"
}

enum RestroomType {
  WITHBIDET
  WITHOUTBIDET
  GENDERNEUTRAL
}
```

### Read API 
**`Method: GET`**
- Get all Garbage Bins　全ゴミ箱取得
    - `https://doko-api.onrender.com/garbage-bins`
- Get all Smoking Area　全喫煙所取得
    - `https://doko-api.onrender.com/smoking-areas`
- Get all Restroom　全トイレ取得
    - `https://doko-api.onrender.com/restrooms`
- Get filtered Garbage Bins by Types　ゴミ箱種類絞り込み取得（燃える・燃えない・資源）
    - `https://doko-api.onrender.com/garbage-bins/types`
    - note: this get call accepts multiple types of Garbage Bins and return all garbage bins that has all the types provided by the caller of API
```typescript=
// example
{
    "types": [
    {
        "id": "b99470c0-409c-4549-9617-2127ec8595e7",
        "name": "Recyclable"
    },
    {
        "id": "606cd25f-2aaa-4fbe-97b3-bb3ff87fe84d",
        "name": "Combustible"
    }
    ]
}

// garbage types
[
    {
        "id": "b99470c0-409c-4549-9617-2127ec8595e7",
        "name": "Recyclable"
    },
    {
        "id": "606cd25f-2aaa-4fbe-97b3-bb3ff87fe84d",
        "name": "Combustible"
    },
    {
        "id": "b49d8168-cc4e-4fe4-a2c0-dd52318ed4ba",
        "name": "Incombustible"
    },
]
```
- Get filtered Garbage Bins by Items　ゴミ種類絞り込み取得
    - `https://doko-api.onrender.com/garbage-bins/items`
```typescript=
{
    "items": [
        {
            "id": "6842b13c-4223-4e47-9be1-897bd5b4667e",
            "name": "Carton Box"
        }
        {
            "id": "e398d635-a2a5-4319-91bb-eef58d75e755",
            "name": "Food"
        }
    ]
}

// garbage items
[
  {
    "id": "6842b13c-4223-4e47-9be1-897bd5b4667e",
    "name": "Carton Box"
  },
  {
    "id": "e398d635-a2a5-4319-91bb-eef58d75e755",
    "name": "Food"
  },
  {
    "id": "4ac3292a-bc69-4183-8bd7-1e34197d4dd9",
    "name": "Newspaper"
  },
  {
    "id": "78dd3c61-829e-42c1-b412-2b6fb1ae5bd7",
    "name": "Paper"
  },
  {
    "id": "cc0e9157-0830-47d5-9bde-80eee6b5e218",
    "name": "Pet Bottle"
  },
  {
    "id": "66b6ef79-2272-4825-80b0-47c24fef9bf1",
    "name": "Plastic Utensil"
  }
]
```
- Get fitered Smoking Area by Type　喫煙所種類絞り込み取得
    - `https://doko-api.onrender.com/smoking-areas/type`
```typescript=
// example
{
    "type": "INDOOR"
}

enum SmokingAreaType {
  INDOOR
  OUTDOOR
}
```
- Get fitered Restroom by Type　トイレ種類絞り込み取得
    - `https://doko-api.onrender.com/restrooms/type`
```typescript=
{
    "type": "WITHBIDET"
}

enum RestroomType {
  WITHBIDET
  WITHOUTBIDET
  GENDERNEUTRAL
}
```

### Update API 
**`Method: PUT`**
- Report Garbage Bin Missing　ゴミ箱報告
    - `https://doko-api.onrender.com/garbage-bins/missing`
```typescript=
// example
{
    "id": "3b8f7a05-de63-4852-ae8e-d02442a8c362"
}
```
- Report Restroom Missing　トイレ報告
    - `https://doko-api.onrender.com/restrooms/missing`
```typescript=
// example
{
    "id": "3b8f7a05-de63-4852-ae8e-d02442a8c362"
}
```
- Report Smoking Area Missing　喫煙所報告
    - `https://doko-api.onrender.com/smoking-areas/missing`
```typescript=
// example
{
    "id": "3b8f7a05-de63-4852-ae8e-d02442a8c362"
}
```