How juosorioca420/chizu-project works
Project type and purpose
• Project type: Full-stack web application
• Purpose: “Chizu” is a marketplace and crowdfunding platform for indie video games. Players can browse, purchase, download, and review games. Developers can create subscription‐based funding campaigns with tiered rewards.
High-level file structure & key indicators
• src/app: Next.js 13 “app” directory with React Server & Client Components, dynamic routes, API folder.
• src/pages/api & src/app/api/trpc: Two API surfaces—traditional Next.js API Routes and a tRPC router.
• server.ts, payload.config.ts, payload-types.ts: A Payload CMS instance running in a custom Node/Express server.
• firebaseConfig.ts & src/LOGIN: Google/Firebase authentication layer (used in a legacy login module).
• lib/stripe.ts & webhooks.ts: Stripe payment integration and webhook handlers.
• collections & payload-types: MongoDB data models managed by Payload CMS.
README insights
• Auth via Google
• Payments through Stripe
• Downloadable digital assets
• Library, cart, campaigns, subscriptions
• Responsive design, fast response, PCI-DSS compliance
Main components
a. Frontend (Client Browser)
• React (Next.js 13) Server & Client Components
• Pages: storefront, campaigns, cart, library, auth flows
• Static assets served from /public (logos, images, ZIPs)
b. Authentication Service
• Firebase Authentication (Google OAuth)
• Custom session store (if any) in Payload or Next.js
c. API Layer
• Next.js API Routes (/pages/api) for REST-style endpoints (e.g., email-receipt, payment-status)
• tRPC router (/src/app/api/trpc & /src/trpc) for type-safe RPC calls
d. CMS & Business Logic Server
• Payload CMS (runs in server.ts) managing MongoDB collections
• Business code in trpc routers (auth-router.tsx, payment-router.ts)
e. Database
• MongoDB (collections defined in /collections)
f. External Services
• Stripe (charges, subscriptions, webhooks)
• Email Service (SMTP or third-party for receipts)
• (Optional) Google Lighthouse / Analytics
Relationships & interactions
• User → Browser (UI components)
• Browser → Next.js Server (SSR, API calls)
• Next.js Frontend →
• tRPC client → tRPC server → Payload CMS → MongoDB
• REST API → Next.js API Routes → payload-utils / lib → MongoDB or external
• Firebase Auth SDK → Firebase Auth → JWT/session
• Stripe SDK → Stripe API → webhooks → Next.js Server or Payload CMS
• Payload CMS Admin UI (for developers) → Payload Server → MongoDB
Architectural patterns & design principles
• React Server Components (Next.js “app” directory) for performance and SEO
• API-first design with a hybrid of REST (Next.js API Routes) and RPC (tRPC)
• CMS as a self-contained microservice (Payload on Node/Express)
• Event-driven webhooks for payment notifications
• Separation of concerns: UI / Auth / API / Data persistence
Technologies & frameworks
• Frontend: Next.js 13, React, TypeScript, Tailwind CSS
• API: Next.js API Routes, tRPC, Node.js/Express
• CMS: Payload CMS
• Database: MongoDB
• Auth: Firebase Authentication (Google OAuth)
• Payments: Stripe
• Utilities: Zod validators, custom hooks, shared components