Skip to content

Commit 18d8b8b

Browse files
committed
Release v0.1.0
1 parent 2802161 commit 18d8b8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+7216
-53
lines changed

.env.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Database credentials
2+
DATABASE_URL=postgresql://root:mysecretpassword@localhost:5432/snapsort
3+
POSTGRES_USER=root
4+
POSTGRES_PASSWORD=mysecretpassword
5+
6+
# Path to external binaries
7+
EXIFTOOL_PATH="/snap-sort/data/exiftool/exiftool.exe"
8+
FFMPEG_PATH="/snap-sort/data/ffmpeg/bin/ffmpeg.exe"
9+
10+
# Path to data storage
11+
FILE_UPLOAD_DIR="/snap-sort/data/uploaded-files"
12+
LIBRARY_ROOT_DIR="/snap-sort/data/library"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ node_modules
77
.wrangler
88
/.svelte-kit
99
/build
10+
/data
1011

1112
# OS
1213
.DS_Store

.idea/dataSources.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/dictionaries/project.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/prettier.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/snap-sort.iml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Tushar Bhatt
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 161 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,180 @@
1-
# sv
1+
# SnapSort
22

3-
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
3+
A very opinionated solution for a personal problem of organizing a photos/videos library. SnapSort helps you organize
4+
media files (images/videos) and edit metadata.
45

5-
## Creating a project
6+
## Features
67

7-
If you're seeing this, you've probably already done this step. Congrats!
8+
### Metadata Management
89

9-
```bash
10-
# create a new project in the current directory
11-
npx sv create
10+
- **Create Keywords**: Create different types of keywords (Album, Location, Person, Animal, Group, or Other) which can
11+
be used to tag files.
12+
- **Edit Metadata**: Modify capture date and time, title/descriptions, GPS data, and keywords for your media files.
13+
- **Batch Editing**: Apply metadata changes to multiple files at once, saving time and ensuring consistency.
14+
- **View Metadata**: View all metadata associated with your library files.
15+
- **EXIF Data Export**: Export metadata from your library files for backup or analysis.
16+
17+
### Library Organization
18+
19+
Media library is organized in a "Year / Month / Day" hierarchy. The Day folder may have a `- Keyword` suffix
20+
depending on whether any of the files within that folder contains a keyword which can be used as a folder label.
21+
22+
The files follow the following naming convention: `TYPE-YYYYMMDD-INDEX`
1223

13-
# create a new project in my-app
14-
npx sv create my-app
1524
```
25+
library/
26+
|- 2025/
27+
|- 01 - January/
28+
|- 01/
29+
|- IMG-20250101-000.jpg
30+
|- VID-20250101-000.mp4
31+
|- 02 - Birthday/
32+
|- IMG-20250102-000.jpg
33+
|- IMG-20250102-001.jpg
34+
```
35+
36+
## Prerequisites
37+
38+
- [Node.js](https://nodejs.org/) (v18 or later)
39+
- [PNPM](https://pnpm.io/) package manager
40+
- [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) (for PostgreSQL database)
41+
- [ExifTool](https://exiftool.org/) (for metadata manipulation)
42+
- [FFmpeg](https://ffmpeg.org/) (for video processing)
43+
44+
## Installation
45+
46+
1. Clone the repository:
47+
48+
```bash
49+
git clone https://github.com/bhatushar/snap-sort.git
50+
cd snap-sort
51+
```
52+
53+
2. Install dependencies:
54+
55+
```bash
56+
pnpm install
57+
```
58+
59+
3. Create a `.env` file based on the provided `.env.example`:
60+
61+
```bash
62+
cp .env.example .env
63+
```
1664

17-
## Developing
65+
4. Edit the `.env` file to configure your environment:
1866

19-
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
67+
- Set database credentials
68+
- Configure paths to ExifTool and FFmpeg
69+
- Set file storage directories
70+
71+
5. Start the PostgreSQL database using Docker:
72+
73+
```bash
74+
pnpm db:start
75+
```
76+
77+
6. Initialize the database:
78+
```bash
79+
pnpm db:push
80+
```
81+
82+
## Running the Application
83+
84+
### Development Mode
85+
86+
Run the application in development mode:
2087

2188
```bash
22-
npm run dev
89+
pnpm dev
90+
```
2391

24-
# or start the server and open the app in a new browser tab
25-
npm run dev -- --open
92+
To make the development server accessible on your local network:
93+
94+
```bash
95+
pnpm dev-network
2696
```
2797

28-
## Building
98+
### Production Mode
99+
100+
Build the application for production:
101+
102+
```bash
103+
pnpm build
104+
```
29105

30-
To create a production version of your app:
106+
Preview the production build:
31107

32108
```bash
33-
npm run build
109+
pnpm preview
110+
```
111+
112+
Run the production server:
113+
114+
```bash
115+
node build
116+
```
117+
118+
## Database Management
119+
120+
- Push schema changes to the database:
121+
122+
```bash
123+
pnpm db:push
124+
```
125+
126+
- Create migrations:
127+
128+
```bash
129+
pnpm db:migrate
130+
```
131+
132+
- Open Drizzle Studio to manage database:
133+
```bash
134+
pnpm db:studio
135+
```
136+
137+
## Project Structure
138+
139+
- `/src`: Source code
140+
- `/lib`: Library code
141+
- `/server`: Server-side code
142+
- `/db`: Database models and operations
143+
- `/routes`: SvelteKit routes
144+
- `/static`: Static assets
145+
146+
## Configuration
147+
148+
The application requires several environment variables to be set in the `.env` file:
149+
150+
### Database Configuration
151+
152+
```
153+
DATABASE_URL=postgresql://root:mysecretpassword@localhost:5432/snapsort
154+
POSTGRES_USER=root
155+
POSTGRES_PASSWORD=mysecretpassword
156+
```
157+
158+
### External Tools
159+
160+
```
161+
EXIFTOOL_PATH="/path/to/exiftool"
162+
FFMPEG_PATH="/path/to/ffmpeg"
163+
```
164+
165+
### File Storage
166+
167+
```
168+
FILE_UPLOAD_DIR="/path/to/uploaded-files"
169+
LIBRARY_ROOT_DIR="/path/to/library"
34170
```
35171

36-
You can preview the production build with `npm run preview`.
172+
## Usage
37173

38-
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
174+
1. Start the application and navigate to the web interface
175+
2. Create new keywords
176+
3. Upload your media files
177+
4. Edit metadata as needed (date/time, description, GPS data, keywords)
178+
5. Apply the changes to temporarily modify the queued files
179+
6. Move files to the library to permanently save files
180+
7. Export metadata when needed for backup

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
services:
2+
snapsort-db:
3+
image: postgres
4+
restart: always
5+
ports:
6+
- '5432:5432'
7+
environment:
8+
POSTGRES_DB: snapsort
9+
POSTGRES_USER: ${POSTGRES_USER}
10+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
11+
volumes:
12+
- pgdata:/var/lib/postgresql/data
13+
volumes:
14+
pgdata:

drizzle.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from 'drizzle-kit';
2+
3+
if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
4+
5+
export default defineConfig({
6+
schema: './src/lib/server/db/schema.ts',
7+
dbCredentials: { url: process.env.DATABASE_URL },
8+
verbose: true,
9+
strict: true,
10+
dialect: 'postgresql'
11+
});

0 commit comments

Comments
 (0)