How duyet/monorepo works
Project type and purpose
• This is a Turborepo-powered monorepo hosting five Next.js front-ends (“home”, “blog”, “insights”, “cv”, “photos”), plus shared code under packages/*.
• Each “app” is a Next.js project using React, TypeScript, Tailwind, and leverages Next’s file-based routing for pages and API routes (e.g., ping/route.ts, robots.txt/route.ts, rss.xml/route.ts).
• Shared code (UI components, business-logic utilities, TS interfaces, ESLint/Prettier/Tailwind configs) lives under packages/*.
• CI/CD is configured via GitHub Actions (lint/test, OAuth, deploy pipelines) and Husky hooks on commit.
High-level architecture
• Monorepo Root:
• turbo.json, package.json, top-level TS/Prettier/Eslint configs coordinate builds and workspace resolution.
• Husky (pre-commit, commit-msg) ensures code quality.
• GitHub Actions run workflows: lint/test (eslint.yml, test.yml), code-review bots, OAuth, and deployment.
• Apps:
• Each apps/<name> folder is a separate Next.js application that depends on shared packages (packages/components, packages/libs, packages/interfaces, etc.).
• They produce static and server-side-rendered pages, plus simple API endpoints under app/<...>/route.ts.
• Environment variables (.env.*) configure production vs. staging.
• Packages:
• components: shared React UI components and design tokens.
• libs: shared business-logic helpers (fetchers, markdown parser, URL utilities).
• interfaces: shared TS types (Cloudflare, GitHub, Post, etc.).
• Config packages (ESLint, Prettier, Tailwind, TSConfig) centralize styling and typing rules.
• External Services:
• Cloudflare APIs (for blog analytics, KV, Pages deployments), PostHog (blog analytics), ClickHouse (insights data), WakaTime (developer metrics), Unsplash (photos), etc.
• Deployment:
• Each app is built via turbo run build --filter=apps/<name>, then deployed to Cloudflare Pages (or GitHub Pages) as static or SSR.
• CDN edges serve global traffic.
Essential details to capture
• Monorepo structure and workspace resolution.
• Turborepo’s role in orchestrating parallel builds and caching.
• Shared packages injection into apps.
• Next.js runtime (pages + API routes).
• CI/CD flows from commit to production.
• External data and analytics dependencies.
• Multi-app deployments to Cloudflare Pages/CDN.