How chitrangi25/notes-ai works
Project type and purpose
• This is a full-stack web application built with Next.js 13 (the “app” directory API).
• Purpose: allow users to submit text for AI-powered summarization, authenticate via Firebase, and then view saved summaries.
File structure
• app/
• layout.tsx, globals.css – global layout and styles
• page.tsx – home page
• summarize/page.tsx – form/UI to submit text for summarization
• summary/[textId]/page.tsx – dynamic route to view a saved summary
• components/
• Reusable UI pieces (Hero, Navbar, Tabs, Dialog, etc.)
• config/
• AIConfig.ts – credentials and endpoints for the AI summarization service
• firebaseconfig.ts – Firebase project settings (Auth + Firestore)
• hooks/useGetUserInfo.ts – custom React hook to retrieve the authenticated user’s profile
• lib/utils.ts – helper functions (e.g., wrappers around fetch, error handling)
• next.config.ts, tsconfig.json, package.json, postcss.config.mjs, public/ – build, lint, deploy, and static-assets config
README
• Key dependencies: React, Next.js (app router), Firebase, an AI service (e.g., OpenAI), and Next’s built-in font/loading optimizations.
Main components
a. Client Browser (User’s device)
b. Next.js Application (deployed on Vercel or similar)
• React Server Components (pages in app/)
• React Client Components (components/ & hooks/)
c. Firebase (Authentication & Firestore Database)
d. External AI Summarization Service (via AIConfig.ts)
e. Utility Layer (lib/utils.ts)
Relationships & data flows
• User → Browser UI → Next.js (Client Components in components/)
• Next.js Router (app/summarize/page.tsx) → invokes server-side logic (lib/utils + AIConfig) → communicates with AI service → returns summarized text
• Summarized text → optionally written to Firestore via Firebase SDK (firebaseconfig + hooks/useGetUserInfo)
• User navigates to /summary/[textId] → Next.js Server Component fetches summary from Firestore → renders page
Highlighted architectural patterns
• Hybrid rendering:
• Server-Side Rendering (SSR) for initial page loads and data-fetching pages (summary/[textId])
• Client-Side Rendering (CSR) for interactive components, dialogs, tabs
• Separation of concerns:
• config/ holds external-service setup
• lib/ holds utilities
• hooks/ encapsulate React-specific logic