Architecture Overview
ConvertX is a monolithic application built on the ElysiaJS framework running on Bun.
Core Technologies
- Runtime: Bun (handles HTTP server, file I/O, and child processes).
- Database: SQLite (via
bun:sqlite).
- Frontend: Server-side rendered JSX (using
@kitajs/html) with TailwindCSS for styling.
- Process Management: Node's
child_process.execFile is used to spawn converter subprocesses.
Database Schema
The database is initialized in src/db/db.ts.
users
| Column |
Type |
Description |
id |
INTEGER PK |
Auto-incrementing ID. |
email |
TEXT |
User email. |
password |
TEXT |
Hashed password (Argon2 via Bun). |
jobs
| Column |
Type |
Description |
id |
INTEGER PK |
|
user_id |
INTEGER |
FK to users.id. |
date_created |
TEXT |
ISO timestamp. |
status |
TEXT |
'not started', 'pending', 'completed'. |
num_files |
INTEGER |
Total files in the job. |
file_names
| Column |
Type |
Description |
id |
INTEGER PK |
|
job_id |
INTEGER |
FK to jobs.id. |
file_name |
TEXT |
Original uploaded filename. |
output_file_name |
TEXT |
Filename after conversion. |
status |
TEXT |
Status of specific file conversion. |
Request Flow
- Upload (
src/pages/upload.tsx): Files are streamed to data/uploads/{userId}/{jobId}/.
- Selection (
src/pages/root.tsx): User selects a target format. The frontend polls src/converters/main.ts to see compatible converters.
- Conversion (
src/pages/convert.tsx):
- A job is marked as 'pending'.
handleConvert iterates through files.
- The appropriate converter module (e.g.,
src/converters/ffmpeg.ts) is invoked via execFile.
- Result is written to
data/output/{userId}/{jobId}/.
- Result (
src/pages/results.tsx): UI polls for progress and displays download links.