How takayukitooyama/runaly-front works
Main components
• Frontend (Next.js App): The core “app” folder under src/app holds the page-based routing. There are several routes such as (home), analyze, sign-in, and sign-up. Each route contains dedicated components – for instance, the home route includes calibration, cropping, and video upload components; the analyze route has canvas and player components.
• UI Components Library: Under src/ui, components like Button, Chart, Input, Menu, and layout elements are implemented to ensure a consistent design across the application.
• State Management: The src/lib/store directory suggests the use of custom hooks (for calibration, keypoints, video handling, etc.) to manage application-level state, a key architectural aspect.
• Database Layer: The prisma directory with the schema.prisma file indicates the project uses Prisma as an ORM to interface with the database.
• Configuration & Middleware: Next.js configuration (next.config.js), middleware.ts for server-side logic, and other configuration files (tailwind.config.cjs, tsconfig.json) are essential to describe the operational environment.
Relationships and interactions
• The Next.js file-based routing (via the “app” directory) directs how different URL endpoints or page components are served.
• Each page component (for example, home and analyze) is composed of smaller UI components (found under src/ui) and specialized canvas components (found in subdirectories like _canvas) that handle specific functionalities such as image annotation or drawing.
• Custom hooks and state management logic (in src/lib/store) are used by these components to share data (e.g., calibration settings or video data) and respond to user interactions.
• The Prisma schema represents the database layer, which interacts with the backend API endpoints (or server functions possibly within middleware.ts) for persistent data operations.
• Styling and performance features integrate via Tailwind CSS (using tailwind.config.cjs) and Next.js’s built‑in optimization (like next/font for Google Fonts).
Architectural patterns and design principles
• Component-Based UI: Each UI element is designed as an independent, reusable React component.
• File-based Routing: The Next.js app structure automatically maps directories and files to routes.
• Separation of Concerns: The division between pages (views), UI components, state management hooks, and database operations reflects good separation.
• Hook-Driven State Management: Custom hooks manage side effects and shared state across components.
• ORM for Data Persistence: Prisma encapsulates database interactions to maintain a clear separation between the business logic and the persistence layer.
Detailing
• Every element (especially the canvas-related components and custom hooks) is represented so that the intricate functionalities (e.g., annotation in the analyze and home routes) do not get overlooked.