How abhishek-ashyap/inkbytr works
Project Type and Purpose
• This is a full-stack MERN blogging platform called Inkbytr.
• Frontend: React + Vite + Tailwind + Shadcn/UI with Redux Toolkit for state, React Router for navigation, Axios for API calls.
• Backend: Node.js + Express monolith, MongoDB with Mongoose, JWT-based auth, role-based access control, email via SendGrid, security via Helmet and rate limiting.
File Structure
• Top-level “Client” and “Server” folders separate frontend and backend.
• Client/src: React app organized into pages, components, hooks, services, Redux slices, assets.
• Client/public & config files: Vite, ESLint, PostCSS, Tailwind, Vercel.
• Server: app.js/server.js entrypoints, config for environment, models, controllers (authController, postController), routes (auth, posts), middleware (auth, adminAuth, rateLimiter), utils (email, hash), tests.
• env examples and scripts in package.json for both.
Key Insights from README
• Secure JWT Authentication with email verification and password reset.
• Full CRUD on posts, nested comments, likes, RBAC (user vs. admin).
• Rate limiting, Helmet for security headers.
• Tech stack explicitly calls out major frameworks and services.
Main Components
a. Frontend SPA
• React app (Vite)
• State store (Redux Toolkit slices)
• UI layer (Shadcn/UI + Tailwind)
• Service layer (Axios wrappers: api.js, authService, postService)
b. Backend API
• Express server (app.js, server.js)
• Controllers (authController, postController)
• Routes (auth, posts)
• Middleware chain (Helmet, rateLimiter, authMiddleware, adminAuth)
• Business logic & utilities (email.js, hash.js)
c. Database
• MongoDB cluster (Atlas or local)
• Mongoose models (User, Post)
d. External Services
• SendGrid for transactional emails
• (Optional) Vercel hosting for frontend
Relationships & Interactions
• Frontend → Backend: HTTP/HTTPS REST calls to /api/auth, /api/posts with JWT in Authorization header.
• Backend → Database: Mongoose ODM performs CRUD on User and Post collections.
• Backend → SendGrid: Email API calls for verification and password reset.
• Data Flow:
1. User actions in UI dispatch Redux actions → thunk calls service → Axios request.
2. Express middleware validates JWT → controllers handle logic → Mongoose updates DB → response.
3. Frontend receives JSON, updates store, re-renders UI.
Architectural Patterns & Design Principles
• Frontend: Container/Presentational split (pages vs. components), Redux slice pattern.
• Backend: MVC-style layering—Routes → Controllers → Models (Mongoose).
• Security layers via middleware chain (Helmet, rate limiting, auth).
• RESTful API conventions.
• Role-based access control enforcement in middleware/controller.