Skip to content

DiegoViillalba/Smart-Docs-

Repository files navigation

📄 Smart Docs

Intelligent document processing powered by LLM APIs — extract structured data from any document using OCR and AI, built with Next.js, TypeScript, and Firebase.

TypeScript Next.js Firebase LLM API MIT License


✨ Features

  • 🔍 AI-powered OCR — Extract text and structured data from images and PDFs using LLM vision APIs
  • Real-time processing — Live document processing status with Firebase Realtime updates
  • 🗂️ Document storage — Upload, organize, and retrieve processed documents via Firestore
  • 🧠 Structured extraction — Parse invoices, forms, and contracts into clean structured JSON output
  • 🔐 Auth & permissions — Firebase Authentication with role-based access to documents
  • 📱 Responsive UI — Works on desktop and mobile with a clean, intuitive interface

🏗️ Architecture

📄 Upload document
      ↓
🔥 Firebase Storage
      ↓
🧠 LLM API (vision model)
      ↓
📊 Structured JSON output
      ↓
🗄️ Firestore (save & retrieve)

🛠️ Tech Stack

Technology Role
Next.js 14 (App Router) React framework with server components and API routes
TypeScript End-to-end type safety across the entire codebase
Firebase Auth, Firestore, Storage, and Cloud Functions
LLM API (OpenAI / Anthropic / Gemini) Vision-capable language models for intelligent OCR extraction

🚀 Getting Started

Prerequisites

  • Node.js 18+
  • Firebase project configured
  • LLM API key (OpenAI, Anthropic, or Gemini)

Installation

# Clone the repository
git clone https://github.com/your-user/smart-docs.git
cd smart-docs

# Install dependencies
npm install

# Configure environment variables
cp .env.example .env.local

# Start development server
npm run dev

Open http://localhost:3000 in your browser.


🔑 Environment Variables

Create a .env.local file at the root of the project with the following variables:

# Firebase (client)
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id

# Firebase Admin SDK (server-side)
FIREBASE_ADMIN_PRIVATE_KEY=your_private_key
FIREBASE_ADMIN_CLIENT_EMAIL=your_client_email

# LLM API
LLM_API_KEY=your_llm_api_key
LLM_MODEL=gpt-4o   # or claude-3-5-sonnet, gemini-1.5-pro, etc.

📁 Project Structure

smart-docs/
├── app/                    # Next.js App Router
│   ├── api/                # API routes (OCR processing)
│   ├── dashboard/          # Document management UI
│   └── layout.tsx
├── components/             # Reusable React components
├── lib/
│   ├── firebase/           # Firebase client & admin config
│   └── llm/                # LLM API integration
├── types/                  # TypeScript type definitions
└── .env.example

🧪 Available Scripts

npm run dev        # Start development server
npm run build      # Build for production
npm run start      # Start production server
npm run lint       # Run ESLint
npm run typecheck  # Run TypeScript type check

🤝 Contributing

Contributions are welcome! Please open an issue first to discuss what you would like to change.

  1. Fork the project
  2. Create your 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

📄 License

MIT — free to use, modify, and distribute. See LICENSE for details.


Made with ❤️ using Next.js, Firebase & LLM APIs

About

Intelligent document processing powered by LLMs and OCR — extract structured data from documents using modern AI pipelines.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages