Carlos Eduardo Gatti Ferreira

Architectural Decisions

This document provides an overview of key architectural decisions made in this monorepo. Detailed decisions are documented as Architectural Decision Records (ADRs) in /docs/05-adr/.

Decision Index

Phase 1: Foundation (Infrastructure & Duplication Reduction)


Quick Reference

Monorepo Structure

Decision: Keep all code in a single repository rather than multiple repos.

Why:

Trade-offs:


Next.js Dual Router Strategy

Decision: Use both Pages Router (legacy) and App Router (modern) simultaneously.

Why:

Trade-offs:


Shared GraphQL Client

Decision: Create custom, lightweight GraphQL client instead of Apollo/Relay.

Why:

Trade-offs:

Reference: ADR-001


Generic Authentication System

Decision: Create generic AuthProvider that can be configured per domain.

Why:

Trade-offs:

Reference: ADR-001


UI Component Library

Decision: Create minimal UI base (/components/ui) with generic, reusable components.

Why:

Trade-offs:

Reference: UI Base Guidelines


Image Processing Library

Decision: Extract image processing logic into shared library.

Why:

Trade-offs:

Reference: Image Upload Audit


Feature-Driven Organization

Decision: Organize code by feature in /src/features/ rather than by type.

Why:

Structure:

features/
  auth/
    components/
    hooks/
    types.ts

Trade-offs:


TypeScript Path Aliases

Decision: Use path aliases (@/, @/src/) instead of relative imports for shared code.

Why:

Trade-offs:


Tailwind CSS Over CSS-in-JS

Decision: Use Tailwind CSS utility classes instead of CSS-in-JS libraries.

Why:

Trade-offs:


React Context Over State Management Libraries

Decision: Use React Context API for global state instead of Redux/Zustand.

Why:

Trade-offs:

Future Consideration: React Query for server state (partially implemented)


Decision Process

When to Create an ADR

Create an ADR when:

ADR Format

See existing ADRs in /docs/05-adr/ for format. Include:

  1. Context — What problem does this solve?
  2. Decision — What was chosen?
  3. Consequences — What are the trade-offs?
  4. Status — Is this implemented? Superseded?

Future Decisions to Make

Planned

Under Consideration