How osw6858/tech-hub works
Project type and purpose
• This is a full-stack single-page application (SPA) template built with React (TypeScript, Vite) on the frontend and Firebase on the backend.
• It provides a blog platform for front-end developers, handling user authentication, post creation/editing, commenting, and real-time data storage.
File structure
• Top-level:
• public / index.html – the SPA entry point
• src/ – all application code
– App.tsx, main.tsx – React root and router setup
– components/ – reusable UI pieces (auth screens, cards, comments, modals, header/footer, post forms, etc.)
– hooks/ – custom React hooks for each feature domain (authHooks, postHooks, commentHooks, mypagehook)
– redux/ – ThemeSlice.ts and store.ts for global theme state
– routes/ – React Router configuration
– firebase/firebaseConfig.ts – Firebase initialization
– styles/ – theme and global styled-components
• Config/build files: vite.config.ts, tsconfig.json, package.json, .eslintrc.cjs
• CI/CD: .github/workflows/*.yml deploy to Firebase Hosting
README for insights
• Confirms tech stack: React, TypeScript, styled-components, react-router, react-query, Redux, axios, Vite, Firebase (Auth, Firestore).
• Describes main use cases: user signup/login, posting with images, commenting, password reset, personal “My Page,” and theming.
Main components and their interactions
a. Client SPA (Browser/React)
– UI layer: components/ folder
– Routing: react-router (src/routes)
– State management: Redux for theme; React Query (and custom hooks) for data fetching/caching
– Firebase SDK calls abstracted in hooks (e.g. loginHook.ts, addPostHook.ts)
b. Firebase backend
– Authentication (sign-up, login, password reset)
– Firestore database (posts, comments, user profiles)
– Hosting (serving the built SPA)
c. CI/CD pipeline
– GitHub Actions workflows that build the Vite app and deploy to Firebase Hosting on merges/pull requests
Architectural patterns and principles
• Component-based UI with clear segregation of concerns (auth, post, comment, common UI).
• Custom hooks to encapsulate side effects and API logic.
• React Query for asynchronous data fetching, caching, and synchronization with Firestore.
• Redux slice for predictable global state (theme) across the app.
• Vite as dev/build tool for fast HMR and optimized production bundles.
• Hosted as an SPA on Firebase with environment-driven config.