How cobrother-official/cobrother_frontend works
1. Overall shape
- This repository is a React 18 + Vite single-page application for the CoBrother marketplace.
- It is the browser frontend only: business data, auth, auctions, listings, and AI features are served by an external FastAPI backend.
- Production hosting is on Vercel, with backend API calls routed to Render-hosted services.
2. Routing and page composition
- src/pages/ contains the route-level screens: home, domains, ventures, technology/co-creation, creator community, auctions, dashboards, auth flows, and admin/operator pages.
- src/components/layout/ and common navigation components provide the shell around those pages.
- Protected areas such as dashboard/admin flows are gated through src/components/auth/ProtectedRoute.jsx.
3. Feature boundaries
- The UI is organized around the platform’s core business domains:
- Domains: marketplace, registration, transfer, verification, storefront
- Ventures: venture listings, bids, deals, verification, profile sections
- Technology / co-creation: software listings, auctions, demo/verification flows
- Creator/community: creator listings, community auctions, profile completion
- Auctions: shared auction hub and category-specific auction flows
- Each domain has its own page components, specialized cards/modals, and helper utilities.
4. Data access layer
- src/api/ is the network boundary: Axios client setup plus feature-specific service modules.
- src/utils/* contains many business adapters and calculators that shape API data for the UI: pricing, verification, listing visibility, auction fees, domain display, analytics, and navigation helpers.
- The backend API origin is resolved through src/config/urls.js, which is important because OAuth and WebSocket endpoints must target the backend host, not the frontend host.
5. Request and environment flow
- In local development, Vite proxies /api, /oauth2, and /ws to the backend.
- In production, vercel.json rewrites API routes to the backend and preserves SPA client-side routing.
- Environment variables in .env.* control the backend URL and app origin, so the frontend can switch cleanly between local and production deployments.
6. Global application state
- Cross-cutting state is handled by React context in src/context/:
- AuthContext for sign-in/session state
- CurrencyContext for display and conversion
- LanguageContext for localization
- CookieConsentContext for privacy/cookie preferences
- These contexts affect almost every route because they control permissions, formatting, locale, and consent-driven UI.
7. Realtime and live updates
- Auction and notification experiences are supported by SockJS + STOMP through hooks like useNotificationSocket, useAuction, useCommunityAuction, and useSoftwareAuction.
- This is the main realtime boundary in the app: the browser subscribes to backend events for live auction status, notifications, and similar updates.
8. Localization and regional behavior
- The app is multi-lingual through i18next / react-i18next.
- Translation resources live in src/i18n/locales/, with helper scripts to sync/apply translations.
- src/context/LanguageContext.jsx, locale utilities, and region-specific currency formatting make language and currency part of the core UX, not just presentation.
9. Shared UI system
- src/components/common/ contains reusable primitives: buttons, modals, loaders, banners, navbars, search bars, tooltips, consent UI, and bot-protection widgets.
- src/components/home/, src/components/listings/, src/components/ai/, src/components/analytics/, and similar folders hold feature-specific presentational components.
- Styling is a mix of Tailwind CSS and targeted CSS files in src/styles/, with Framer Motion used for page and section animation.
10. Integrations with external services
- Google OAuth is part of the auth flow and routes through the backend.
- AI domain generation and related storefront experiences are frontend surfaces over backend AI services.
- Payment/payout flows are supported by utility code for checkout and payout settings, indicating an external payment provider integration.
- Bot protection and consent mechanisms are also first-class parts of the app boundary.
11. Analytics and dashboards
- The app includes multiple dashboards and reporting views: user dashboards, admin dashboards, operations views, platform analytics, profile analytics, and venture/domain analytics.
- Charts are rendered with Recharts, and the data is pre-shaped by utility modules before it reaches chart components.
- This makes analytics a separate UI subsystem rather than just another page.
12. Build, deployment, and quality gates
- The frontend is built with Vite and deployed through Vercel; GitHub Actions run frontend tests and deployment workflows.
- Tests are present for critical utilities and auth/protected-route behavior, showing that route protection, formatting logic, and business rules are treated as core frontend concerns.
Main entry points: main.jsx Main · domainPricing.js Business Adapters · App.jsx App · axios.js API Client
Components 21
Shell
App entry, routing, layout, and global UI framing.
- Main · Bootstraps the React app and global providers.
src/main.jsx - App · Top-level route composition and app wiring.
src/App.jsx - App Layout · Shared page shell and profile/regional navigation.
src/components/layout/AppLayout.jsx - Protected Route · Guards authenticated or privileged routes.
src/components/auth/ProtectedRoute.jsx
State
Cross-cutting providers, hooks, and client-side session state.
- Auth Context · Sign-in, session, and permission state.
src/context/AuthContext.jsx - Currency Context · Currency selection and pricing display state.
src/context/CurrencyContext.jsx - Language Context · Localization and language selection state.
src/context/LanguageContext.jsx - Cookie Consent · Consent preferences for tracking and cookies.
src/context/CookieConsentContext.jsx - Realtime Hooks · SockJS/STOMP subscriptions for auctions and notifications.
src/hooks/useNotificationSocket.js
Features
Business-domain screens and their supporting UI.
- Home Pages · Home, marketing, and discovery screens.
src/pages/Home.jsx - Marketplace · Domains, storefront, registration, transfer, and verification flows.
src/pages/DomainsPage.jsx - Ventures · Venture listings, detail, bids, deals, and dashboards.
src/pages/VenturesPage.jsx - Technology · Co-creation and software auction experiences.
src/pages/CoCreationPage.jsx - Auctions · Shared auction hub and category-specific auction pages.
src/pages/AuctionsPage.jsx - Admin Ops · Admin, operations, analytics, and request handling screens.
src/pages/AdminDashboardPage.jsx
Data
Network boundary, configuration, and shared adapters.
- API Client · Axios setup and shared request handling.
src/api/axios.js - Feature APIs · Feature-specific backend service calls.
src/api/services.js - Backend URLs · Backend origin and environment-specific endpoint resolution.
src/config/urls.js - Business Adapters · Pricing, visibility, verification, and domain/listing transforms.
src/utils/domainPricing.js
Infra
Build, deploy, localization, and runtime tooling.
- i18n · Translation resources and language utilities.
src/i18n.js - Build & Deploy · Vite, Vercel, and workflow deployment settings.
vite.config.js
Connections 24
- Main → App: mounts · Application entry renders the route tree.
- App → App Layout: wraps · Routes are rendered inside the shared shell.
- App → Protected Route: guards · Privileged routes are wrapped with protection.
- Main → Auth Context: provides · Global session state is initialized at app start.
- Main → Currency Context: provides · Currency formatting is app-wide.
- Main → Language Context: provides · Localization state is app-wide.
- Main → Cookie Consent: provides · Consent state is app-wide.
- Main → i18n: initializes · Translation system is loaded on startup.
- Auth Context → Protected Route: controls · Auth state determines route access.
- Auth Context → Feature APIs: authorizes · Authenticated requests use session-aware API calls.
- Realtime Hooks → API Client: subscribes via · Realtime features coordinate with backend transport.
- API Client → Backend URLs: targets · Client base URLs come from environment config.
- Feature APIs → API Client: uses · Feature services build on the shared client.
- Business Adapters → Feature APIs: shapes · Adapters transform backend data for UI use.
- Business Adapters → Currency Context: formats · Business values are displayed in selected currency.
- Home Pages → Business Adapters: consumes · Home discovery sections use derived listing data.
- Marketplace → Business Adapters: consumes · Marketplace screens rely on pricing and verification adapters.
- Ventures → Business Adapters: consumes · Venture flows use listing, deal, and verification helpers.
- Technology → Business Adapters: consumes · Technology and co-creation screens use auction/listing helpers.
- Auctions → Realtime Hooks: updates live · Auction pages receive realtime status changes.
- Admin Ops → Protected Route: requires · Admin and operations views are access controlled.
- Admin Ops → Feature APIs: queries · Dashboards and ops views load backend data.
- Build & Deploy → API Client: routes to backend · Deployment config preserves API/backend separation.
- Build & Deploy → App: preserves spa · Client-side routing is supported in deployment.