Skip to content

Abdulbasit110/nextjs-fastapi

Repository files navigation

AceAI

AceAI is a full-stack AI-powered application built with a Next.js frontend and a FastAPI backend. It provides features like document processing, AI-driven chat, quiz generation, note-taking, and web search.


Features

  • Document Upload: Upload documents (e.g., PDFs, text files) for AI processing.
  • AI-Powered Chat: Chat with context derived from uploaded documents.
  • Quiz and Notes Generation: Generate quizzes and notes from document content.
  • Web Search Agent: Perform web searches with AI-generated responses.
  • RAG (Retrieval Augmented Generation): Use AI to generate responses with context retrieval.

Project Structure

project-root/
├── app/                    # FastAPI backend
│   ├── core/               # Configurations and dependencies
│   ├── routers/            # API routes
│   ├── services/           # Business logic
│   ├── main.py             # FastAPI entry point
│   ├── requirements.txt    # Backend dependencies
├── app/                  # Next.js frontend routing
├── public/                 # Public assets (images, icons, etc.)
├── components/             # Reusable UI components
├── styles/                 # CSS for styling
├── next.config.js          # Next.js configuration
├── package.json            # Frontend dependencies and scripts
├── .env                    # Environment variables
└── README.md               # Documentation

Getting Started

Backend (FastAPI)

  1. Navigate to the backend directory:

    cd api
  2. Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate  # For Windows: venv\Scripts\activate
  3. Install backend dependencies:

    pip install -r requirements.txt
  4. Start the backend server:

    uvicorn app.main:app --reload

    The backend will run at http://127.0.0.1:8000.


Frontend (Next.js)

  1. Install frontend dependencies:

    npm install
  2. Start the Next.js development server:

    npm run dev

    The frontend will run at http://localhost:3000.


Environment Variables

Backend .env

Create a .env file in the root directory with the following variables:

OPENAI_API_KEY=your_openai_api_key
SERPAPI_API_KEY=your_serpapi_api_key
UPLOAD_DIRECTORY=uploads/

Frontend .env

Create a .env file in the root directory with:

NEXT_PUBLIC_BACKEND_URL=http://127.0.0.1:8000/

Deployment

Vercel (Frontend and Backend)

  1. Frontend: Deploy the Next.js app using the Vercel CLI:

    vercel --prod
  2. Backend: Configure vercel.json in the api/ directory:

    {
      "builds": [
        {
          "src": "main.py",
          "use": "@vercel/python"
        }
      ],
      "routes": [
        {
          "src": "/(.*)",
          "dest": "main.py"
        }
      ]
    }

    Deploy the FastAPI backend:

    vercel --prod

About

ACE AI - Multi Agent RAG, one stop exam preparation applicaiton for students powered by langchain, vercel ai sdk, openai, fastapi, pinecone and nextjs

Topics

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors