Skip to content

Rikuron/Noctua_AI_App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

69 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦‰ Noctua AI

Noctua AI Logo

An intelligent AI-powered study companion for MSU-IIT students

Live Demo: https://noctua-ai-app.vercel.app

Features β€’ Tech Stack β€’ Getting Started β€’ Configuration β€’ Structure


🌟 Features

πŸ“š Smart Workspaces

  • Create & Organize: Build personalized study workspaces for different subjects or topics
  • Document Management: Upload, view, and organize PDF materials within each workspace
  • Quick Search: Find your workspaces instantly with search and filter capabilities
  • Customizable: Add icons, names, and descriptions to personalize your workspaces

πŸ€– AI-Powered Learning

  • Intelligent Chat: Ask questions about your uploaded documents with context-aware responses
  • Auto-Summarization: Generate comprehensive summaries of your study materials
  • Smart Flashcards: Generate study flashcards from your materials
  • Interactive Quizzes: Test your knowledge with AI-generated quizzes
  • Instant Presentations: Create educational slide decks in seconds
  • Gemini Integration: Powered by Google's Gemini 2.0 Flash model for fast, accurate answers
  • Chat History: Persistent conversation history with markdown support

πŸ“„ Advanced Document Management

  • Multi-Format Support: Support for PDF, DOCX, TXT, and Markdown files
  • Material Repository: Centralized hub for all your study documents
  • Built-in PDF Viewer: View documents directly in the browser
  • Text Extraction: Automatic text extraction for AI processing
  • Flexible Exports: Download content as PDF, Markdown, or Text
  • Batch Upload: Drag-and-drop multiple files at once
  • Smart Metadata: Track file size, upload dates, and source organization

πŸ” Secure & Personalized

  • Firebase Authentication: Secure Google sign-in for MSU-IIT students
  • User Isolation: Each user's data is completely private and isolated
  • Real-time Sync: Changes sync instantly across all your devices
  • Firestore Database: Reliable cloud storage for all your materials

🎨 Beautiful Design

  • Modern Dark Theme: Easy on the eyes with gradient accents
  • Fully Responsive: Optimized experience on mobile, tablet, and desktop
  • Smooth Animations: Polished interactions and transitions
  • Custom Components: Tailored UI elements for the best user experience

πŸ› οΈ Admin Tools

  • Admin Dashboard: Overview of all notebooks and sources
  • Data Management: Easy cleanup and organization tools
  • Debug Interface: Monitor application state and health

πŸš€ Tech Stack

Frontend

  • React 19 - Latest React with concurrent features
  • TypeScript - Type-safe development
  • Vite 7 - Lightning-fast build tool and dev server
  • TanStack Router - Type-safe routing with file-based routes
  • Tailwind CSS 4.0 - Utility-first CSS framework

Backend & Services

  • Firebase
    • Authentication - Secure Google OAuth
    • Firestore - NoSQL cloud database
    • Storage - Cloud file storage for PDFs
  • Google Gemini AI - Advanced language model (Gemini 2.0 Flash)
  • Vercel Functions - Serverless API endpoints

Libraries & Tools

  • PDF.js - PDF rendering and text extraction
  • React Markdown - Markdown rendering with GFM support
  • React Dropzone - File upload with drag-and-drop
  • Lucide React - Beautiful icon set
  • Vitest - Fast unit testing framework

πŸ“‹ Prerequisites

Before you begin, ensure you have:

  • Node.js 18+ and npm (or yarn/pnpm)
  • Firebase Project - Create one here
  • Google Gemini API Key - Get one here
  • MSU-IIT Email - For authentication (or configure your own domain)

πŸ› οΈ Getting Started

1. Clone the Repository

git clone <repository-url>
cd noctua-ai-app

2. Install Dependencies

npm install

3. Configure Environment Variables

Create a .env file in the root directory:

# Firebase Configuration
VITE_FIREBASE_API_KEY=your_firebase_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project_id.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project_id.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id
VITE_FIREBASE_APP_ID=your_firebase_app_id

# Google Gemini AI
GEMINI_API_KEY=your_gemini_api_key

4. Set Up Firebase

Authentication

  1. Go to Firebase Console β†’ Authentication β†’ Sign-in method
  2. Enable Google provider
  3. Configure authorized domains (add your local and production URLs)
  4. (Optional) Set up domain restrictions for @g.msuiit.edu.ph emails

Firestore Database

  1. Create a Firestore database in production mode
  2. Add these security rules:
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    // User-specific notebooks
    match /users/{userId}/notebooks/{notebookId} {
      allow read, write: if request.auth != null && request.auth.uid == userId;
      
      // Sources within notebooks
      match /sources/{sourceId} {
        allow read, write: if request.auth != null && request.auth.uid == userId;
      }
      
      // Summaries
      match /summaries/{summaryId} {
        allow read, write: if request.auth != null && request.auth.uid == userId;
      }
      
      // Chat history
      match /chats/{chatId} {
        allow read, write: if request.auth != null && request.auth.uid == userId;
      }
    }
  }
}

