How yukaii/zuzugo works
Based on our analysis of the file tree and README, this project is a full-stack web application whose main purpose is to scrape the latest rental listings from 591 and to send notifications via chatbots (specifically for Line and Slack). The application uses Next.js for both its frontend and backend, incorporates Prisma for database interactions, and organizes its business logic and integrations within a well-structured lib folder. Additionally, there are task files (e.g., for fetching new houses), notification handlers for multiple channels, and even CI/CD configuration in GitHub Actions.
Main Components & Their Locations
• Frontend (UI Layer):
• The “app” and “pages” directories hold Next.js components and pages including layout, styling (globals.css, page.module.css), and routing (pages/_app.tsx).
• These parts display the user interface and serve the authentication pages (e.g., pages/auth/signin.tsx).
• Backend/API Layer:
• The “pages/api” directory defines various API endpoints including authentication (nextauth), webhook/event handlers for Slack and Line, and an endpoint for “inngest” (job orchestration).
• These endpoints expose RESTful interfaces for internal business logic and external integrations.
• Business Logic & Core Services:
• The “lib” directory contains core modules such as:
o House scraping and repository logic (e.g., lib/591House, lib/repositories/591House.ts)
o Notification services for multiple channels (console, Line, Slack – see lib/notification)
o Task scheduling and execution (lib/tasks) for periodic scraping or updates
o Integration with Inngest (lib/inngest) for event-driven tasks
o Utility functions, type definitions, and schema validations (lib/zod, lib/types.ts)
• Database:
• The “prisma” directory manages migrations, schema, and database scripts indicating use of PostgreSQL.
• Prisma is leveraged to interact with the database (see lib/prisma.ts).
• External Integration Modules:
• Slack App-related functionalities are in lib/slackApp (including command handling and installation flows).
• The README provides instructions for setting up the Slack App with proper OAuth redirects, which is reflected by API routes under pages/api/slack.
• Infrastructure & DevOps:
• CI/CD workflows are present via GitHub Actions in the .github directory.
• Configuration files (.env.example, next.config.js, tailwind.config.js, etc.) are used for environment settings and project styling.
• Testing utilities are in the tests and lib/__tests__ directories ensuring a solid test suite for components and business logic.
Relationships and Interactions
• The Frontend interacts with the Backend through Next.js API routes. For example, API endpoints under pages/api handle authentication, incoming webhook events, and integration setup steps.
• The API layer calls business logic functions within the lib directory. The “tasks” and “repositories” modules facilitate data scraping and processing.
• The Notification services get triggered based on events (like new rental listings) and then interact with external services such as Slack and Line.
• The database (accessed via Prisma) is the persistent store for all application data including users, notifications, rental listings, and Slack installation details.
• Inngest is used to manage asynchronous and background tasks, integrating deeply with the API logic and notifications.
Architectural Patterns & Design Principles
• Clear Separation of Concerns: UI, API, business logic, and infrastructure (database/external services) are modularly organized.
• MVC-like structure: Although it is a Next.js application, the separation is evident as pages (controllers/views) coordinate with lib (models/business logic).
• Event-Driven & Task Scheduling: Use of Inngest for managing tasks and notifications.
• Extensibility: The project’s design (especially the notification and repository modules) allows for easy extension, such as adding new notification channels.
Technologies, Frameworks, and Libraries
• Next.js: For SSR and frontend/backend integration.
• Prisma: ORM for database operations.
• Tailwind CSS, global CSS: For styling the frontend.
• Inngest: For event-driven tasks.
• Slack and Line APIs: For chatbot integration and notifications.
• Testing Libraries & Jest configurations for quality assurance.
Additional Detail Suggestions
• “pages/api” endpoints for Slack and Line since they reflect the integration aspect.
• Testing modules to show how the applications are verified.
• Use of modern DevOps practices (CI/CD workflows) as they are crucial to this project.