Skip to content

aaryaP777/FCC-Project-24

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Here's a README template for your MERN stack blog application. This covers the major components, setup instructions, and features based on the project information you've provided:


Blog Platform with AI Integration

This project is a MERN stack blog application that offers real-time engagement features, AI-driven content suggestions, and streamlined admin management. It's designed to provide a modern blogging experience, leveraging cutting-edge technologies and scalable solutions.

Table of Contents

Features

  • Authentication: Firebase OAuth integrated with Redux for seamless user management.
  • Blog Management: Users can create, edit, and delete posts and comments.
  • Admin Role: Dedicated admin features to manage users and content.
  • AI Integration: Powered by the Gemini or OpenAI API for content suggestions.
  • Real-Time Engagement: User comments and reactions.
  • Responsive Design: TailwindCSS ensures a clean and modern UI across devices.
  • Deployment Ready: Deployed on Render with an option for Vercel/Netlify.

Technology Stack

  • Frontend: React, TailwindCSS
  • Backend: Node.js, Express.js
  • Database: MongoDB (hosted on MongoDB Atlas)
  • Authentication: Firebase OAuth, Redux
  • AI Integration: Gemini API or OpenAI
  • Deployment: Render (optionally Vercel or Netlify)

System Architecture

Project Structure

├── client # Frontend React application │ ├── src # Source files │ ├── public # Static assets │ └── ... ├── server # Backend Node.js application │ ├── models # MongoDB schema definitions │ ├── routes # API route handlers │ ├── middleware # Middleware for authentication and roles │ └── ... └── README.md # Project documentation

Installation and Setup

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB Atlas account (or locally installed MongoDB)
  • Firebase project setup for OAuth authentication

Steps

  1. Clone the repository

    bash git clone https://github.com/Dhairya-A-Mehra/FCC-Project-24.git cd blog-platform-ai

  2. Install dependencies for the server and client

    bash

    Server

    cd server npm install

    Client

    cd ../client npm install

  3. Set up environment variables

    Create .env files in both server and client directories (see Environment Variables).

  4. Run the application

    bash

    In the server directory

    npm run dev

    In the client directory

    npm start

  5. Visit the application

    Open your browser and go to http://localhost:5173 (client) and http://localhost:3000 (server).

Environment Variables

Server .env

PORT=3000 MONGO_URI=your_mongodb_uri FIREBASE_API_KEY=your_firebase_api_key AI_API_KEY=your_openai_or_gemini_api_key

Client .env

REACT_APP_FIREBASE_API_KEY=your_firebase_api_key REACT_APP_AI_API_KEY=your_openai_or_gemini_api_key REACT_APP_SERVER_URL=http://localhost:5173

Scripts

Client Scripts

  • npm start: Runs the React app in development mode.
  • npm run build: Builds the React app for production.

Server Scripts

  • npm run dev: Runs the Node.js server with hot-reloading using Nodemon.
  • npm start: Runs the server in production mode.

Challenges & Solutions

  1. State Management and Persisting Authentication
    Used Redux Toolkit with Redux Persist to manage and persist user authentication states across sessions.

  2. Schema Design and Query Optimization
    Optimized MongoDB schema with embedded comments for efficient query performance and applied indexing on post content fields.

  3. API Rate Limits for AI Integration
    Cached frequent API responses and used debounce functions to limit API calls, reducing excessive calls during typing.

  4. Deployment Compatibility
    Resolved environment variable issues and adjusted configurations to ensure compatibility on Render.

  5. Role-Based Access Control
    Added middleware to handle role-based access for users and admins, ensuring secure and restricted access to sensitive admin features.

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/new-feature).
  3. Commit your changes (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature/new-feature).
  5. Create a Pull Request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


This README provides an overview and details for setup, running, and contributing to the project. Customize further to include any specific instructions or additional setup requirements if needed.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 99.2%
  • Other 0.8%