From 1c641d5f54845ff4ee0d5358e7bce395b536fb75 Mon Sep 17 00:00:00 2001 From: koutyuke Date: Thu, 1 Jan 2026 17:46:19 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=93=9D=20doc(act):=20add=20README=20f?= =?UTF-8?q?or=20local=20CI=20setup=20using=20act?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/act/README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/act/README.md diff --git a/.github/act/README.md b/.github/act/README.md new file mode 100644 index 00000000..a7d4371a --- /dev/null +++ b/.github/act/README.md @@ -0,0 +1,27 @@ +# Act Debug + +Perform CI performed by Github Action in a local environment + +Install [`act`](https://github.com/nektos/act) and Start `Docker` for local environment. + +## Setup + +1. add .env file in the root directory ref .env.example +2. add .secrets file in the root directory ref .secrets.example + +## Run + +```sh +# run all workflows +act --container-architecture linux/amd64\ + --secret-file ./.github/act/.secrets\ + --env-file ./.github/act/.env\ + --defaultbranch main + +# run specific workflow +act --container-architecture linux/amd64\ + --secret-file ./.github/act/.secrets\ + --env-file ./.github/act/.env\ + --defaultbranch main\ + -W "target-flow" +``` From 43735c34bda372228e99a32fef674441c0f4d71a Mon Sep 17 00:00:00 2001 From: koutyuke Date: Thu, 1 Jan 2026 17:46:38 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=93=96=20docs(api):=20enhance=20READM?= =?UTF-8?q?E=20and=20architecture=20documentation=20for=20clarity=20and=20?= =?UTF-8?q?structure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/README.md | 244 +++++++++++++++++++++++++++------- apps/api/docs/architecture.md | 47 ++----- 2 files changed, 211 insertions(+), 80 deletions(-) diff --git a/apps/api/README.md b/apps/api/README.md index 0943da2c..93edfd81 100644 --- a/apps/api/README.md +++ b/apps/api/README.md @@ -1,90 +1,242 @@ # mona-ca Backend API Server -## What's this ? +Backend API server for mona-ca. -This is the code for the Server-Side API of mona-ca. +## ๐Ÿ“– Table of Contents + +- [Overview](#overview) +- [Tech Stack](#tech-stack) +- [Architecture](#architecture) +- [Setup](#setup) +- [Development](#development) +- [Testing](#testing) +- [Database](#database) +- [Deployment](#deployment) + +## Overview + +mona-ca Backend API is a serverless API server running on Cloudflare Workers. +Built with Clean Architecture principles to ensure high maintainability and extensibility. + +## Tech Stack It is made by these: -* __Bun__ ๐ŸฅŸ: All-in-one JavaScript runtime -* __Wrangler__ โ˜๏ธ: The Cloudflare Developer Platform -* __ElysiaJS__ ๐ŸฆŠ: Ergonomic web framework -* __Drizzle ORM__ ๐ŸŒฆ๏ธ: Headless TypeScript ORM -* __Lucia__ ๐Ÿ”: Auth library -* __Oslo__ ๐Ÿ”’: Many auth utilities -* __Arctic__ ๐Ÿ”: Collection of OAuth 2.0 clients -* __Resend__ โœ‰๏ธ: Library for the Resend API. +__Bun__ ๐ŸฅŸ: All-in-one JavaScript runtime + +__Wrangler__ โ˜๏ธ: The Cloudflare Developer Platform + +__ElysiaJS__ ๐ŸฆŠ: Ergonomic web framework + +__Drizzle ORM__ ๐ŸŒฆ๏ธ: Headless TypeScript ORM + +__Lucia__ ๐Ÿ”: Auth library + +__Oslo__ ๐Ÿ”’: Many auth utilities + +__Arctic__ ๐Ÿ”: Collection of OAuth 2.0 clients + +__Resend__ โœ‰๏ธ: Library for the Resend API. + +## Architecture + +Built on Clean Architecture, DDD, and Onion Architecture with a layered architecture pattern. -Project Architecture: +### Architecture Principles -* __Clean Architecture__ ๐Ÿ“š: to ensure independence -* __Repository Pattern__ ๐Ÿ—„๏ธ: Abstraction of data access -* __SOLID Principles__ ๐Ÿ”„: Programming Principles +- **Clean Architecture**: Keep business logic independent from frameworks and infrastructure +- **DDD**: Domain-Driven Design +- **Onion Architecture**: Onion Architecture +- **Repository Pattern**: Abstract data access logic +- **SOLID Principles**: Design principles for maintainability and extensibility +- **Dependency Injection**: Improve testability +- **Feature-based Organization**: Organize code by domain features -## Start Development Server +### Layer Structure -To start the development server run: +```text +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ Presentation Layer โ”‚ routes/ +โ”‚ (ElysiaJS Routes) โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค +โ”‚ Adapter Layer โ”‚ features/*/adapters/ +โ”‚ (Presenters, Repositories, โ”‚ +โ”‚ Gateways) โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค +โ”‚ Application Layer โ”‚ features/*/application/ +โ”‚ (Use Cases, Ports) โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค +โ”‚ Domain Layer โ”‚ features/*/domain/ +โ”‚ (Entities, Value Objects) โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค +โ”‚ Infrastructure Layer โ”‚ core/infra/ +โ”‚ (Drizzle, Crypto, Config) โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +``` + +See [Architecture Documentation](./docs/architecture.md) for details. + +### Directory Structure + +```text +apps/api/ +โ”œโ”€โ”€ src/ +โ”‚ โ”œโ”€โ”€ core/ # Common infrastructure & libraries +โ”‚ โ”‚ โ”œโ”€โ”€ adapters/ # Common adapter implementations +โ”‚ โ”‚ โ”œโ”€โ”€ di/ # DI container +โ”‚ โ”‚ โ”œโ”€โ”€ domain/ # Common domain objects +โ”‚ โ”‚ โ”œโ”€โ”€ infra/ # Infrastructure implementations +โ”‚ โ”‚ โ”œโ”€โ”€ lib/ # Common libraries +โ”‚ โ”‚ โ”œโ”€โ”€ ports/ # Common interfaces +โ”‚ โ”‚ โ””โ”€โ”€ testing/ # Testing support +โ”‚ โ”œโ”€โ”€ features/ # Feature modules +โ”‚ โ”‚ โ””โ”€โ”€ [feature]/ # Each feature +โ”‚ โ”‚ โ”œโ”€โ”€ adapters/ # Adapter layer +โ”‚ โ”‚ โ”œโ”€โ”€ application/ # Application layer +โ”‚ โ”‚ โ”œโ”€โ”€ di/ # Feature DI container +โ”‚ โ”‚ โ”œโ”€โ”€ domain/ # Domain layer +โ”‚ โ”‚ โ””โ”€โ”€ testing/ # Testing support +โ”‚ โ”œโ”€โ”€ plugins/ # Elysia plugins +โ”‚ โ”œโ”€โ”€ routes/ # Route definitions +โ”‚ โ””โ”€โ”€ index.ts # Entry point +โ”œโ”€โ”€ tests/ # E2E tests +โ”œโ”€โ”€ drizzle/ # DB migrations +โ”œโ”€โ”€ docs/ # Documentation +โ”œโ”€โ”€ types/ # Type definitions +โ”œโ”€โ”€ package.json # Package configuration +โ”œโ”€โ”€ tsconfig.json +โ”œโ”€โ”€ vitest.config.ts +โ”œโ”€โ”€ wrangler.jsonc # Cloudflare configuration +โ””โ”€โ”€ drizzle.config.ts # Drizzle configuration +``` + +## Setup + +### Installation ```sh -# install -bun i +# Install dependencies +bun install +``` + +### Environment Variables + +Create a `.dev.vars` file and set the required environment variables. + +### Database Setup + +```sh +# Generate migration files +bun run db:gen + +# Apply migrations (local) +bun run db:mig +``` -# dev server start -bun dev +## Development + +### Start Development Server + +```sh +bun run dev ``` -## OpenAPI +The development server starts at `http://localhost:8787`. + +### OpenAPI/Swagger + +API documentation is available at: ```sh open http://localhost:8787/swagger ``` -## Development Tool Commands +### Code Quality Checks -### Check +#### Static Code Analysis -static code check about syntax, format, import +Check syntax, format, and import order. ```sh -# not fixed -bun check +# Check only +bun run check -# force fix -bun check:fix +# Auto-fix +bun run check:fix ``` -### Test +#### Type Checking ```sh -# run test -bun run test # not `bun test` +bun run typecheck +``` + +### Coding Guidelines -# run test (watch mode) -bun run test:watch +See [Implementation Guide](./docs/guides.md) for detailed implementation guidelines. + +## Testing + +### Run Tests + +```sh +# Run all tests +bun run test + +# Watch mode +bun run test:w ``` -### Type Check +### Testing Strategy + +- **Unit Test**: Test Use Cases and Repositories +- **Integration Test**: Test Plugins and Routes + +Tests use Vitest and Cloudflare Workers Simulator. + +See [Implementation Guide - Testing Strategy](./docs/guides.md#ใƒ†ใ‚นใƒˆๆˆฆ็•ฅ) for details. + +## Database + +### Migrations ```sh -bun type-check +# Generate migration files +bun run db:gen + +# Apply migrations (local) +bun run db:mig ``` -### Database +### Drizzle Studio + +GUI tool for database management. ```sh -# generate migration files -db:gen +# Open local DB +bun run db:std -# migration -db:mig +# Open remote DB (production) +bun run db:std:remote +``` -# start Drizzle studio(local) -db:std +Opens `https://local.drizzle.studio` in your browser. -# start Drizzle studio(remote) -db:std:remote +## Deployment + +### Build + +```sh +# Build (dry-run) +bun run build ``` -### Other +### Deploy -See `scripts` field in [`package.json`](https://github.com/koutyuke/mona-ca/blob/main/apps/api/package.json) +```sh +# Deploy to Cloudflare Workers +wrangler deploy + +# Deploy to production +wrangler deploy --env production +``` diff --git a/apps/api/docs/architecture.md b/apps/api/docs/architecture.md index f5074c7c..8b3cf5a9 100644 --- a/apps/api/docs/architecture.md +++ b/apps/api/docs/architecture.md @@ -32,7 +32,7 @@ mona-ca Backend APIใฏใ€Clean Architectureใ‚’ใƒ™ใƒผใ‚นใจใ—ใŸๅคšๅฑคใ‚ขใƒผใ‚ญ ## ๆŠ€่ก“ใ‚นใ‚ฟใƒƒใ‚ฏ | ใ‚ซใƒ†ใ‚ดใƒช | ๆŠ€่ก“ | ็”จ้€” | -|---------|------|------| +| --- | --- | --- | | Runtime | Bun | JavaScript/TypeScriptใƒฉใƒณใ‚ฟใ‚คใƒ  | | Platform | Cloudflare Workers | ใ‚จใƒƒใ‚ธใ‚ณใƒณใƒ”ใƒฅใƒผใƒ†ใ‚ฃใƒณใ‚ฐ็’ฐๅขƒ | | Framework | ElysiaJS | Web API Framework | @@ -62,7 +62,7 @@ mona-ca Backend APIใฏใ€Clean Architectureใ‚’ใƒ™ใƒผใ‚นใจใ—ใŸๅคšๅฑคใ‚ขใƒผใ‚ญ โ”‚ Gateways) โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Application Layer โ”‚ features/*/application/ -โ”‚ (Use Cases, Contracts, Ports) โ”‚ +โ”‚ (Use Cases, Ports) โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Domain Layer โ”‚ features/*/domain/ โ”‚ (Entities, Value Objects) โ”‚ @@ -122,12 +122,12 @@ mona-ca Backend APIใฏใ€Clean Architectureใ‚’ใƒ™ใƒผใ‚นใจใ—ใŸๅคšๅฑคใ‚ขใƒผใ‚ญ - ใ‚จใƒฉใƒผใƒใƒณใƒ‰ใƒชใƒณใ‚ฐ - Resultๅž‹๏ผˆ`ok()`, `err()`๏ผ‰ใงใฎ็ตๆžœ่ฟ”ๅด -**Contracts** (`contracts/`): +**Inbound Ports** (`ports/in/`): - UseCaseใฎInterfaceๅฎš็พฉ - ๅ…ฅๅŠ›/ๅ‡บๅŠ›ๅž‹ใฎๅฎš็พฉ -**Ports** (`ports/`): +**Outbound Ports** (`ports/out/`): - Repository Interfaceใฎๅฎš็พฉ - Gateway Interfaceใฎๅฎš็พฉ @@ -166,19 +166,11 @@ apps/api/ โ”‚ โ”œโ”€โ”€ core/ # ๅ…ฑ้€šใ‚คใƒณใƒ•ใƒฉใƒปใƒฉใ‚คใƒ–ใƒฉใƒช โ”‚ โ”‚ โ”œโ”€โ”€ adapters/ # ๅ…ฑ้€šใ‚ฒใƒผใƒˆใ‚ฆใ‚งใ‚คๅฎŸ่ฃ… โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ gateways/ -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ email/ -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ turnstile/ โ”‚ โ”‚ โ”œโ”€โ”€ di/ # ใ‚ณใ‚ขDIใ‚ณใƒณใƒ†ใƒŠ -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ container.ts โ”‚ โ”‚ โ”œโ”€โ”€ domain/ # ๅ…ฑ้€šใƒ‰ใƒกใ‚คใƒณใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ value-objects/ -โ”‚ โ”‚ โ”œโ”€โ”€ infra/ # ใ‚คใƒณใƒ•ใƒฉๅฎŸ่ฃ… -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ config/ # ็’ฐๅขƒๅค‰ๆ•ฐ็ฎก็† -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ crypto/ # ๆš—ๅทๅŒ–้–ข้€ฃ -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ drizzle/ # DBใƒปใ‚นใ‚ญใƒผใƒžๅฎš็พฉ -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ elysia/ # Elysiaๆ‹กๅผต +โ”‚ โ”‚ โ”œโ”€โ”€ infra/ # ๅ…ฑ้€šใ‚คใƒณใƒ•ใƒฉๅฎŸ่ฃ… โ”‚ โ”‚ โ”œโ”€โ”€ lib/ # ๅ…ฑ้€šใƒฉใ‚คใƒ–ใƒฉใƒช -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ... โ”‚ โ”‚ โ”œโ”€โ”€ ports/ # ๅ…ฑ้€šใƒใƒผใƒˆ๏ผˆใ‚คใƒณใ‚ฟใƒผใƒ•ใ‚งใƒผใ‚น๏ผ‰ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ gateways/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ system/ @@ -193,13 +185,12 @@ apps/api/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ presenters/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ repositories/ โ”‚ โ”‚ โ”œโ”€โ”€ application/ # ใ‚ขใƒ—ใƒชใ‚ฑใƒผใ‚ทใƒงใƒณๅฑค -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ contracts/ # UseCaseใ‚คใƒณใ‚ฟใƒผใƒ•ใ‚งใƒผใ‚น โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ infra/ # Featureๅ›บๆœ‰ใฎใ‚คใƒณใƒ•ใƒฉ -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ ports/ # Repository/Gatewayใ‚คใƒณใ‚ฟใƒผใƒ•ใ‚งใƒผใ‚น +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ ports/ +โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ in/ # UseCase Interface +โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ out/ # Repository/Gateway Interface โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ use-cases/ # UseCaseใฎๅฎŸ่ฃ… โ”‚ โ”‚ โ”œโ”€โ”€ di/ # Featureๅ›บๆœ‰ใฎDIใ‚ณใƒณใƒ†ใƒŠ -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ container.interface.ts -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ container.ts โ”‚ โ”‚ โ”œโ”€โ”€ domain/ # ใƒ‰ใƒกใ‚คใƒณๅฑค โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ entities/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ value-objects/ @@ -211,12 +202,6 @@ apps/api/ โ”‚ โ”‚ โ””โ”€โ”€ index.ts # Featureๅ…ฌ้–‹API โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ plugins/ # Elysiaใƒ—ใƒฉใ‚ฐใ‚คใƒณ -โ”‚ โ”‚ โ”œโ”€โ”€ auth/ # ่ช่จผใƒ—ใƒฉใ‚ฐใ‚คใƒณ -โ”‚ โ”‚ โ”œโ”€โ”€ captcha/ # CAPTCHAๆคœ่จผ -โ”‚ โ”‚ โ”œโ”€โ”€ container/ # DI Plugin -โ”‚ โ”‚ โ”œโ”€โ”€ openapi/ # OpenAPI/Swagger -โ”‚ โ”‚ โ”œโ”€โ”€ ratelimit/ # ใƒฌใƒผใƒˆๅˆถ้™ใƒ—ใƒฉใ‚ฐใ‚คใƒณ -โ”‚ โ”‚ โ””โ”€โ”€ client-type/ # ใ‚ฏใƒฉใ‚คใ‚ขใƒณใƒˆใ‚ฟใ‚คใƒ—ใƒ—ใƒฉใ‚ฐใ‚คใƒณ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ routes/ # ใƒซใƒผใƒˆๅฎš็พฉ โ”‚ โ”‚ โ”œโ”€โ”€ [Slug]/ # ๅ„ใ‚นใƒฉใ‚คใ‚น @@ -253,14 +238,10 @@ features/[feature-name]/ โ”‚ โ”œโ”€โ”€ find-by-id.test.ts โ”‚ โ””โ”€โ”€ ... โ”œโ”€โ”€ application/ -โ”‚ โ”œโ”€โ”€ contracts/ # UseCaseใฎInterfaceๅฎš็พฉ -โ”‚ โ”‚ โ””โ”€โ”€ [domain]/ -โ”‚ โ”‚ โ””โ”€โ”€ [action].usecase.interface.ts โ”‚ โ”œโ”€โ”€ infra/ # Featureๅ›บๆœ‰ใฎใ‚คใƒณใƒ•ใƒฉๅฎŸ่ฃ… -โ”‚ โ”œโ”€โ”€ ports/ # Repository/GatewayใฎInterface -โ”‚ โ”‚ โ”œโ”€โ”€ gateways/ -โ”‚ โ”‚ โ”œโ”€โ”€ repositories/ -โ”‚ โ”‚ โ””โ”€โ”€ infra/ +โ”‚ โ”œโ”€โ”€ ports/ # PortsใฎInterface +โ”‚ โ”‚ โ”œโ”€โ”€ in/ # UseCase Interface +โ”‚ โ”‚ โ””โ”€โ”€ out/ # Repository/Gateway Interface โ”‚ โ””โ”€โ”€ use-cases/ # UseCaseใฎๅฎŸ่ฃ… โ”‚ โ””โ”€โ”€ [domain]/ โ”‚ โ”œโ”€โ”€ [action].usecase.ts @@ -328,8 +309,6 @@ plugins core/infra core/lib 1. UseCaseๅ†…ใงใ‚จใƒฉใƒผ็™บ็”Ÿ โ†“ Resultๅž‹ใง`err()`ใ‚’่ฟ”ใ™ 2. RouteๅฑคใงResultๅž‹ใ‚’ๅˆคๅฎš - โ†“ ใ‚จใƒฉใƒผๆ™‚ใฏไพ‹ๅค–ใ‚’throw -3. Error Plugin - โ†“ ้ฉๅˆ‡ใชHTTPใ‚นใƒ†ใƒผใ‚ฟใ‚นใจใƒกใƒƒใ‚ปใƒผใ‚ธใ‚’่ฟ”ใ™ -4. Error Response + โ†“ ใ‚จใƒฉใƒผๆ™‚ใฏ`error(code, context)`ใ‚’่ฟ”ใ™ +3. Error Responseใ‚’่ฟ”ใ™ ``` From df12004582fa24853ae7a68929695e5e7e972bbc Mon Sep 17 00:00:00 2001 From: koutyuke Date: Thu, 1 Jan 2026 17:46:51 +0900 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=93=9D=20docs(README):=20remove=20loc?= =?UTF-8?q?al=20CI=20setup=20instructions=20and=20note=20about=20VSCode=20?= =?UTF-8?q?extension=20limitations=20for=20clarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/README.md b/README.md index 46002270..3f67d1d2 100644 --- a/README.md +++ b/README.md @@ -116,18 +116,3 @@ bun run test # Other # See `scripts` field in `package.json` ``` - -## CI in the local environment - -Perform CI performed by Github Action in a local environment - -Install [`act`](https://github.com/nektos/act) and Start `Docker` - -```sh -act --container-architecture linux/amd64 --secret-file ./.github/act/.secrets --env-file ./.github/act/.env --defaultbranch main -W "target-flow" -``` - -## Note - -> [!NOTE] -> Since Biome's VSCode extension does not support workspaces, all settings are rolled up and configured in root's `biome.json`. From 7d02352285ca0e4d1e188bdb574e35012d319de1 Mon Sep 17 00:00:00 2001 From: koutyuke Date: Thu, 1 Jan 2026 17:47:03 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=93=9D=20docs(README):=20add=20compre?= =?UTF-8?q?hensive=20documentation=20for=20mona-ca=20Component=20Catalog,?= =?UTF-8?q?=20including=20setup,=20development,=20and=20building=20instruc?= =?UTF-8?q?tions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/catalog/README.md | 118 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 117 insertions(+), 1 deletion(-) diff --git a/apps/catalog/README.md b/apps/catalog/README.md index 784f0b84..688606df 100644 --- a/apps/catalog/README.md +++ b/apps/catalog/README.md @@ -1 +1,117 @@ -# `catalog` \ No newline at end of file +# mona-ca Component Catalog + +Component catalog and design system for mona-ca using Storybook. + +## ๐Ÿ“– Table of Contents + +- [Overview](#overview) +- [Tech Stack](#tech-stack) +- [Setup](#setup) +- [Development](#development) +- [Building](#building) + +## Overview + +mona-ca Component Catalog is a Storybook-based UI component library showcase. +This catalog provides interactive documentation and testing environment for all UI components used in mona-ca applications. + +It supports both web and mobile (React Native) environments, allowing developers to browse and test components in isolation. + +## Tech Stack + +It is made by these: + +__Storybook__ ๐Ÿ“š: Frontend workshop for UI development + +__Expo__ ๐Ÿ“ฑ: The fastest way to build an app + +__React Native__ โš›๏ธ: Framework for building native apps + +__NativeWind__ ๐ŸŽจ: Tailwind CSS for React Native + +__React Native Web__ ๐ŸŒ: React Native for Web + +## Setup + +### Installation + +```sh +# Install dependencies +bun install +``` + +### Prebuild + +Generate native projects for iOS and Android. + +```sh +bun run prebuild +``` + +## Development + +### Start Storybook (Web) + +Start Storybook server for web browsers. + +```sh +bun run sb +``` + +The Storybook UI will be available at `http://localhost:6006`. + +### Start Storybook (Mobile) + +Start Expo development server with Storybook enabled. + +```sh +# Start with development build +bun run sb:mobile + +# Start iOS +bun run sb:ios +``` + +### Generate Storybook Stories + +Generate story list for React Native Storybook. + +```sh +bun run sb:gen +``` + +### Code Quality Checks + +#### Static Code Analysis + +Check syntax, format, and import order. + +```sh +# Check only +bun run check + +# Auto-fix +bun run check:fix +``` + +## Building + +### Build Storybook (Web) + +Build static Storybook site for deployment. + +```sh +bun run sb:build +``` + +The static site will be generated in `./.storybook/static`. + +### Build Native Apps + +```sh +# Build iOS +bun run ios + +# Build Android +bun run android +``` From 61a8019d89a37a3e1d51564e5c2a0cea65b407fc Mon Sep 17 00:00:00 2001 From: koutyuke Date: Thu, 1 Jan 2026 17:47:09 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=F0=9F=93=9D=20docs(README):=20add=20detail?= =?UTF-8?q?ed=20documentation=20for=20the=20mona-ca=20mobile=20application?= =?UTF-8?q?,=20covering=20overview,=20tech=20stack,=20architecture,=20setu?= =?UTF-8?q?p,=20development,=20and=20building=20instructions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mobile/README.md | 169 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 apps/mobile/README.md diff --git a/apps/mobile/README.md b/apps/mobile/README.md new file mode 100644 index 00000000..631716fc --- /dev/null +++ b/apps/mobile/README.md @@ -0,0 +1,169 @@ +# mona-ca Mobile Application + +Mobile application for mona-ca. + +## ๐Ÿ“– Table of Contents + +- [Overview](#overview) +- [Tech Stack](#tech-stack) +- [Architecture](#architecture) +- [Setup](#setup) +- [Development](#development) +- [Building](#building) + +## Overview + +mona-ca Mobile Application is a cross-platform mobile app built with React Native and Expo. +This app allows users to manage their menstrual cycles and share information with their partners. + +## Tech Stack + +It is made by these: + +__Expo__ ๐Ÿ“ฑ: The fastest way to build an app + +__React Native__ โš›๏ธ: Framework for building native apps + +__NativeWind__ ๐ŸŽจ: Tailwind CSS for React Native + +__Jotai__ โš›๏ธ: Primitive and flexible state management + +__TanStack Query__ ๐Ÿ”„: Powerful data synchronization + +__React Hook Form__ ๐Ÿ“: Performant forms with validation + +__Valibot__ โœ…: Schema validation + +## Architecture + +Built on **Feature-Sliced Design (FSD)** with Presenter/Container Pattern. + +### Architecture Principles + +- **Feature-Sliced Design**: Structure code by business domains and technical purpose +- **Presenter/Container Pattern**: Separate UI logic from business logic +- **Composition Pattern**: Inject handlers and components into Presenter +- **SOLID Principles**: Design principles for maintainability and extensibility +- **Dependency Injection**: Improve testability + +### Layer Structure + +```text +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ App Layer โ”‚ app/ +โ”‚ (Expo Router) โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค +โ”‚ Layers โ”‚ +โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ +โ”‚ โ”‚ Pages (Routes) โ”‚ โ”‚ layers/pages/ +โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ +โ”‚ โ”‚ Widgets (Complex UI) โ”‚ โ”‚ layers/widgets/ +โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ +โ”‚ โ”‚ Features (Business Logic) โ”‚ โ”‚ layers/features/ +โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ +โ”‚ โ”‚ Entities (Business Models) โ”‚ โ”‚ layers/entities/ +โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ +โ”‚ โ”‚ Shared (Common Code) โ”‚ โ”‚ layers/shared/ +โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +``` + +See [Architecture Documentation](./docs/architecture.md) for details. + +### Directory Structure + +```text +apps/mobile/ +โ”œโ”€โ”€ src/ +โ”‚ โ”œโ”€โ”€ app/ # Expo Router routes +โ”‚ โ””โ”€โ”€ layers/ # FSD layers +โ”‚ โ”œโ”€โ”€ pages/ # Page components +โ”‚ โ”œโ”€โ”€ widgets/ # Complex UI components +โ”‚ โ”œโ”€โ”€ features/ # Business logic features +โ”‚ โ”œโ”€โ”€ entities/ # Business entities +โ”‚ โ””โ”€โ”€ shared/ # Shared utilities +โ”œโ”€โ”€ assets/ # Static assets +โ”œโ”€โ”€ docs/ # Documentation +โ”œโ”€โ”€ types/ # Type definitions +โ”œโ”€โ”€ ios/ # iOS native code +โ”œโ”€โ”€ android/ # Android native code +โ”œโ”€โ”€ package.json +โ”œโ”€โ”€ tsconfig.json +โ”œโ”€โ”€ app.json # Expo configuration +โ”œโ”€โ”€ babel.config.js +โ””โ”€โ”€ metro.config.js +``` + +## Setup + +### Installation + +```sh +# Install dependencies +bun install +``` + +### Environment Variables + +Create environment variables as needed. + +### Prebuild + +Generate native projects for iOS and Android. + +```sh +bun run prebuild +``` + +## Development + +### Start Development Server + +```sh +# Start with development build +bun run dev + +# Start iOS +bun run dev:ios + +# Start Android +bun run dev:android +``` + +### Code Quality Checks + +#### Static Code Analysis + +Check syntax, format, and import order. + +```sh +# Check only +bun run check + +# Auto-fix +bun run check:fix +``` + +#### Type Checking + +```sh +bun run typecheck +``` + +### Coding Guidelines + +See [Implementation Guide](./docs/guides.md) for detailed implementation guidelines. + +## Building + +### Build for iOS + +```sh +bun run ios +``` + +### Build for Android + +```sh +bun run android +``` From b9f329101507b7661fb48f5b869fa1060911df1e Mon Sep 17 00:00:00 2001 From: koutyuke Date: Thu, 1 Jan 2026 17:49:55 +0900 Subject: [PATCH 6/7] =?UTF-8?q?=F0=9F=93=9D=20docs(create-pr):=20update=20?= =?UTF-8?q?PR=20creation=20guidelines=20to=20specify=20English=20titles=20?= =?UTF-8?q?and=20Japanese=20descriptions,=20and=20clarify=20issue=20confir?= =?UTF-8?q?mation=20process?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cursor/commands/create-pr.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.cursor/commands/create-pr.md b/.cursor/commands/create-pr.md index 2ff323fb..2c2c7c91 100644 --- a/.cursor/commands/create-pr.md +++ b/.cursor/commands/create-pr.md @@ -21,8 +21,8 @@ ## ใƒซใƒผใƒซ -- ๆ—ฅๆœฌ่ชžใงใฎๅ›ž็ญ”ใƒปไฝœๆˆใ‚’ๅŸบๆœฌใจใ™ใ‚‹ -- ๆ–‡ไฝ“ใฏๅธธไฝ“ใงๅ›ž็ญ”ใƒปไฝœๆˆใ™ใ‚‹ใ“ใจ +- ใ‚ฟใ‚คใƒˆใƒซใฏ่‹ฑ่ชžใงไฝœๆˆใ—ใ€descriptionใฏๆ—ฅๆœฌ่ชžใงใฎๅ›ž็ญ”ใƒปไฝœๆˆใ‚’ๅŸบๆœฌใจใ™ใ‚‹ +- ๆ–‡ไฝ“ใฏๅธธไฝ“ใงไฝœๆˆใ™ใ‚‹ใ“ใจ ## ๆ‰‹้ † @@ -37,7 +37,7 @@ - ใ“ใฎIssueใŒไฝ•ใ‚’ใ™ใ‚‹ใ‚‚ใฎใงใฉใฎใ‚ˆใ†ใชๅค‰ๆ›ดใ‚’่กŒใ†ใ‚‚ใฎใ‹ใ‚’็ขบ่ชใ™ใ‚‹ - ใ“ใฎIssueใฎใƒฉใƒ™ใƒซใ‚’็ขบ่ชใ™ใ‚‹ - `gh issue` ใ‚ณใƒžใƒณใƒ‰ใ‚’ไฝฟ็”จใ—ใฆIssueใ‚’็ขบ่ชใ™ใ‚‹ใ“ใจ - - ๅฏพ่ฑกใฎIssueใŒใชใ„ๅ ดๅˆใฏใƒฆใƒผใ‚ถใƒผใซ็ขบ่ชใ™ใ‚‹ + - ๅฏพ่ฑกใฎIssueใŒใชใ„ๅ ดๅˆใ‚„Issueใฎๅ†…ๅฎนใจbranchๅใŒใŠใŠใ‚ˆใไธ€่‡ดใ—ใชใ„ๅ ดๅˆใฏใƒฆใƒผใ‚ถใƒผใซ็ขบ่ชใ™ใ‚‹ 3. **ๅค‰ๆ›ด็‚นใ‚’็ขบ่ชใ™ใ‚‹** @@ -55,6 +55,7 @@ - PRใฎใ‚ฟใ‚คใƒˆใƒซใฏIssueใฎใ‚ฟใ‚คใƒˆใƒซใ‚„ๅ†…ๅฎนใ€Branchใงใฎๅค‰ๆ›ด็‚นใ‚’ใ‚’่ฉณใ—ใใ‹ใคๅ†…ๅฎนใ‚’็ฐกๆฝ”ใซๅๆ˜ ใ—ใŸใ‚‚ใฎใซใ™ใ‚‹ใ€‚ - Titleใฎๅฝขๅผใฏ `(): ` ใงใ‚ใ‚Šใ€ใ“ใฎๅฝขๅผใงไฝœๆˆใ™ใ‚‹ใ“ใจใ€‚ + - ่‹ฑ่ชžใงไฝœๆˆใ™ใ‚‹ใ“ใจ 6. **Descriptionใ‚’ไฝœๆˆใ™ใ‚‹** - ใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆใฏ`.github/pull_request_template.md`ใ‚’ๅˆฉ็”จใ™ใ‚‹ใ“ใจ From 577165f6c6cba77ee311f57b05a2efc853392ba3 Mon Sep 17 00:00:00 2001 From: koutyuke Date: Thu, 1 Jan 2026 19:31:03 +0900 Subject: [PATCH 7/7] =?UTF-8?q?=F0=9F=93=9D=20docs(act):=20update=20README?= =?UTF-8?q?=20to=20clarify=20local=20CI=20setup=20instructions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/act/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/act/README.md b/.github/act/README.md index a7d4371a..f0672d01 100644 --- a/.github/act/README.md +++ b/.github/act/README.md @@ -1,6 +1,6 @@ # Act Debug -Perform CI performed by Github Action in a local environment +Run CI performed by Github Action in a local environment Install [`act`](https://github.com/nektos/act) and Start `Docker` for local environment.