I am on Node.js $ node -v v20.14.0
Deployment: https://madhav-tech-blog.onrender.com/
This project is a full-stack MERN (MongoDB, Express, React, Node.js) application for a blog. It features user authentication, post management, and dynamic routing using React Router. The frontend is built with React, utilizing various libraries for state management, UI components, and routing.
- React: Frontend JavaScript library for building user interfaces.
- React Router DOM: Declarative routing for React applications.
- PrivateRoute and OnlyAdminPrivateRoute: Custom components for handling authenticated and admin-only routes.
- Tailwind CSS: Utility-first CSS framework used for styling components.
- ScrollToTop: Component to scroll to the top of the page on route change.
The frontend directory (client
) structure is organized as follows:
-
Pages: Contains individual pages rendered for different routes:
Home
: Landing page.About
: About page.SignIn
andSignUp
: User authentication pages.Dashboard
: User dashboard page (protected route).CreatePost
andUpdatePost
: Pages for creating and updating blog posts (admin-only routes).PostPage
: Page displaying a single blog post.Search
: Page for searching blog content.
-
Components: Reusable UI components:
Header
andFooter
: Navigation and footer components displayed across all pages.- Various other UI components used for form inputs, buttons, etc.
- BrowserRouter: Wraps the entire application to enable client-side routing with React Router.
- Routes: Defines routes using
<Routes>
and<Route>
components from React Router DOM.- Basic routes for
Home
,About
,SignIn
,SignUp
,Search
, andPostPage
. - Protected routes (
PrivateRoute
) forDashboard
accessible only after authentication. - Admin-only routes (
OnlyAdminPrivateRoute
) forCreatePost
andUpdatePost
.
- Basic routes for
-
Clone Repository: https://github.com/madhavgupta07/Madhav-tech-blog.git
-
Install Dependencies: Navigate to the
client
directory and runnpm install
to install required packages. -
Install Dependencies: Navigate to the
route
directory and runnpm install
to install required packages for BE. -
Start Development Server: Run
npm run dev
to start the Vite development server for frontend development. -
Explore Routes: Access different routes such as
/
,/about
,/sign-in
,/sign-up
,/search
,/dashboard
,/create-post
,/update-post/:postId
, and/post/:postSlug
in the browser.
- Ensure the backend server (
api/index.js
) is running concurrently for full application functionality. - Use
npm run build
to build the frontend for production deployment.