This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Setup and basic development
make run-db # Start database containers (MySQL + MinIO)
make build # Build application containers
make run # Start application containers
make run-all # Start everything (DB + App + Swagger)
# Alternative direct Docker commands
docker compose -f compose.db.yml up -d
docker compose build
docker compose upmake gen # Generate both API and frontend code from OpenAPI spec
make gen-api # Generate Go server code from OpenAPI
make gen-front-api # Generate TypeScript hooks from OpenAPImake run-test # Run Go API tests
make run-eslint # Run frontend linting
make format # Format frontend code with Prettiermake run-sb # Run Storybook for component development
make ent-db # Enter MySQL database shell
make run-swagger # Start Swagger UI documentationFinanSu is a financial management system built with:
- Backend: Go + Echo framework + GORM + MySQL
- Frontend: Next.js 14 + TypeScript + Chakra UI + Recoil
- Storage: MinIO (S3-compatible)
- Code Generation: OpenAPI-driven development (oapi-codegen)
- Dependency Injection: google/wire for automatic dependency resolution
/api/ # Go backend (Clean Architecture)
├── main.go # Entry point (calls di.InitializeServer())
├── drivers/ # Infrastructure (DB, MinIO, server)
├── externals/ # Handlers & repositories
│ ├── handler/ # HTTP handlers (implements OpenAPI-generated interface)
│ │ └── wire.go # Handler provider set
│ └── repository/
│ └── wire.go # Repository provider set
├── internals/ # Domain & use cases
│ ├── di/ # Dependency injection configuration
│ │ ├── wire.go # Wire injector definition
│ │ └── wire_gen.go # Auto-generated by wire
│ ├── domain/ # Business entities
│ └── usecase/
│ └── wire.go # UseCase provider set
└── generated/ # Auto-generated OpenAPI code
└── openapi_gen.go # Server interface, types, routing
/view/next-project/ # Next.js frontend
├── src/components/ # React components by feature
├── src/pages/ # Next.js file-based routing
├── src/generated/ # Auto-generated API hooks
└── src/store/ # Recoil state management
/openapi/ # OpenAPI specification (source of truth)
/mysql/db/ # Database schema and migrations
- Edit
/openapi/openapi.yamlfor API changes - Run
make gento regenerate Go server code and TypeScript hooks- Generates
api/generated/openapi_gen.gowith:- Server interface that handlers must implement
- Request/response types
RegisterHandlers()function for automatic routing
- Generates TypeScript hooks in
view/next-project/src/generated/
- Generates
- Implement server-side logic in handlers and use cases
- Handlers implement the OpenAPI-generated interface
- Wire automatically injects dependencies
- Use generated hooks in React components for type-safe API calls
- Handlers: Handle HTTP requests/responses (
/api/externals/handler/)- Implements OpenAPI-generated server interface
- Dependencies injected via Wire
- Use Cases: Business logic (
/api/internals/usecase/)- Injected into handlers
- Repositories: Data access (
/api/externals/repository/)- Injected into use cases
- Domain: Business entities (
/api/internals/domain/)
- Wire automatically resolves all dependencies at compile time
- Each layer defines a
wire.gowith provider functions:handler/wire.go: HandlerProviderSetusecase/wire.go: UseCaseProviderSetrepository/wire.go: RepositoryProviderSet
di/wire.goorchestrates all providersmain.gocallsdi.InitializeServer()to get fully wired components- Benefits:
- Type-safe dependency injection at compile time
- No runtime reflection
- Easy to test with mock implementations
- Clear dependency graph
- Components organized by feature/domain
- Global state with Recoil + persistence
- SWR for data fetching with generated hooks
- Chakra UI + Tailwind CSS for styling
make ent-db # Access MySQL shell- MinIO handles file uploads (receipts, documents)
- Files referenced in database, stored in object storage
- PDF generation and CSV exports for reporting
make run-test # Run Go tests with database fixturesmake run-sb # Storybook for component development
make run-eslint # ESLint for code quality- Always run
make genafter modifying/openapi/openapi.yaml - Generated code should not be manually edited
- Type safety flows from OpenAPI spec to both backend and frontend
- Development:
compose.yml - Staging:
compose.stg.yml - Production:
compose.prod.yml - Database only:
compose.db.yml
- Primary docs in Notion workspace (linked in README.md)
- API documentation auto-generated from OpenAPI spec
- Git workflow and commit rules documented in Notion
When creating PRs, use the template in .github/pull_request_template.md:
- 対応Issue: Link related issue number with
resolve #XXX - 概要: Clear description of changes
- 画面スクリーンショット等: Screenshots if UI changes
- テスト項目: Test items for reviewers
- 備考: Additional notes
feat/username/feature-descriptionfor new featuresfix/username/bug-descriptionfor bug fixes- Follow patterns from recent commits
- Write descriptive commit messages in Japanese or English
- Reference issue numbers when applicable
- Use conventional commit format when possible
- Custom instructions configured with Japanese IT gal persona (
.github/copilot-instructions.md) - Responds in Japanese with friendly gal language and emojis
- Professional IT engineer with B-type personality
- Follow existing patterns and conventions
- Focus on type safety and clean architecture
- Always run
make genafter OpenAPI changes - When adding new handlers/use cases/repositories:
- Add provider functions to respective
wire.gofiles - Wire will automatically resolve dependencies
- No manual dependency wiring needed in
main.go
- Add provider functions to respective
- Run
make run-eslintandmake formatbefore committing frontend changes