Skip to content

Dendroculus/PixelForge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

426 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

EN | δΈ­ζ–‡ | ID

React Vite FastAPI PostgreSQL Microsoft Azure Cloudflare Turnstile

MIT Replicate

✨ PixelForge

The open-source image studio that blends AI cloud power with pro-grade browser editing

πŸš€ Why PixelForge

PixelForge started as a single-purpose AI upscaler and evolved into a full-stack image processing platform. It combines AI-powered cloud processing (upscale, background removal, restoration) with fast client-side editing tools (resize, compress, transform, metadata cleaning). The system is designed to handle real-world constraints such as rate limits, long-running AI jobs, and storage lifecycle management through an async queue-based architecture.


  • ⚑ AI where it matters, instant client-side tools where it’s faster
  • πŸ” Security-first pipeline (Turnstile, signed URLs, validation, anti-spoof proxy strategy)
  • 🧠 Reliable architecture (async jobs, usage limits, janitor cleanup, session recovery)
  • 🎨 Beautiful UX with before/after comparisons and staged progress feedback
  • πŸ› οΈ Open-source and extensible provider architecture

🎯 Features

A) Core Image Tools

  1. πŸ” Upscale Image (AI) β€” Real-ESRGAN enhancement
πŸŽ₯ Click to watch the preview
UPSCALE.mp4
  1. 🧍 Remove Background (AI) β€” clean subject extraction
πŸŽ₯ Click to watch the preview
REMBG.mp4
  1. 🎨 Restore Color (AI) β€” revive grayscale & faded photos
πŸŽ₯ Click to watch the preview
RESTORE.COLOR.mp4
  1. 🎨 Object Remover (AI) β€” brush over unwanted objects and erase them cleanly
πŸŽ₯ Click to watch the preview
OBJECT_RMOVE.mp4
  1. πŸŽ›οΈ Image Editor β€” brightness, contrast, saturation, blur, vignette
πŸŽ₯ Click to watch the preview
EDIT.IMAGE.mp4
  1. πŸ“ Resize Image β€” custom size, aspect lock, presets
πŸŽ₯ Click to watch the preview
RESIZE.IMAGE.mp4
  1. πŸ”„ Rotate & Flip β€” quick transform controls
πŸŽ₯ Click to watch the preview
ROTATE.IMAGE.mp4
  1. πŸ—œοΈ Compress Image β€” reduce size with quality control
πŸŽ₯ Click to watch the preview
COMPRESS.IMAGE.mp4
  1. πŸ” Convert Format β€” PNG / JPG / WEBP
πŸŽ₯ Click to watch the preview
CONVERT.IMAGE.mp4
  1. 🧹 Remove Metadata β€” clean EXIF data
πŸŽ₯ Click to watch the preview
METADATA.mp4
  1. 🎯 Color Palette Extractor β€” draggable sampling points
πŸŽ₯ Click to watch the preview
COLOR.PALETTE.mp4
  1. 🏷️ Add Watermark β€” text/image with live preview
πŸŽ₯ Click to watch the preview
WATERMARK.mp4
  1. βœ‚οΈ Crop Image β€” freeform or preset aspect ratios
πŸŽ₯ Click to watch the preview
CROP.IMAGE.mp4
  1. πŸ€– Chatbot β€” Interactive FAQ assistant for quick answers and guided platform help
πŸŽ₯ Click to watch the preview
CHATBOT.mp4
  1. πŸ“ Feedback System β€” user input for improvements and bug reports

B) Platform & System Capabilities

  1. πŸ›‘οΈ Turnstile Verification β€” bot protection layer
  2. πŸ“Š Usage Limits β€” per-feature daily caps
  3. 🚦 Rate Limiting β€” controlled API flow
  4. βš™οΈ Async Job Queue β€” safe background processing
  5. πŸ”„ Status Polling β€” processing / ready / failed
  6. πŸ’Ύ Session Persistence β€” IndexedDB + localStorage
  7. πŸ” Session Restore β€” recover after refresh
  8. ⏳ Expiration Handling β€” results & drafts lifecycle
  9. 🧽 Azure Cleanup β€” expired result janitor
  10. 🧹 DB Cleanup β€” usage data maintenance
  11. πŸ”‘ Signed URLs β€” secure upload & access
  12. πŸ” File Validation β€” type, size, spoof detection, and resolution safety
  13. πŸ“‰ Auto-Resize for Oversized Images β€” browser-side downscaling for images above the public pixel limit
  14. 🏷️ Filename Sanitization β€” safe file handling
  15. 🧩 Workspace System β€” reusable UI shell
  16. πŸ“’ Modal System β€” legal & alert handling
  17. πŸ†š Comparison Slider β€” before/after preview
  18. 🎬 Progress UX β€” staged loading feedback

🧠 Architecture Highlights

PixelForge is designed to balance performance, cost, and reliability while working with external AI APIs that have strict rate and concurrency limits. Key architectural decisions include:

  • Queue-based AI processing system to handle long-running jobs
  • Decoupled upload β†’ process β†’ result pipeline
  • Concurrency control to prevent overload and API abuse
  • Stateless API with client-side job tracking
  • Hybrid processing model (AI in cloud, instant tools in browser)
  • Storage lifecycle management with automatic cleanup
  • Pluggable AI provider layer for future model integrations

πŸ’‘ Design Considerations

  • AI jobs are handled asynchronously due to long execution times and external API limits
  • Polling is used instead of WebSockets for simplicity and reliability
  • Signed URLs reduce backend load and improve upload/download performance
  • Rate limiting and usage caps prevent abuse and control costs

