How maaaathis/digga works
Main components
• Client/Browser: Represents the end users who access the system.
• Frontend (Next.js Application): The “app” directory contains pages, layouts, and route handling with React components (e.g., lookup pages for domains, error pages, opengraph, etc).
• API Layer: The “app/api” directory encapsulates the backend endpoints, including:
– From endpoints (e.g., base64 conversion)
– Internal endpoints for resolving domain details (with subdirectories for regions such as arn, cdg, etc)
– IP lookup and whois endpoints.
• Business Logic & Libraries: The “lib” directory includes key modules, such as DNS resolvers (Cloudflare, Google, etc.), whois and other utility functions that implement the core domain research logic.
• Resolvers and External Service Integrations: Located in “lib/resolvers”, these modules integrate with external DNS and DoH providers, abstracting external communication with services like Cloudflare and Google.
• Shared Components and Hooks: The “components” and “hooks” folders provide UI and client-side logic (e.g., analytics, bookmarks, and search forms) that support the frontend.
• Configuration and Deployment Artifacts: Top-level configuration files (e.g., next.config.js, tsconfig.json, GitHub workflows) define build and deployment pipelines.
• Within the Frontend, indicate that certain pages (especially in the “lookup” sections) trigger API calls.
• The API Layer (in “app/api”) should be represented as a separate component that receives HTTP requests from the frontend.
• That the API endpoints call into the Business Logic & Libraries (from the “lib” directory) for processing domain data, performing DNS lookups, whois queries, etc.
• Middleware and any configuration components (like “middleware.ts”) as cross-cutting concerns that handle request processing, logging, or error handling.
Architectural patterns and design principles
• Next.js’s File-Based Routing: Highlight the convention-based routing (both for the UI and API endpoints) to show how the file structure maps to URL paths.
• Separation of Concerns: Differentiate between presentation (frontend UI), API/back-end endpoint logic, and business logic (domain resolution and lookups).
• Modularization: The use of independent modules (in “lib”, “components”, “hooks”) enables easier testing and potentially future extensibility.
Relevant technologies and libraries
• Next.js and React for the web application.
• TypeScript (as seen from “tsconfig.json” and “next-env.d.ts”) implying a typed codebase.
• ESLint and Prettier configuration files indicating enforced code quality.
• GitHub workflows, Dependabot, and other CI/CD integrations from the “.github” directory.
• External resolvers that integrate with DNS providers.