A React-based document management system with drag-and-drop functionality and automatic saving.
- 📱 Responsive grid layout
- 🖱️ Drag and drop reordering
- 🖼️ Image preview overlay
- 💾 Automatic saving
- 🔄 Loading states and indicators
- React 18
- TypeScript
- Tailwind CSS
- DND Kit (drag and drop)
- MSW (API mocking)
- Docker
src/
├── components/ # React components
├── hooks/ # Custom React hooks
├── lib/ # Utilities and API
├── mocks/ # MSW mock service
├── types/ # TypeScript types
└── App.tsx # Main application
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Build and start the container:
docker-compose up -d
-
Access the application at
http://localhost
The application follows a component-based architecture with React:
- App.tsx: Main component handling state management and layout
- DocumentGrid: Manages the grid display and drag-and-drop functionality
- DocumentCard: Individual document display with loading states
- ImageOverlay: Modal for displaying enlarged images
- Uses React's built-in state management with hooks
useRef
for tracking changes without triggering re-renders- Automatic saving implemented with
useEffect
andsetInterval
The application uses a RESTful API with two main endpoints:
GET /api/documents
// Returns array of documents
// No parameters required
// Response: Document[]
POST /api/documents
// Saves updated document array
// Body: Document[]
// Response: { success: boolean }
In development:
- Uses MSW (Mock Service Worker) to intercept API calls
- Data persisted in localStorage
- Automatic saving every 5 seconds when changes detected
- Add document creation/deletion functionality
- Implement user authentication
- Add search and filtering capabilities
- Implement real-time collaboration
- Add image upload functionality
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
To deploy the application:
Make sure Docker and Docker Compose are installed on your system. Then, build and start the containers:
docker-compose up -d
The application will be available at http://localhost