My Svelte learning project that serves static files.
- Provides responsive web file browser.
- Sends the web UI or the file depending on the
Accept
header.- This means that in the browser you'll have UI but if you send the same link to Discord or
wget
you'll get the file itself.
- This means that in the browser you'll have UI but if you send the same link to Discord or
- Finds correct mime type according to the file's extension or it's magic number.
- Caches magic number results in SQLite for performance.
- Static files are streamed.
- Prerenders pages in dark/light mode according to cookie.
- Generates thumbnails in various sizes for images and videos.
- Automatically prunes its cache at given time.
- Automatically invalidate cache on file changes.
- Tailwind CSS
- Svelte (of course)
- SvelteKit
- Sharp
- Prisma
- PNPM (optimally)
- Node v16 to v18
- FFmpeg for thumbnails of videos or unsupported images (optional; won't generate thumbnails for those without ffmpeg)
pnpm install
to download dependencies- Configure
.env
, use.env.example
as a template pnpm build:db
to prepare the cache databasepnpm build
to build the app
- Start with
pnpm start
ornode .
- You can freely purge the
cache/thumbnails
folder if you feel like it - You shouldn't delete
cache/cache.db
while the app is running and you have to runpnpm build:db
if you delete it.
I made this project for myself and to learn Svelte. You probably shouldn't use it in production or elsewhere, but you can learn from it and use its parts in accordance to the license.
Copyright (C) 2022 Zhincore
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.