A modern file picker interface for Google Drive integration with knowledge base indexing capabilities. Built as part of the Stack AI take-home assessment.
Try it now: https://stack-ai-take-home-1nbp2x0ib-shreyashkguptas-projects.vercel.app
This application provides a file management interface similar to Finder (macOS) or File Explorer (Windows) for Google Drive files. Users can browse, select, and index files into knowledge bases while maintaining a clean, intuitive user experience.
- π File Browser: Navigate through Google Drive folders with hierarchical accordion-style expansion
- π Search & Filter: Real-time search by filename with debounced input
- π Sorting: Sort files by name, modification date, or size
- β Selection Management: Multi-select files with bulk operations
- ποΈ Knowledge Base Integration: Index/de-index files for knowledge base creation
- β‘ Performance Optimized: SWR caching, optimistic updates, and proper loading states
- Framework: Next.js 15.1.8 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS + shadcn/ui components
- Data Fetching: SWR for caching and state management
- State Management: React hooks + SWR (no external state management needed)
- UI Components: Radix UI primitives via shadcn/ui
- Icons: Lucide React
- Notifications: Sonner (toast notifications)
- Table Management: TanStack Table v8
- Node.js 18+
- npm or yarn
- Clone the repository
git clone https://github.com/shreyashkgupta/stack-ai-take-home.git
cd stack-ai-take-home/frontend- Install dependencies
npm install- Set up environment variables
Create a .env.local file in the frontend directory:
# Authentication & API Configuration
NEXT_PUBLIC_SUPABASE_AUTH_URL=https://sb.stack-ai.com
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNiLXN0YWNrLWFpIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzQ5NzI4MDAsImV4cCI6MjA1MDU0ODgwMH0.example
NEXT_PUBLIC_DEFAULT_EMAIL=stackaitest@gmail.com
NEXT_PUBLIC_DEFAULT_PASSWORD=!z4ZnxkyLYs#vR
NEXT_PUBLIC_API_URL=https://api.stack-ai.com
NEXT_PUBLIC_DEFAULT_CONNECTION_ID=e171b021-8c00-4c3f-8a93-396095414f57Note: These credentials are provided in the take-home instructions and are safe to include as they're specifically created for this assessment.
- Run the development server
npm run dev- Open your browser Navigate to http://localhost:3000
npm run build
npm run startfrontend/
βββ app/ # Next.js App Router
β βββ globals.css # Global styles and CSS variables
β βββ layout.tsx # Root layout with providers
β βββ page.tsx # Main application page
βββ components/
β βββ file-picker/ # Core file picker components
β β βββ index.tsx # Main FilePicker component
β β βββ file-table.tsx # Data table with sorting/filtering
β β βββ file-icon.tsx # File type icons
β β βββ table-header.tsx # Sortable column headers
β βββ ui/ # Reusable UI components (shadcn/ui)
βββ lib/
β βββ api.ts # API client and endpoints
β βββ auth.ts # Authentication utilities
β βββ hooks.ts # Custom React hooks
β βββ utils.ts # Utility functions
βββ providers/
β βββ auth-provider.tsx # Authentication context
βββ types/
β βββ api.ts # API response types
β βββ auth.ts # Authentication types
βββ public/ # Static assets
- Why: Latest Next.js features, better performance, and improved developer experience
- Benefits: Server components, improved routing, and better SEO capabilities
- Why: Excellent caching, background revalidation, and optimistic updates
- Benefits: Automatic request deduplication, focus revalidation, and offline support
- Implementation: Custom hooks in
lib/hooks.tsfor resource management
- Hierarchical Design:
FilePickerβFileTableβTableHeader+ individual cells - Separation of Concerns: Each component has a single responsibility
- Reusability: UI components are abstracted and reusable
- Local State: React hooks for component-specific state
- Server State: SWR for API data caching and synchronization
- Global State: Context API for authentication (minimal global state)
- Memoization:
useCallbackanduseMemofor expensive operations - Debounced Search: 300ms debounce for search input
- Optimistic Updates: Immediate UI feedback before API confirmation
- Efficient Re-renders: Careful dependency management to minimize unnecessary updates
- Problem: Original nested table navigation was confusing
- Solution: Expandable folders with indentation to show hierarchy
- Benefit: Users can see file structure at a glance
- Folder Selection: Automatically selects all files within folders
- File-Only Indexing: Only files can be indexed, not folders
- Visual Feedback: Clear indication of selection state and indexing status
- Toast Notifications: Immediate feedback for all user actions
- Error Recovery: Graceful handling of API failures
- Loading States: Professional loading indicators for ongoing operations
- RESTful Design: Clean API client with typed responses
- Authentication: JWT token management with automatic refresh
- Error Handling: Comprehensive error handling with user-friendly messages
- Tailwind CSS: Utility-first CSS for rapid development
- shadcn/ui: High-quality, accessible components
- Design System: Consistent spacing, colors, and typography
- Desktop-First: Optimized for desktop file management workflows
- Hierarchical folder structure with accordion expansion
- Real-time loading of folder contents
- Breadcrumb navigation (ready for implementation)
- Debounced search input (300ms delay)
- Real-time filtering of visible results
- Search across file names and paths
- Multi-select with checkboxes
- Bulk operations (index/de-index multiple files)
- Smart folder selection (selects all contained files)
- File indexing with progress tracking
- Status indicators (indexed/pending/failed)
- Polling for indexing completion
- De-indexing capabilities
The application is deployed on Vercel with automatic deployments from the main branch.
Live URL: https://stack-ai-take-home-os7gsmerr-shreyashkguptas-projects.vercel.app
All required environment variables are configured in the Vercel dashboard for the production deployment.
- TypeScript: Full type safety throughout the application
- Custom Hooks: Reusable logic abstracted into hooks
- Component Composition: Small, focused components
- Error Boundaries: Graceful error handling
- Performance: Optimized re-renders and API calls