Skip to content

Latest commit

 

History

History
143 lines (105 loc) · 3.97 KB

File metadata and controls

143 lines (105 loc) · 3.97 KB

Document Manager for Reddit - Working App

✅ What's Working

A fully functional document management app built on Devvit that runs on Reddit!

Features

  1. Upload Documents

    • Upload images (PNG, JPG, JPEG, GIF, BMP) and PDFs
    • Max file size: 2MB
    • Preview before saving
  2. Add Descriptions & Notes

    • Required description for each document
    • Optional notes field for additional text/content
    • Perfect for manually adding text from documents
  3. View All Documents

    • Grid view of all uploaded documents
    • Click to view full details
    • Shows thumbnails, descriptions, and timestamps
  4. Document Details

    • Full-size image view
    • All metadata (filename, description, notes, upload date)
    • Delete functionality
  5. Redis Storage

    • All documents stored per-post in Redis
    • Keeps last 100 documents per post
    • Fast retrieval and persistence

How to Use

  1. Start the app:

    npm run dev
  2. Open the playtest URL in your browser (shown in terminal)

  3. Upload a document:

    • Click "Upload Document" tab
    • Select an image file
    • Add a description (required)
    • Add notes (optional) - this is where you can manually type text from the document
    • Click "Save Document"
  4. View your documents:

    • Click "My Documents" tab
    • See all uploaded documents in a grid
    • Click any document to view full details

Technical Details

  • Client: React with TypeScript, Tailwind CSS
  • Server: Express with Devvit APIs
  • Storage: Redis (per-post storage)
  • Authentication: Automatic via Reddit/Devvit

Why This Works (vs OCR)

The original OCR approach failed because:

  • External API calls (OCR.space) are blocked by Devvit
  • Client-side OCR libraries (tesseract-wasm) violate CSP with unsafe-eval
  • Devvit has strict security policies for external domains

This Document Manager works because:

  • No external API calls needed
  • All processing happens client-side (file reading) or server-side (Redis storage)
  • Users can manually add text content in the notes field
  • Fully compliant with Devvit's security model

Next Steps: Options B & C

Option B: OCR via Proxy Server

To add real OCR functionality, you would need to:

  1. Deploy your own backend API (e.g., on Vercel, Railway, or AWS Lambda)

    • This API would accept image uploads
    • Call OCR.space or Tesseract on the server
    • Return extracted text
  2. Request Devvit to whitelist your domain

    • Contact Reddit developers
    • Provide your API domain
    • Wait for approval
  3. Update the app to call your proxy instead of OCR.space directly

Pros: Real OCR functionality Cons: Requires infrastructure, costs, and Devvit approval

Option C: Other Devvit-Compatible Features

Instead of OCR, you could add:

  1. Image Filters/Effects

    • Client-side canvas manipulation
    • Brightness, contrast, rotation
    • No external APIs needed
  2. Document Categories/Tags

    • Organize documents by type
    • Search and filter functionality
    • All stored in Redis
  3. Sharing & Collaboration

    • Share documents with other Reddit users
    • Comments on documents
    • Use Devvit's Reddit API
  4. Export Functionality

    • Download all documents as ZIP
    • Export notes as text file
    • Generate PDF reports
  5. Document Templates

    • Pre-made templates for receipts, invoices, etc.
    • Fill-in forms
    • Save as documents
  6. Barcode/QR Code Scanner

    • Use browser APIs for scanning
    • No external services needed
    • Store scanned codes with documents

All of these work within Devvit's constraints and don't require external APIs!

Recommendation

For a production app, I'd suggest:

  • Keep the Document Manager as-is (it works great!)
  • Add categories/tags for organization
  • Add search functionality
  • Consider Option B (proxy server) only if OCR is absolutely critical
  • Focus on features that enhance the document management experience

The current app is fully functional and ready to use on Reddit!