Skip to content

Latest commit

Β 

History

146 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SmokeByte

A production-ready, async file conversion platform.
Upload. Convert. Download. At scale.


Node.js Express PostgreSQL Redis Supabase Docker BullMQ


What is SmokeByte?

SmokeByte is a backend platform that lets users securely upload files, convert them to different formats through an asynchronous background queue, track conversion status in real-time, and download the results from cloud storage β€” all via a clean REST API.

It's built to handle image, document, audio, and video conversions reliably, even under load.


Features

πŸ” Authentication & Security

Feature Details
JWT Auth Access + Refresh token architecture
Password Hashing bcrypt
Route Protection Middleware-guarded endpoints
User Isolation Each user sees only their own resources
Hardening Helmet, CORS, Rate Limiting

πŸ”„ File Conversion

πŸ–ΌοΈ Images β€” via Sharp

From To
JPG PNG, WEBP
PNG JPG, WEBP
WEBP JPG, PNG

πŸ“„ Documents β€” via LibreOffice

From To
PDF DOCX, TXT
DOCX PDF, TXT
TXT PDF, DOCX
PPT / PPTX PDF

🎡 Audio & Video β€” via FFmpeg

Supports cross-format conversion across: MP4, AVI, MOV, WEBM, MP3, WAV, AAC, FLAC, OGG, M4A, WMA

βš™οΈ Queue-Based Processing

  • BullMQ powered job queue backed by Redis
  • Background worker processes jobs asynchronously
  • Each conversion tracked by a BullMQ Job ID
  • Workers are decoupled from the API β€” scale independently

☁️ Storage

  • Converted files stored in Supabase Object Storage
  • Temporary local files auto-cleaned post-upload
  • Secure, user-scoped download URLs

πŸ“¦ User Features

  • Conversion history per user
  • Real-time job status polling
  • Secure file download
  • Full resource isolation between users

Architecture

Frontend / API Client
        β”‚
        β–Ό
  Express REST API
  β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  Auth  β”‚  Upload  β”‚  Jobs  β”‚
  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚
        β–Ό
    BullMQ Queue  ←──  Redis
        β”‚
        β–Ό
     Worker Process
     β”Œβ”€β”€β”€β”€β”¬β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”
     β”‚    β”‚    β”‚    β”‚
     β–Ό    β–Ό    β–Ό    β–Ό
  Sharp FFmpeg LibreOffice
     β”‚    β”‚    β”‚
     β””β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
   Supabase Object Storage
           β”‚
           β–Ό
       PostgreSQL

Workflow

flowchart TD
    A[User Uploads File] --> B[Upload Validation]
    B --> C[Store Original in Supabase]
    C --> D[Create BullMQ Job]
    D --> E[Worker Picks Up Job]
    E --> F{File Type?}

    F -->|Image| G[Sharp]
    F -->|Document| H[LibreOffice]
    F -->|Audio/Video| I[FFmpeg]

    G --> J[Upload Converted File]
    H --> J
    I --> J

    J --> K[Save File Record]
    K --> L[Save Conversion Log]
    L --> M[Job ID Returned to Client]
    M --> N[Client Polls /status/:jobId]
    N --> O[Client Downloads Converted File]
Loading

Project Structure

src/
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ db.js                 # PostgreSQL connection
β”‚   └── supabase.js           # Supabase client
β”‚
β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ authController.js
β”‚   β”œβ”€β”€ conversionController.js
β”‚   β”œβ”€β”€ statusController.js
β”‚   β”œβ”€β”€ historyController.js
β”‚   └── userController.js
β”‚
β”œβ”€β”€ jobs/
β”‚   β”œβ”€β”€ queue.js              # BullMQ queue definition
β”‚   └── worker.js             # Background job processor
β”‚
β”œβ”€β”€ middlewares/
β”‚   β”œβ”€β”€ authMiddleware.js     # JWT verification
β”‚   β”œβ”€β”€ uploadMiddleware.js   # Multer file handling
β”‚   β”œβ”€β”€ rateLimiter.js
β”‚   └── errorHandler.js
β”‚
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ userModel.js
β”‚   β”œβ”€β”€ fileModel.js
β”‚   β”œβ”€β”€ conversionLogs.js
β”‚   └── refreshTokenModel.js
β”‚
β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ authRoutes.js
β”‚   β”œβ”€β”€ conversionRoutes.js
β”‚   β”œβ”€β”€ statusRoutes.js
β”‚   β”œβ”€β”€ historyRoutes.js
β”‚   └── userRoutes.js
β”‚
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ imageService.js       # Sharp logic
β”‚   β”œβ”€β”€ documentService.js    # LibreOffice logic
β”‚   β”œβ”€β”€ audiovideoService.js  # FFmpeg logic
β”‚   └── storageService.js     # Supabase upload/download
β”‚
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ jwtUtils.js
β”‚   β”œβ”€β”€ fileUtils.js
β”‚   └── logger.js
β”‚
β”œβ”€β”€ app.js
└── server.js

API Reference

Auth

POST   /auth/register          # Create new account
POST   /auth/login             # Login, receive access + refresh tokens
POST   /auth/refresh-token     # Get new access token using refresh token
POST   /auth/logout            # Invalidate session

User

GET    /user/me                # Get authenticated user profile
GET    /user/history           # Get user's conversion history

Conversion

POST   /convert/image          # Convert image files
POST   /convert/document       # Convert document files
POST   /convert/media          # Convert audio/video files

All /convert/* endpoints return a jobId for polling.

Status & Download

GET    /status/:jobId          # Poll conversion job status
GET    /download               # Download converted file

Getting Started

1. Clone & Install

git clone <repository-url>
cd SmokeByte
npm install

2. Configure Environment

Create a .env file at the project root:

PORT=3000

DATABASE_URL=

JWT_SECRET=
JWT_REFRESH_SECRET=

REDIS_URL=

SUPABASE_URL=
SUPABASE_KEY=
SUPABASE_SERVICE_ROLE_KEY=
SUPABASE_BUCKET=convert-files

NODE_ENV=production

3. Run Development Server

# Start API server
npm run dev

# Start worker (separate terminal)
node src/jobs/worker.js

The API server and the worker are separate processes. Both need to be running for end-to-end conversions to work.


Docker

# Build image
docker build -t smokebyte .

# Run container
docker run -p 3000:3000 smokebyte

Tech Stack

Layer Technology
Runtime Node.js
Framework Express.js
Database PostgreSQL + Sequelize ORM
Auth JWT, Refresh Tokens, bcrypt
Queue BullMQ + Redis (Upstash)
Storage Supabase Object Storage
Image Processing Sharp
Media Processing FFmpeg
Document Processing LibreOffice
Infrastructure Docker, PM2, Cloudflare Tunnel

Roadmap

  • Email verification on signup
  • Password reset via email
  • Refresh token rotation
  • Admin dashboard
  • Conversion analytics
  • WebSocket-based real-time status updates
  • Multi-file batch conversion

Author

Pushpak Pathe

Backend Developer β€” Node.js Β· Express.js Β· PostgreSQL Β· Redis Β· Docker


Built with β˜• and way too many conversion edge cases.

About

A Scalable File converting paltform

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages