How melonps/puchiyakusoku works
Project Type and Purpose
• This is a full‐stack application designed as a “promise sharing” app that operates entirely within LINE. Users can share promises, and there is no login or installation required.
• The README emphasizes that the app works on LINE, while the file structure shows a modern JavaScript stack (Next.js) for the frontend and several backend components, including API endpoints, GraphQL operations, and additional microservices (in both TypeScript and Python).
Main Components and Their Locations
• Frontend UI (Next.js App):
– Located in the src/app directory with subfolders for pages, layout, and UI components (e.g., “Badge.tsx”, “Header.tsx”, “ImageWrapper.tsx”).
– Related elements include themes, providers (LiffProvider for LINE integration), hooks, and contexts.
• API Endpoints & GraphQL:
– Found under src/app/api (including authentication endpoints under nextauth and GraphQL queries/mutations in src/app/graphql and src/graphql).
– The generated schemas (in src/generated) indicate a GraphQL-based communication with the backend.
• Database and ORM:
– The prisma folder (including schema.prisma and migration scripts) shows usage of Prisma as the ORM to interact with the database.
– There’s also a seed file and multiple migrations indicating a structured database evolution.
• Additional Microservices:
• Reminder/Python Services:
– The reminder folder contains subprojects (define-task and remind) implemented in Python with their own .gitignore, .gcloudignore, and dependencies (requirements.txt, pyproject.toml). They handle task definitions and reminder functionality (likely scheduled or event-driven tasks).
• Supabase Functions:
– The supabase/functions folder holds deno-based functions named sendLineMessage and sendMessage. These functions appear to be used for sending messages via LINE, likely triggered either by the application or some scheduled service.
• External Services:
• LINE Integration:
– Overarching theme from the README (“LINE上で完結”) and the use of LIFF providers suggests deep integration with LINE’s platform.
Relationships and Data Flow
• The Browser/LINE Client:
– Interacts with the frontend Next.js app (via pages and UI components) which is the main interface.
• Frontend to API Communication:
– The Next.js pages, through hooks and context, send requests to API routes (including NextAuth for authentication and GraphQL endpoints for data operations).
• API to Database:
– API endpoints leverage the Prisma layer (in src/lib/prisma and prisma schema) to read/write persistent data.
• Integration with External Messaging:
• Supabase functions (sendLineMessage/sendMessage) and embedded Python microservices handle interaction with LINE’s messaging APIs. They may get triggered by events or schedules (as hinted by the naming in the “reminder” folder and deno functions).
• Internal Communication:
– The GraphQL schema and generated types indicate internal data contracts, while the next-auth endpoints mediate user session management.
Architectural Patterns and Design Principles
• Full-Stack Separation:
– Clear delineation between frontend (Next.js), backend APIs (Next.js API routes and GraphQL), and auxiliary services (Python reminder services, Supabase functions).
• Microservice and Modular Design:
– The reminder functionality is separated into a distinct Python module, indicating a microservice approach for scheduling/reminder tasks.
– Supabase functions for messaging suggest serverless or function-based components that operate independently yet trigger core application workflows.
• Use of Standard Frameworks and Best Practices:
– Next.js for server-side rendering and routing.
– Prisma as a clear ORM layer that abstracts the database.
– NextAuth for authentication.
– GraphQL for structured API communication.