Skip to content

Basant1Saini/Ask_Me_Anything

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ask Me Anything — AI-Powered Q&A Platform

An AI-powered question-answering platform where users can ask anything and get intelligent answers generated using free AI and knowledge APIs. The platform automatically stays current by pulling real-world events through free news feeds, so answers are always up to date.

Table of Contents

Vision

Build an AI tool that can answer any question for free by chaining together multiple free APIs and open-source models. The platform:

  1. Accepts any user question through a clean web UI
  2. Routes the question to the best free AI/knowledge source
  3. Enriches answers with real-time data from free news and event APIs
  4. Auto-updates its knowledge base as real-world events happen
  5. Lets the community vote on and improve AI-generated answers

Free API Paths for Answering Questions

The core idea is to use zero-cost APIs to power the AI answering engine. Here are the free paths integrated (or planned for integration):

AI / LLM APIs (Free Tiers)

Provider Free Limits Best For
Google Gemini API 5–15 RPM, 100–1,000 RPD, no credit card needed General Q&A, reasoning, code help
Hugging Face Inference API Free tier for 1,000+ open-source models NLP, text generation, Q&A models (BERT, RoBERTa, etc.)
Groq Cloud Up to 1,000 req/day for Llama models Fast inference, coding questions
OpenRouter Free models available (Llama, Mistral, etc.) Fallback AI routing
Ollama (Local) Unlimited (runs locally) Offline/private AI answering

Knowledge & Search APIs (Free)

Provider What It Gives You
Wikipedia API Factual answers, definitions, summaries
DuckDuckGo Instant Answer API Quick answers, zero tracking, no API key needed
Wolfram Alpha Short Answers API Math, science, unit conversions (free AppID)
Stack Exchange API Programming Q&A from Stack Overflow (free, 300 req/day)
Dictionary API (dictionaryapi.dev) Word definitions, synonyms — completely free, no key

Real-Time News & Events APIs (Free Tiers)

These power the auto-update feature so the platform stays current:

Provider Free Tier Use Case
NewsAPI.org 100 req/day, 150k+ sources Breaking news, trending topics
The News API Free tier available Top stories, real-time feeds
GNews.io 100 req/day, 10-day trial for premium Global news in 41 languages
Mediastack Free plan, minute-by-minute updates Live news data feeds
World News API Free tier, 86 languages, 210+ countries Semantic news search
The Guardian Open Platform Free, no limit for non-commercial Full article content
Hacker News API Completely free, no key needed Tech/startup news
RSS Feeds Free, unlimited Custom source aggregation

Auto-Update Pipeline

The platform uses a scheduled job (cron) to:

  1. Fetch latest news from free news APIs every few hours
  2. Identify trending topics and events
  3. Feed event summaries into the AI model for context
  4. Update cached answers that reference outdated information
  5. Tag questions/answers with "last verified" timestamps

Tech Stack

Frontend

  • React 18 with hooks and functional components
  • Redux Toolkit for state management
  • Tailwind CSS for responsive UI
  • Vite for fast dev server and builds
  • Axios for API communication
  • React Hook Form for form validation
  • React Hot Toast for notifications

Backend

  • Node.js + Express.js REST API
  • MongoDB + Mongoose for data persistence
  • JWT + bcrypt for authentication
  • Helmet for security headers
  • express-rate-limit for rate limiting
  • express-validator for input validation

AI Integration (Planned / In Progress)

  • Google Gemini API (free tier) for primary AI answering
  • Hugging Face Transformers for open-source model fallback
  • Node-cron for scheduled news fetching and answer updates

Features

Implemented

  • User registration and login with JWT authentication
  • Ask questions with title, content, category, and tags
  • Browse and search questions with category filtering
  • View question details with all answers
  • Answer questions (backend API ready)
  • Vote on answers (backend API ready)
  • User profiles with activity tracking
  • Protected routes for authenticated actions
  • Responsive design across all devices
  • Centralized error handling and input validation
  • Rate limiting and security middleware

In Progress

  • AI-generated answer suggestions using free LLM APIs
  • Real-time news feed integration for auto-updating answers
  • Answer submission form on question detail page
  • Upvote/downvote buttons on answer cards
  • Edit and delete UI for questions and answers

Planned

  • Multi-model AI routing (Gemini → Hugging Face → Groq fallback chain)
  • Scheduled cron jobs to fetch news and update knowledge base
  • "Last verified" timestamps on AI-generated answers
  • Wikipedia/Wolfram Alpha enrichment for factual questions
  • DuckDuckGo Instant Answer integration for quick lookups
  • Markdown support for questions and answers
  • User reputation system based on community voting

Installation

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (v4.4 or higher)
  • Git

Setup

# Clone the repository
git clone https://github.com/Basant1Saini/Ask_Me_Anything.git
cd Ask_Me_Anything

# Install all dependencies (backend + frontend)
npm run install-all

# Set up environment variables
cp backend/.env.example backend/.env
# Edit backend/.env with your values:
#   MONGODB_URI=mongodb://localhost:27017/ask_me_anything
#   JWT_SECRET=your_secret_key
#   GEMINI_API_KEY=your_free_gemini_key  (get from https://aistudio.google.com/apikey)
#   NEWS_API_KEY=your_newsapi_key        (get from https://newsapi.org)

# Start both backend and frontend
npm run dev

Backend runs on http://localhost:5000, frontend on http://localhost:3000.

Usage

  1. Open http://localhost:3000 in your browser
  2. Register a new account or login
  3. Ask any question — the AI engine will suggest answers using free APIs
  4. Browse questions and contribute your own answers
  5. Vote on answers to surface the best ones
  6. The platform auto-updates answers as new real-world events occur

API Endpoints

Authentication

  • POST /api/auth/register — Register new user
  • POST /api/auth/login — Login and get JWT token
  • GET /api/auth/profile — Get authenticated user profile

Questions

  • GET /api/questions — List questions (supports ?search=, ?category=, ?sort=, ?page=, ?limit=)
  • POST /api/questions — Create question (auth required)
  • GET /api/questions/:id — Get question with answers
  • PUT /api/questions/:id — Update own question (auth required)
  • DELETE /api/questions/:id — Delete own question (auth required)

Answers

  • POST /api/questions/:questionId/answers — Add answer to question (auth required)
  • PUT /api/answers/:id — Update own answer (auth required)
  • DELETE /api/answers/:id — Delete own answer (auth required)
  • POST /api/answers/:id/vote — Upvote or downvote an answer (auth required)

Users

  • GET /api/users/:id — Get public user profile
  • PUT /api/users/:id — Update own profile (auth required)

AI (Planned)

  • POST /api/ai/ask — Get AI-generated answer for a question
  • GET /api/ai/news-feed — Get latest news relevant to platform topics
  • POST /api/ai/refresh — Trigger answer refresh based on new events

Project Structure

Ask_Me_Anything/
├── backend/
│   ├── config/
│   │   └── database.js          # MongoDB connection
│   ├── controllers/
│   │   ├── authController.js     # Register, login, profile
│   │   ├── questionController.js # CRUD for questions
│   │   ├── answerController.js   # CRUD + voting for answers
│   │   └── userController.js     # User profile management
│   ├── middleware/
│   │   ├── auth.js               # JWT verification
│   │   └── errorHandler.js       # Centralized error handling
│   ├── models/
│   │   ├── User.js               # User schema with password hashing
│   │   ├── Question.js           # Question schema with votes & tags
│   │   └── Answer.js             # Answer schema with voting
│   ├── routes/
│   │   ├── auth.js               # Auth routes with validation
│   │   ├── questions.js          # Question + nested answer routes
│   │   ├── answers.js            # Answer update/delete/vote routes
│   │   └── users.js              # User profile routes
│   ├── utils/
│   │   └── helpers.js
│   ├── .env.example
│   ├── package.json
│   └── server.js                 # Express app entry point
├── frontend/
│   ├── src/
│   │   ├── components/
│   │   │   ├── Navbar.jsx        # Auth-aware navigation
│   │   │   ├── Footer.jsx
│   │   │   └── ProtectedRoute.jsx
│   │   ├── pages/
│   │   │   ├── Home.jsx          # Landing page
│   │   │   ├── Questions.jsx     # Browse + search questions
│   │   │   ├── QuestionDetail.jsx# View question + answers
│   │   │   ├── AskQuestion.jsx   # Create question form
│   │   │   ├── Login.jsx
│   │   │   ├── Register.jsx
│   │   │   ├── Profile.jsx       # User dashboard
│   │   │   └── NotFound.jsx
│   │   ├── redux/
│   │   │   ├── store.js
│   │   │   └── slices/
│   │   │       ├── authSlice.js
│   │   │       ├── questionSlice.js
│   │   │       └── answerSlice.js
│   │   ├── services/
│   │   │   ├── authService.js
│   │   │   ├── questionService.js
│   │   │   └── answerService.js
│   │   ├── App.jsx
│   │   ├── main.jsx
│   │   └── index.css
│   ├── index.html
│   ├── tailwind.config.js
│   ├── vite.config.js
│   └── package.json
├── docs/
│   └── API.md
├── .gitignore
├── package.json
├── CONTRIBUTING.md
├── LICENSE
└── README.md

Roadmap

  • Backend REST API with full CRUD
  • JWT authentication system
  • React frontend with Redux state management
  • Question browsing, searching, and filtering
  • Answer and voting system (backend)
  • AI answer generation via Google Gemini free tier
  • Fallback to Hugging Face / Groq when Gemini quota is exhausted
  • News API integration for real-time event awareness
  • Cron-based auto-update pipeline for stale answers
  • Wikipedia + Wolfram Alpha enrichment layer
  • Answer submission and voting UI on frontend
  • Edit/delete UI for questions and answers
  • Markdown rendering for rich content
  • User reputation scoring
  • Docker setup for easy deployment

Contributing

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

See CONTRIBUTING.md for detailed guidelines.

License

This project is licensed under the MIT License — see LICENSE for details.

Contact


Made with determination by Basant Saini

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors