How str-well/orcamentos-pai works
Main Components
• Frontend (Client):
• Located in the client/ directory.
• Built with React, TypeScript, Tailwind CSS, Radix UI, and other libraries.
• Contains pages (authentication, dashboard, budgets CRUD, PDF preview, and price search), UI components (from common buttons to intricate UI patterns), and hooks for state and API integration.
• Backend & API:
• Found in both the server/ and api/ directories.
• Handles authentication (server/auth), budget operations (CRUD endpoints), routing, business logic, and PDF generation (server/pdf-generator.ts).
• Contains utility libraries (like supabase API wrappers and openai integration).
• Supabase Infrastructure:
• Shown in the supabase/ folder with functions (e.g., generate-budget-pdf and update-budget-status) and migrations.
• Acts as the Database (PostgreSQL), provides authentication (via Supabase Auth), storage, and edge functions.
• Shared Resources:
• shared/ and src/ directories hold common schema definitions and contexts which are utilized across both client and server layers to ensure consistency.
• From the API/Backend, show interactions with “Supabase Database & Storage” for reading/writing data, handling authentication, and file storage.
• A connection/path for third-party libraries (such as Puppeteer for PDF or OpenAI for smart functionalities if applicable).
Architectural Patterns and Design Principles
• Separation between the frontend and backend. Note how the API endpoints (e.g., POST/GET/PUT/DELETE for budgets) provide a RESTful interface.
• Use of containerized or modular components; for example, in the frontend, components and hooks are grouped by function (budget pages vs. shared components).
• Use of “shared” schema definitions to maintain consistency between client and server models.
• Asynchronous data flow via React Query, automated state management using hooks, and how user authentication is handled via Supabase.
Relevant Technologies & Frameworks
• Frontend: React, TypeScript, Tailwind CSS, Radix UI, Shadcn UI, React Hook Form, Zod, React Query, Framer Motion, Wouter, Recharts.
• Backend: Node/TypeScript, Express-style routing (or similar), supabase libraries, Puppeteer (for PDF generation), and potential integrations with OpenAI.
• Infrastructure: Supabase for database (PostgreSQL), authentication, storage, and edge functions.
Additional Details
• Details such as how authentication flows from login/registration screens (client) to the API and then to Supabase Auth.
• Role of utility libraries such as those in client/src/lib and server/lib for managing essential operations like protected routes and querying Supabase.
• Incorporate deployment elements: note that the frontend is deployed on Vercel and backend likely runs in serverless functions or a managed container environment.