Firebase Storage

  1. Go to Storage β†’ Rules
  2. Add these security rules:
rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /users/{userId}/{allPaths=**} {
      allow read, write: if request.auth != null && request.auth.uid == userId;
    }
  }
}

5. Run the Development Server

npm run dev

The app will be available at http://localhost:3003 πŸŽ‰


πŸƒβ€β™‚οΈ Available Scripts

# Development
npm run dev              # Start dev server on port 3003

# Building
npm run build           # Build for production

# Preview
npm run serve           # Preview production build

# Testing
npm run test            # Run unit tests

# Router
npm run generate        # Generate TanStack Router routes

πŸ—οΈ Project Structure

noctua-ai-app/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ api/                    # API handlers
β”‚   β”‚   └── gemini.ts          # Gemini AI integration
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ cards/             # Reusable card components
β”‚   β”‚   β”‚   β”œβ”€β”€ MaterialCard.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ NotebookCard.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ SourceCard.tsx
β”‚   β”‚   β”‚   └── StudioCard.tsx
β”‚   β”‚   β”œβ”€β”€ sections/          # Page sections
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatArea.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MobileTabs.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ NotebookHeader.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ SourcesSidebar.tsx
β”‚   β”‚   β”‚   └── StudioSidebar.tsx
β”‚   β”‚   β”œβ”€β”€ ui/                # UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ AppLoader.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ CustomUserButton.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ErrorMessage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MarkdownContent.tsx
β”‚   β”‚   β”‚   └── Modal.tsx
β”‚   β”‚   β”œβ”€β”€ authProvider.tsx   # Auth context
β”‚   β”‚   β”œβ”€β”€ navigation.tsx     # Main navigation
β”‚   β”‚   β”œβ”€β”€ pdfViewer.tsx      # PDF viewer component
β”‚   β”‚   └── signIn.tsx         # Sign-in component
β”‚   β”œβ”€β”€ hooks/                 # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ useAutoScrollToLatestChat.ts
β”‚   β”‚   β”œβ”€β”€ useChatHistory.ts
β”‚   β”‚   β”œβ”€β”€ useFirebaseAuth.ts
β”‚   β”‚   β”œβ”€β”€ useGlobalPdfs.ts
β”‚   β”‚   β”œβ”€β”€ useNotebooks.ts
β”‚   β”‚   β”œβ”€β”€ useNotebookSources.ts
β”‚   β”‚   └── usePDFs.ts
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ firestore/         # Firestore operations
β”‚   β”‚   β”‚   β”œβ”€β”€ chats.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ flashcards.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ notebook.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ presentations.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ quizzes.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ sources.ts
β”‚   β”‚   β”‚   └── summaries.ts
β”‚   β”‚   β”œβ”€β”€ gemini.ts          # Gemini AI client
β”‚   β”‚   β”œβ”€β”€ fileExtractor.ts   # Universal file text extraction
β”‚   β”‚   └── pdfExtractor.ts    # PDF text extraction
β”‚   β”œβ”€β”€ utils/                 # Utility functions
β”‚   β”‚   β”œβ”€β”€ download.ts        # File download helpers
β”‚   β”‚   └── formatters.ts      # Data formatting helpers
β”‚   β”œβ”€β”€ routes/                # TanStack Router routes
β”‚   β”‚   β”œβ”€β”€ __root.tsx         # Root layout
β”‚   β”‚   β”œβ”€β”€ index.tsx          # Workspaces homepage
β”‚   β”‚   β”œβ”€β”€ notebook.$notebookId.tsx  # Notebook detail
β”‚   β”‚   β”œβ”€β”€ repository.tsx     # Material repository
β”‚   β”‚   β”œβ”€β”€ admin.tsx          # Admin dashboard
β”‚   β”‚   └── sign-in.tsx        # Authentication
β”‚   β”œβ”€β”€ types/                 # TypeScript definitions
β”‚   β”‚   β”œβ”€β”€ chat.ts
β”‚   β”‚   β”œβ”€β”€ flashcard.ts
β”‚   β”‚   β”œβ”€β”€ notebook.ts
β”‚   β”‚   β”œβ”€β”€ presentation.ts
β”‚   β”‚   β”œβ”€β”€ quiz.ts
β”‚   β”‚   β”œβ”€β”€ source.ts
β”‚   β”‚   └── summary.ts
β”‚   β”œβ”€β”€ firebase.ts            # Firebase initialization
β”‚   β”œβ”€β”€ formatters.ts          # Utility formatters
β”‚   β”œβ”€β”€ main.tsx               # App entry point
β”‚   └── styles.css             # Global styles
β”œβ”€β”€ public/                    # Static assets
β”œβ”€β”€ .env                       # Environment variables
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ vite.config.ts
└── README.md

🎨 Design System

Color Palette

--background-dark: #0f0f0f
--background-primary: #1a1a1a
--blue-primary: #2A88D8
--blue-accent: #3b82f6
--purple-accent: #5D35B3
--text-primary: #ffffff
--text-secondary: #9ca3af
--border-subtle: #374151

Key Components

  • Workspaces Grid: Responsive card layout with hover effects
  • PDF Viewer: Full-screen modal with zoom and navigation
  • Chat Interface: Message bubbles with markdown rendering
  • Upload Modal: Drag-and-drop with progress indicators
  • Navigation: Bottom mobile nav, sidebar on desktop

πŸ”§ Configuration

Firestore Collections Structure

users/{userId}/
  └── notebooks/{notebookId}/
      β”œβ”€β”€ name: string
      β”œβ”€β”€ description: string
      β”œβ”€β”€ icon: string
      β”œβ”€β”€ createdAt: timestamp
      └── updatedAt: timestamp
      
      └── sources/{sourceId}/
          β”œβ”€β”€ name: string
          β”œβ”€β”€ type: 'pdf'
          β”œβ”€β”€ url: string
          β”œβ”€β”€ size: number
          β”œβ”€β”€ uploadedAt: timestamp
          └── extractedText: string
      
      └── summaries/{summaryId}/
          β”œβ”€β”€ sourceIds: string[]
          β”œβ”€β”€ summary: string
          └── createdAt: timestamp
      
      └── chats/{chatId}/
          β”œβ”€β”€ role: 'user' | 'assistant'
          β”œβ”€β”€ content: string
          └── timestamp: timestamp

Firebase Storage Structure

users/{userId}/
  └── pdfs/{pdfId}.pdf

πŸ§ͺ Testing

# Run tests
npm run test

# Run tests in watch mode
npm run test -- --watch

# Run tests with coverage
npm run test -- --coverage

πŸš€ Deployment

Recommended: Vercel

  1. Push your code to GitHub
  2. Import project in Vercel
  3. Add environment variables
  4. Deploy!

Environment Variables in Production

Make sure to set all the environment variables from the .env file in your hosting platform.

Build Command

npm run build

Output Directory

dist/

πŸ” Security Best Practices

  • βœ… Firebase Security Rules - Properly configured for user isolation
  • βœ… Environment Variables - Sensitive keys never committed
  • βœ… Authentication - Required for all protected routes
  • βœ… Input Validation - Sanitized user inputs
  • βœ… CORS - Configured for production domains

πŸ› Troubleshooting

Firebase Permission Denied

  • Ensure Firestore security rules are properly set
  • Verify user is authenticated
  • Check that userId matches in the path

PDF Upload Fails

  • Check Firebase Storage rules
  • Verify Storage bucket is configured
  • Ensure file size is under Firebase limits (default: 10MB)

AI Not Responding

  • Verify GEMINI_API_KEY is set correctly
  • Check API quota in Google AI Studio
  • Ensure PDF text extraction completed

Build Errors

# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm install

# Clear Vite cache
rm -rf .vite node_modules/.vite

🀝 Contributing

We welcome contributions! Here's how to get started:

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

Development Guidelines

  • Follow TypeScript best practices
  • Write tests for new features
  • Update documentation as needed
  • Follow the existing code style

πŸ“„ License

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


πŸ†˜ Support & Contact

  • πŸ“§ Email: Your support email
  • πŸ› Bug Reports: Create an issue
  • πŸ’‘ Feature Requests: Open a discussion
  • πŸ“š Documentation: Check the /docs folder

πŸ—ΊοΈ Roadmap

Coming Soon

  • Mobile app (React Native)
  • Voice input and output
  • Collaborative workspaces
  • Export notes as PDF/Markdown
  • Advanced search with filters
  • Flashcard generation
  • Study progress tracking

Under Consideration

  • Integration with LMS systems
  • Offline mode support
  • Browser extension
  • Multi-language support
  • Advanced AI models (GPT-4, Claude)

πŸ™ Acknowledgments

  • MSU-IIT for the inspiration
  • Google Gemini for AI capabilities
  • Firebase for backend infrastructure
  • Vercel for hosting
  • Built with ❀️ for LAV and Sir Lua

πŸ“Š Performance

  • ⚑ Lighthouse Score: 95+ across all metrics
  • πŸš€ Build Time: ~30 seconds
  • πŸ“¦ Bundle Size: ~500KB (gzipped)
  • πŸ”„ Hot Reload: <50ms

Made with ❀️ and β˜• by the Noctua AI Team

Back to top ⬆️

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors