How harshal01123/craftideationtool works
1. Top-level shape
- The repo is split into a React + TypeScript SPA in CraftConnect/ and a small Supabase backend surface in supabase/.
- The frontend is the main application; Supabase provides Auth, Postgres, Realtime, and Storage. There is no separate custom server.
2. Primary user domains
- The app is organized around three roles: Artisan, Customer, and Learner.
- Those roles drive the major product areas: Marketplace, Educational courses, Chat/negotiation, Dashboards, and Ratings/notifications.
3. Frontend composition
- src/main.tsx bootstraps the SPA, and src/App.tsx is the central routing/container layer.
- Navigation is likely React Router-based, with a shared ScrollToTop, ProtectedRoute, and role-aware dashboard layouts.
- The app is styled with CSS Modules plus shared CSS variables in src/styles/variables.css.
4. State and cross-cutting concerns
- src/contexts/ModeContext.tsx provides app-wide mode state.
- src/hooks/ contains domain hooks for auth, chat, and wishlist, indicating that most server-backed state is accessed through hooks rather than a separate state-management library.
- src/lib/supabase.ts is the backend access boundary; it centralizes the Supabase client and is the main conduit for auth/database/realtime/storage interactions.
5. Authentication and access control
- Auth flows are handled by Login, Signup, and ResetPassword pages, backed by Supabase Auth.
- ProtectedRoute suggests route-level enforcement for dashboard and role-specific areas.
- User profile data is probably loaded from the profiles table and then used to determine which dashboard and features are visible.
6. Marketplace subsystem
- Product browsing is implemented through ProductPortfolio, Products, MyProducts, and product cards/modals in src/components/products/.
- The marketplace supports multi-image listings, category filtering via industryOptions, price filtering, wishlists, and product detail/portfolio views.
- Customer and artisan boundaries are reflected in separate views for browsing versus managing listings.
7. Educational subsystem
- Courses are modeled separately from products, with pages such as CoursePortfolio, Courses, MyCourses, and learner dashboards.
- UI components like CreateCourseModal and CertificateModal show the flow: artisans create masterclasses, learners enroll, progress is tracked, and completion can produce certificates.
- This subsystem is distinct from the marketplace, but both share the same artisan profile and dashboard infrastructure.
8. Real-time chat and bargaining
- Chat is a major standalone subsystem under src/components/chat/ and src/pages/dashboard/Messages.tsx.
- It includes conversation lifecycle, message bubbles, sidebar/thread selection, closed-chat banners, contact/new-chat dialogs, product pickers, and offer negotiation UI (OfferCard, PriceSetDialog, OfferFlowCoordinator).
- The README and file names indicate Supabase Realtime is used for instant message delivery and state synchronization.
9. Notifications and feedback loops
- The dashboard includes notifications (Notifications.tsx) and message-related alerts.
- Chat events likely trigger notification updates for new messages, new conversations, and closed threads.
- Ratings/reviews are a separate feedback loop, with components for RatingModal, ReviewCard, and StarRating, covering both artisan and product reputation.
10. Dashboard architecture
- src/layouts/DashboardLayout.tsx is the shared shell for authenticated, role-specific screens.
- Under src/pages/dashboard/ there are separate artisan, customer, and learner entry points, plus feature pages for profile editing, products, courses, certificates, artisans, and messages.
- This indicates the dashboard is a hub-and-spoke structure: one layout, many domain pages, all powered by the same Supabase-backed user/session state.
11. Localization and presentation
- The app is bilingual via src/i18n.ts, src/locales/en.json, and src/locales/hi.json.
- LanguageSwitcher in the UI reflects that language is a first-class global setting, not a page-local concern.
- UI behavior and motion are enhanced with component-level patterns and external animation support noted in the README.
12. Backend/serverless layer
- supabase/functions/request-reset and supabase/functions/send-bug-report are edge functions, so not all backend logic lives in the browser.
- These functions likely cover email-related workflows and support/feedback submission, keeping sensitive operations off the client.
- The backend is otherwise Supabase-native: database tables, auth, and realtime channels do most of the work.
13. Deployment and ops
- The repo includes vercel.json, implying the SPA is deployed on Vercel.
- .github/workflows/supabase-keep-alive.yml suggests a CI/maintenance job to keep the Supabase project warm or prevent inactivity-related downtime.
- build_output.txt and TypeScript/lint configs indicate the repo is built as a standard frontend bundle with typed checks and linting.
14. Data flow summary
- User enters the SPA → authenticates via Supabase → profile/role determines accessible dashboard and routes.
- Marketplace, course, wishlist, rating, and chat screens read/write directly to Supabase tables/storage through hooks and the shared client.
- Chat and notifications are event-driven through Realtime, while special workflows like reset/bog-report use edge functions.
Main entry points: App.tsx App · Dashboard.tsx Role Areas · supabase.ts Supabase Client · ProductPortfolio.tsx Marketplace
Components 18
Frontend SPA
React + TypeScript single-page application and shared UI/state layers.
- Entry · Bootstraps the React application and mounts the root UI.
CraftConnect/src/main.tsx - App · Central routing and top-level application container.
CraftConnect/src/App.tsx - Dashboard Layout · Shared authenticated dashboard shell for role-specific screens.
CraftConnect/src/layouts/DashboardLayout.tsx - Auth Hooks · Client-side auth/session access and user loading.
CraftConnect/src/hooks/useAuth.ts - Chat Hooks · Conversation state, message flow, and chat interactions.
CraftConnect/src/hooks/useChat.ts - Wishlist Hook · Wishlist state and marketplace favorites handling.
CraftConnect/src/hooks/useWishlist.tsx - Role Areas · Artisan, customer, and learner dashboard entry points and role-specific screens.
CraftConnect/src/pages/dashboard/Dashboard.tsx - Marketplace · Product browsing, listing management, filtering, wishlists, and product details.
CraftConnect/src/pages/ProductPortfolio.tsx - Courses · Course discovery, creation, enrollment, and certificate workflows.
CraftConnect/src/pages/dashboard/CoursePortfolio.tsx - Messaging · Threaded chat, product pickers, offers, and negotiation UI.
CraftConnect/src/pages/dashboard/Messages.tsx - Ratings · Ratings, reviews, and reputation feedback surfaces.
CraftConnect/src/components/ratings/RatingModal.tsx - Notifications · Dashboard notifications and message-related alerts.
CraftConnect/src/pages/dashboard/Notifications.tsx - Language · Bilingual localization and language switching.
CraftConnect/src/i18n.ts - Mode Context · App-wide mode and presentation state.
CraftConnect/src/contexts/ModeContext.tsx
Supabase Backend
Supabase auth, database, realtime, storage, and edge functions.
- Supabase Client · Central client for auth, database, realtime, and storage access.
CraftConnect/src/lib/supabase.ts - Reset Email · Server-side password reset request workflow.
supabase/functions/request-reset/index.ts - Bug Report · Server-side bug report submission workflow.
supabase/functions/send-bug-report/index.ts
Deployment & Ops
Build, hosting, and maintenance workflows.
- Vercel Deploy · Frontend deployment target for the SPA.
CraftConnect/vercel.json
Connections 23
- Entry → App: bootstraps · The entry file mounts the application shell.
- App → Dashboard Layout: routes to · Authenticated sections flow into the shared dashboard layout.
- App → Role Areas: exposes · Top-level routing exposes role-specific areas and pages.
- App → Marketplace: routes to · Marketplace views are part of the main SPA.
- App → Courses: routes to · Course views are part of the main SPA.
- App → Messaging: routes to · Messaging and negotiation screens are routed from the app shell.
- Auth Hooks → Supabase Client: auth session · Auth hooks use the shared Supabase client for session and profile access.
- Chat Hooks → Supabase Client: realtime data · Chat hooks read and write conversation state through Supabase.
- Wishlist Hook → Supabase Client: wishlist data · Wishlist state is persisted through the Supabase backend boundary.
- Marketplace → Wishlist Hook: favorites · Marketplace surfaces use wishlist state and interactions.
- Messaging → Chat Hooks: drives · Chat UI is powered by the chat hook layer.
- Messaging → Notifications: triggers · Message events feed notification updates.
- Courses → Ratings: feedback · Course completion and user feedback connect to ratings surfaces.
- Marketplace → Ratings: reviews · Product reputation flows into ratings and review components.
- Role Areas → Marketplace: manages · Role dashboards surface product browsing and listing management.
- Role Areas → Courses: manages · Role dashboards surface course creation and learner progress.
- Role Areas → Messaging: coordinates · Dashboard areas link into messaging and negotiation.
- Role Areas → Notifications: shows · Role dashboards display alerts and inbox status.
- Language → App: global ui · Localization is applied across the application shell.
- Mode Context → Dashboard Layout: theme state · Mode state influences shared dashboard presentation.
- Reset Email → Supabase Client: uses backend · Reset workflow is implemented as a Supabase edge function around backend services.
- Bug Report → Supabase Client: uses backend · Bug reporting is handled server-side through Supabase functions.
- Vercel Deploy → App: hosts · The SPA is deployed through Vercel.