How gouravindoriya/blog works
Project type and purpose
• This is a single-page full-stack application built with React and Vite on the front end, using Appwrite as a Backend-as-a-Service (BaaS) provider for authentication and data storage.
• The goal, per the README, is to display user-specific blogs on the home page while allowing all users to see all active posts from any user.
File structure
• Top-level files and folders:
• index.html, public/ — the static shell that Vite serves.
• src/main.jsx, src/App.jsx — the React app entry points.
• src/components/ — UI components organized by feature (AuthLayout, Login, Signup, PostCard, PostForm, RTE, etc.).
• src/appwrite/ — Appwrite integration (auth.js, config.js).
• src/store/ — Redux Toolkit store (authSlice.js, store.js).
• config files: vite.config.js, tailwind.config.js, postcss.config.js, eslint.config.js.
• vercel.json — deployment config for hosting on Vercel.
• Architectural patterns:
• Component-based UI (React)
• Global state via Redux Toolkit
• Services layer for BaaS (Appwrite)
• CSS utility framework (Tailwind)
Extract insights from the README
• Uses Vite for dev server and plugin-react for HMR.
• A home page showing only the current user’s blogs, with global visibility of active posts.
• Task assignment and date indicate ongoing feature work around blog visibility rules.
Main components and interactions
a. Components:
• User’s Web Browser (Client)
• Vercel-hosted React+Vite App
• React component tree (App.jsx → pages → feature components)
• Appwrite service module (auth.js, config.js)
• Appwrite Cloud Services
• Authentication (JWT, sessions)
• Database (collections for users, posts)
• Storage (if media attachments)
b. Relationships / Data flow:
1. User ➞ Browser UI: click login/signup/post controls
2. UI dispatches Redux actions ➞ Auth / Posts services
3. Appwrite SDK (auth.js) makes REST or SDK calls to Appwrite Auth API
4. Appwrite returns session tokens & user data ➞ stored in Redux
5. UI requests posts: Appwrite Database query ➞ returns post list ➞ displayed
6. Vercel hosts the static build; user fetches index.html + JS bundle
c. Architectural patterns / design principles
• Separation of concerns: UI components vs. state management vs. service modules.
• Feature-based folder structure for maintainability.
• BaaS offloads auth & data persistence.
• HMR via Vite for rapid front-end feedback.
d. Key technologies & libraries
• React + JSX, Vite + plugin-react
• Tailwind CSS, PostCSS
• Redux Toolkit (store, authSlice)
• Appwrite JS SDK (auth.js, config.js)
• Deployment: Vercel
Detailed call-outs to capture essentials
• Entry point (src/main.jsx → App.jsx).
• Appwrite config & auth flow (src/appwrite/config.js → auth.js).
• Data-driven pages (AddPost, AllPosts, EditPost) and how they query Appwrite.
• Redux persisting user session and providing auth tokens to API calls.