πŸ”§ Processing Models

PixelForge uses a hybrid processing model to balance performance and cost: AI-intensive tasks are handled asynchronously on the backend, while lightweight operations are executed instantly in the browser.

πŸ”„ AI Processing Flow (Asynchronous)

The system separates processing paths based on workload type to optimize performance and cost :

  1. User selects an image
  2. Frontend validates type, size, and resolution
  3. Oversized but safe images are resized in the browser before upload
  4. Backend verifies Turnstile and checks usage quota
  5. Backend generates signed upload URL metadata
  6. File uploads directly to Azure Blob Storage
  7. Backend reserves queue capacity and increments usage when processing starts
  8. AI provider executes the task asynchronously
  9. Client polls job status via API
  10. Result is stored with a signed access URL
  11. Cleanup system removes expired data

⚑ Client-Side Processing Flow (Instant)

The frontend handles all lightweight transformations directly in the browser for instant feedback and zero backend load to provide a seamless user experience:

  1. User uploads image
  2. Image processed directly in browser (resize, compress, transform, etc.)
  3. No backend interaction required
  4. Result generated instantly
  5. User downloads processed file

πŸ—οΈ Architecture & Stack

Tech Stacks

PixelForge uses a split architecture:

  • Frontend (React + Vite + Tailwind)
    Handles tool UI, previews, client-side transforms, session persistence (IndexedDB/localStorage), and interaction flow.

  • Backend (FastAPI + asyncpg + aiohttp)
    Handles secure AI orchestration, Turnstile verification, usage/rate limits, signed upload/result URLs, and polling endpoints.

  • AI Inference (Replicate Python SDK)
    Model calls go through a provider abstraction (BaseAIProvider / ReplicateProvider) so the AI layer is modular and extensible.

  • Storage + Data (Azure Blob + PostgreSQL)
    Azure Blob manages upload/result lifecycle; PostgreSQL stores usage buckets and retention-driven state.

For more details, see docs/ARCHITECTURE.md.

βš™οΈ Environment Variables

Backend (root/backend env)

AZURE_CONNECTION_STRING=
REPLICATE_API_TOKEN=
ALLOWED_ORIGINS=
CLOUDFLARE_TURNSTILE_SITE_KEY=
CLOUDFLARE_TURNSTILE_SECRET_KEY=
DATABASE_URL=
CLOUDFLARE_SUBNETS=
ENVIRONMENT=
ALLOW_TURNSTILE_TEST_BYPASS=
TRUST_PROXY_HEADERS=
REQUIRE_CLOUDFLARE_PROXY=
STRICT_ENV_VALIDATION=

Frontend

VITE_API_BASE_URL=http://127.0.0.1:8000/api
VITE_TURNSTILE_SITE_KEY=0x4AAAAAACxEYGPTmGZUjctK

Need help setting up external services? See SETUP.md for step-by-step instructions on configuring Azure Blob Storage, Replicate, Cloudflare Turnstile, PostgreSQL, Discord webhooks, and environment variables.

For local testing, keep API base URL at local backend.
For deployment, switch to your hosted API endpoint (example: https://your-domain/app/api).

πŸš€ Local Development

1) Clone

git clone https://github.com/Dendroculus/PixelForge.git
cd PixelForge

2) Run backend

cd backend
python -m venv .venv
source .venv/bin/activate      # macOS/Linux
# .venv\Scripts\activate       # Windows
pip install -r requirements.txt
uvicorn main:app --reload

3) Run frontend

cd frontend
npm install
npm run dev

πŸ”’ Security Notes

  • Turnstile check before AI init routes
  • Proxy/IP trust strategy to reduce header spoofing risk
  • Signed SAS URLs for controlled blob access
  • Strict file validation + capped dimensions/size
  • Public AI uploads use a lower browser-side pixel limit for user experience
  • Backend validation remains the security boundary with a higher hard pixel safety cap
  • Oversized images may be resized before upload, while oversized files are still rejected by byte-size limits
  • Automated cleanup for privacy and storage hygiene

πŸ›  Built With

  • React + Vite (frontend)
  • FastAPI (backend)
  • Replicate (AI model inference)
  • Azure Blob Storage (upload/result lifecycle)
  • PostgreSQL (usage limits & retention windows)
  • Cloudflare Turnstile (bot protection)

🀝 Contributing

PRs and improvements are welcome.
If you’re planning a bigger change, open an issue first to align on scope.

For contributing guidelines, see CONTRIBUTING.md.
Please follow our Code of Conduct.
For security issues, please see our Security Policy.

πŸ“œ License

Licensed under the MIT License. See LICENSE for details.

πŸ“ Developer Docs

How to add a new AI feature to PixelForge:

Backend and AI test scripts:

Developer helper scripts:

  • Total Line Counter β€” interactive Windows PowerShell script for counting project lines by folder, extension, and section.

Local PowerShell scripts and .bat helper files are intended for Windows development environments.

πŸ™ Acknowledgements

  • Real-ESRGAN ecosystem
  • Replicate platform
  • FastAPI, React, and open-source contributors

πŸ‘€ Contributors

Made with ❀️ by the PixelForge team:

Hans avatar
Hans
Lead Developer
Wellson avatar
Wellson
Project Coordinator
Lawi avatar
Lawi
UI/UX Designer
Jensen avatar
Jensen
QA Lead & Stakeholder

About

An open-source AI image studio that combines asynchronous cloud-powered enhancement tools with fast in-browser image editing.

Resources

License

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Contributors