How stevesuv/remix-words-funny works
Main Components
• Frontend: All user interface components and routing are in the “app” folder (e.g., app/components, app/routes, app/root.tsx). This part uses Remix (React, react-router v7) combined with TailwindCSS and HeroUI.
• Backend API Layer: Server-side code is clearly separated under “app/.server”, with tRPC endpoints split into two groups:
– Actions (mutations) in app/.server/trpc/action (handling signIn, signUp, sending mail, etc.).
– Loaders (queries) in app/.server/trpc/loader (for fetching data such as book details, word information, etc.).
• Database Access: Within the “app/.server/db” directory, using Drizzle ORM to interface with PostgreSQL, including configurations, schema, and tasks.
• External Services:
– Email service integration for authentication (login verification codes) where the README explains local testing vs. production deployment via SMTP or a service like Resend.
– Docker integration for containerization and deployment.
• Shared Utilities & Common Code: The “app/common” directory holds utilities, constants, types, and store logic used both in the frontend and backend.
Relationships and Interactions
• The Frontend communicates with the Backend API via tRPC. The UI components call the trpc actions (for mutations like sign-in, sending comments, etc.) and trpc loaders (for fetching various word-related queries).
• The Backend routes (inside app/.server) parse these API calls then perform operations like authentication (using auth.ts, cookies.ts, crypto.ts) and database read/writes via the Drizzle ORM.
• For email verification, an optional external email server (or a simple local log in development) is used. Represent this as an external integration.
Architectural Patterns and Design Principles
• Separation of Concerns: There is a clean division between:
• UI (client-side) and backend server code.
• Mutation and query channels within the tRPC setup.
• Database logic isolated in its own directory.
• Type Safety: End-to-end type safety is enforced using TypeScript, tRPC, and zod-based forms.
• Containerization: Docker is used for packaging and deployment, and there's support for pm2-managed deployments.
• Modular Structure: Each major action (user authentication, data fetching, etc.) is split into a dedicated file under their respective directories.
Relevant Technologies, Frameworks, and Libraries
• Frontend: Remix, React (react-router v7), TailwindCSS, HeroUI, next-themes.
• Backend: tRPC (with separate action and loader endpoints), Node.js, JWT for authentication, Drizzle ORM, dotenv for environment configuration.
• Database: PostgreSQL.
Final Advice
• Be detailed: clearly show the separate folders (even if abstractly) that represent the micro-architectures (tRPC actions vs. loaders, email integration, etc.).
Happy diagramming!