A FastAPI-based asynchronous file management system with a modern, responsive frontend for browsing, uploading, downloading, and previewing files.
- Directory Navigation: List and navigate through directories with breadcrumbs.
- File Operations: Upload, download, and stream files with range request support.
- File Previews: Preview images, videos, audio, text, PDFs, and more in a modal.
- Responsive UI: Tailwind CSS and HTMX for a dynamic, mobile-friendly interface with glassmorphism design.
- MIME Type Detection: Enhanced MIME type detection for various file formats.
- Streaming Support: Efficient file streaming for large files with partial content delivery.
- Error Handling: Robust logging and error responses for invalid paths or operations.
- Python 3.8+
- FastAPI
- aiofiles
- humanize
- pydantic
- uvicorn
- Clone the repository:
git clone https://github.com/MohammadrezaAmani/simple-file-browser cd simple-file-browser
- Install dependencies:
or
pip install fastapi uvicorn aiofiles humanize pydantic
pip install uv
uv sync
- Run the application:
or
uvicorn main:app --reload
uv uvicorn main:app --reload
- Access the file manager at
http://localhost:8000
. - Navigate directories, upload files, download files, or preview supported file types.
- API endpoints:
GET /api/list/{path}
: List directory contents.GET /api/view/{path}
: Stream file content with range support.GET /api/download/{path}
: Download a file.POST /api/upload/{path}
: Upload a file to the specified directory.
- Built with Tailwind CSS for styling and HTMX for dynamic updates.
- Features a modal for file previews and a sortable file table for desktop users.
- Mobile-friendly card layout for smaller screens.
- The application serves files from the root directory (
/
). Ensure proper permissions. - Add authentication by uncommenting the
Depends(security)
in endpoints if needed. - Large file uploads and downloads are handled efficiently with async I/O.
MIT License