How team-mirai-volunteer/marumie works
Project type and purpose
• This is a full-stack, monorepo Next.js application comprising two separate Next.js apps:
• webapp/ for general public consumption (dashboards, charts, data views)
• admin/ for internal administrators to upload CSVs, manage users, organizations, transactions, snapshots
• Both apps share domain models and utilities in shared/
• It uses Prisma ORM backed by a PostgreSQL database via Supabase, and follows a BFF-style layering inside each Next.js app (App Router + server components + client components)
High-level components
• Browser clients
• Public webapp (port 3000)
• Admin UI (port 3001)
• Next.js servers
• webapp Next.js App Router
• admin Next.js App Router
• Shared library
• shared/models (TypeScript domain entities)
• shared/utils (common data mapping, converters)
• Backend services
• Supabase PostgreSQL database
• Prisma migrations and seed (prisma/)
• Supabase local dev emulator (supabase/)
• External systems
• Cloud accounting services (MFクラウド, freee)—data import via CSV
• Vercel (production host + automatic DB migration on build)
Relationships and data flows
• User’s browser → Next.js frontend (SSR/page requests, client-side hydration)
• Next.js server components / API routes → server “usecase” layer → repository interfaces → Prisma client → PostgreSQL DB
• CSV upload in admin UI → server action → parser/validator (server/lib) → usecase → repository → DB
• Public webapp fetches data via Next.js loaders and API routes (transactions, balance‐sheet, sankey data, CSV download)
• Both apps share type definitions to guarantee consistent contracts
Architectural patterns and principles
• Monorepo: Two apps + shared code + infra in one workspace
• Clean architecture / layered BFF:
• app/pages/routes (controllers)
• server/usecases (business logic)
• server/repositories (abstraction interfaces)
• server/lib/prisma (data access implementation)
• Next.js App Router: hybrid SSR + client components
• Domain-driven design: explicit models (balance-snapshot, transaction, organization)
• Infrastructure as code: Prisma migrations, Supabase config
Essential elements
• Component names (e.g., webapp Next.js, admin Next.js, shared models)
• Notes about key technologies: Next.js 15, React 19, TypeScript, Prisma ORM, Supabase, Tailwind CSS, Jest tests, pnpm