How fazers/portfolio works
Main Components
• Frontend Application – Located in the “apps/web” folder. This is the Next.js application that combines React components, Tailwind CSS styling, and pages/APIs. It also includes support for MDX, global error handling, and middleware.
• API & Business Logic – The “packages/api” folder contains tRPC router definitions that serve as the core API layer.
• Authentication Module – The “packages/auth” folder provides authentication logic using NextAuth.
• Database Layer – The “packages/db” folder implements typesafe database calls using Drizzle and Supabase, including schema definitions and client configuration.
• Transactional Services – The “packages/transactional” folder manages email, SMS, and similar services for notifications or contact forms.
• UI Components – The “packages/ui” folder houses a start of a UI package that leverages shadcn-ui principles for reusable UI elements and components.
• Shared Validators – The “packages/validators” folder contains common validation logic built with zod.
• Tooling & Configurations – Directories such as “.github”, “tooling”, and various configuration files (e.g., eslint, prettier, tailwind, typescript) define the project’s development, CI/CD, and code quality processes.
Relationships and Interactions
• The Frontend application interacts with the API endpoints (including the tRPC router) to perform typesafe data fetching and mutations.
• The API layer uses the Authentication and Database packages. For instance, authentication middleware in the frontend might call next-auth logic in the “packages/auth” and then secure endpoints in “packages/api”.
• The Database package is a shared service that the API calls into for data persistence. Along with that, transactions and notifications are handled via the “transactional” package.
• The UI package is a shared library that the frontend directly consumes, ensuring consistent styling and component behavior across the portfolio application.
• Validators are used across both frontend forms and backend data handling to ensure data integrity.
Architectural Patterns and Design Principles
• Modular Monorepo Structure: Separation of concerns is achieved by isolating each domain (API, auth, db, transactional, UI, validators) into its own package.
• Full-stack Integration: The Next.js app bridges server-side rendered UI with API routes, while sharing components and business logic via reusable packages.
• Typesafety and Code Reuse: Leveraging modern TypeScript practices (shared tsconfigs in tooling) and validators ensure robust interactions between components.
• CI/CD and Tooling Integration: Configuration folders (.github, tooling) indicate automated linting, testing, and deployment quality studies.