Skip to content

chanceDira/dms-frontend

Repository files navigation

Document Management System - Frontend

A modern, feature-rich frontend application for document management built with Next.js 16. This application provides a Google Drive-like experience with document organization, sharing, search, and preview capabilities.

πŸš€ Features

  • Authentication: Secure sign-in/sign-up with email/password and OAuth (Google, GitHub)
  • Document Management: Upload, download, organize, rename, and delete documents
  • Folder System: Create, navigate, and manage hierarchical folders
  • Document Preview: Inline preview for PDFs and images
  • PDF Splitting: Split PDF documents into individual pages
  • Sharing: Share documents and folders with email-based permissions
  • Search: Global search with ⌘K shortcut and suggestions
  • Multiple Views: Toggle between table and grid (card) layouts
  • Trash Management: View, restore, and permanently delete trashed items
  • Filtering & Sorting: Filter by file type/status and sort by various criteria
  • Responsive Design: Mobile-friendly interface

πŸ› οΈ Technology Stack

πŸ“‹ Prerequisites

  • Node.js (v18 or higher)

πŸ”§ Installation

  1. Clone the repository

    git clone <repository-url>
    cd dms-be/dms_frontend
  2. Install dependencies

    npm install
  3. Set up environment variables Create a .env.local file in the root directory:

    NEXT_PUBLIC_API_URL=http://localhost:4000

πŸƒ Running the Application

Development Mode

npm run dev

The application will be available at http://localhost:8000

Production Mode

# Build the application
npm run build

# Start production server
npm run start

🎨 Key Features

Authentication

  • Email/password authentication
  • OAuth with Google and GitHub
  • Protected routes via Next.js middleware
  • Session management

Document Management

  • Upload: Drag & drop or click to upload files
  • View Modes: Toggle between table and grid views
  • Actions: Download, rename, move, share, split (PDFs), preview, delete
  • Pagination: Server-side pagination
  • Filtering: By file type and status
  • Sorting: By date, name, size

Folder System

  • Create nested folders
  • Navigate with breadcrumbs
  • Move documents/folders between folders
  • View folder contents

Document Preview

  • PDF preview in iframe
  • Image preview with zoom controls
  • Download fallback for unsupported types

PDF Splitting

  • Trigger PDF split jobs
  • View processing status
  • Download individual pages
  • List all split pages

Sharing

  • Share documents/folders by email
  • Set permissions (VIEW/EDIT)
  • View shared items
  • Manage access (revoke)

Search

  • Global search with ⌘K shortcut
  • Real-time suggestions
  • Search results page
  • Filter by folder and file type

Trash

  • View trashed documents and folders
  • Restore items
  • Permanently delete items
  • Empty trash

🎯 Usage

Keyboard Shortcuts

  • ⌘K / Ctrl+K: Open global search

Uploading Documents

  1. Click "Upload" button or use drag & drop
  2. Select files (max 100MB per file)
  3. Files are uploaded to S3 and metadata is saved
  4. Confirm upload to mark as ready

Organizing Documents

  1. Create folders using "New Folder" button
  2. Move documents using "Move to..." action
  3. Navigate folders by clicking on them

Sharing Documents

  1. Click "Share" on a document or folder
  2. Enter email address
  3. Select permission level (VIEW/EDIT)
  4. Manage access from the share dialog

Splitting PDFs

  1. Open a PDF document
  2. Click "Split PDF" from the menu
  3. Wait for processing to complete
  4. Download individual pages

πŸ”’ Security

  • All API requests include authentication cookies
  • Protected routes redirect to sign-in if not authenticated
  • CORS configured on backend
  • Input validation on forms

πŸ§ͺ Development

Code Structure

  • Feature-based architecture: Each feature has its own folder with components, queries, mutations, and services
  • Shared components: Reusable UI components in components/shared
  • Type safety: Full TypeScript coverage
  • Form validation: Zod schemas for all forms

Adding a New Feature

  1. Create feature folder in features/
  2. Add service, queries, mutations, and components
  3. Create page in app/(dashboard)/ if needed
  4. Add navigation item in sidebar if needed

πŸ“ Environment Variables

  • NEXT_PUBLIC_API_URL: Backend API URL (default: http://localhost:4000)

πŸš€ Deployment

  1. Set NEXT_PUBLIC_API_URL to production API URL
  2. Build the application: npm run build
  3. Start the server: npm run start

For Vercel deployment:

vercel

πŸ› Troubleshooting

CORS Errors

Ensure backend CORS is configured to allow your frontend origin.

Authentication Issues

Check that NEXT_PUBLIC_API_URL matches your backend URL.

Build Errors

Clear .next folder and rebuild:

rm -rf .next
npm run build

πŸ‘€ Author

Chance Desire

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages