Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IPS (Image Processing Service)

A backend system for image upload + processing + JWT-based auth, built in Go.


🧩 Table of Contents

  1. Project Overview

  2. Features / Requirements

  3. Architecture & Design

  4. Getting Started

    • Prerequisites
    • Installation
    • Configuration
    • Running
  5. API Endpoints

  6. Image Transformations

  7. Error Handling, Validation & Security

  8. Possible Improvements / Future Work

  9. Contributing

  10. License


Project Overview

IPS is a backend service that allows users to:

  • Register / login with JWT-based authentication
  • Upload images
  • Transform images (resize, crop, rotate, format change, etc.)
  • Retrieve images / list uploads

It aims to be similar in spirit to services like Cloudinary: you give it an image + instructions, it gives you back processed results.


Features / Requirements

Based on the roadmap “Image Processing Service” idea, the intended features include:

User Authentication

  • Sign-Up — register a new user with email & password
  • Login — authenticate users
  • JWT — protect endpoints using access & refresh tokens

Image Management

  • Upload Image — via multipart form-data
  • Retrieve Image — by image ID or path
  • List Images — show user’s uploaded images + metadata

Image Transformations

Supported (or to be supported) operations:

  • Resize
  • Crop
  • Rotate
  • Change format (JPEG, PNG, WebP, etc.)
  • Filters (grayscale, sepia, etc.)
  • Watermark
  • Compress / quality adjustment
  • Flip / Mirror

Architecture & Design

Here’s how IPS is structured (folders / modules you’ll see in the repo):

  • auth/ — authentication service (register, login, token management)
  • middleware/ — HTTP middleware (e.g. for JWT validation)
  • img/ — image handling logic (upload, transform, storage)
  • urls/ — route definitions / routing setup
  • utils/ — helper utilities (e.g. file handling, image utilities)
  • static/original/ — directory to store original uploaded images
  • test/ — tests
  • cmd/IPS — main application entry point

Flow:

  1. Client registers / logs in → receives JWT access + refresh tokens
  2. For protected endpoints, client includes Authorization: Bearer <token>
  3. Upload image → file is stored, metadata is recorded
  4. Transformation request → service processes image as per instructions, returns a URL / image response
  5. Retrieval / list endpoints let users fetch or see their images

You might use local storage (filesystem) now; in production, you can swap in cloud storage (S3, etc.). You may also use queues / background workers for heavy image ops in future.


Getting Started

Prerequisites

  • Go 1.20+ (or your version)
  • gd, jpeg, png libs (or whatever your image library needs)
  • git
  • (Optional) database (if you swap from in-memory / file-based to DB)

Installation

git clone https://github.com/CrimsonKarma44/IPS.git
cd IPS
go mod download

Configuration

You’ll likely have environment variables. For example:

JWT_SECRET_ACCESS=yourAccessSecret
JWT_SECRET_REFRESH=yourRefreshSecret
PORT=8080

If there’s a .env file or config example in the repo, copy it and adapt.

Running

go run cmd/IPS/main.go

Or build and run:

go build -o ips cmd/IPS/main.go
./ips

You should now have the service listening on http://localhost:8080 (or your configured port).


API Endpoints

Here’s a sample of endpoints and how to use them:

Authentication Endpoints

  • POST /auth/register Request JSON:

    {
      "email": "user@example.com",
      "password": "yourPassword"
    }

    Response: success or error.

  • POST /auth/login Request JSON:

    {
      "email": "user@example.com",
      "password": "yourPassword"
    }

    Response:

    {
      "access_token": "...",
      "status": 202,
      "response": {
        "user": {
          "id": ..., "email": "..."
        }
      }
    }

    Also sets a refresh_token cookie (HttpOnly).

Image Endpoints (example)

  • POST /images Upload image (multipart form-data). Returns image metadata & URL.

  • POST /images/:id/transform Apply transformations. Body example:

    {
      "transformations": {
        "resize": { "width": 200, "height": 200 },
        "rotate": 90,
        "format": "png"
      }
    }

    Returns transformed image info / URL.

  • GET /images/:id Retrieve an image or metadata.

  • GET /images?page=1&limit=10 List your images (paginated).


Image Transformations

Here’s a rough list of supported / planned transformations:

  • resize(width, height)
  • crop(width, height, x, y)
  • rotate(degrees)
  • format (change output format)
  • filters (like grayscale, sepia)
  • watermark (overlay text or image)
  • flip, mirror
  • compress / quality adjustment

You can combine transformations in a single request. E.g.:

{
  "transformations": {
    "resize": { "width": 300, "height": 200 },
    "format": "webp",
    "filters": { "grayscale": true }
  }
}

Error Handling, Validation & Security

  • Validate all inputs (e.g. image file types / size limits)
  • Return clear error messages (JSON format)
  • Use JWTs for protected endpoints, refresh tokens via HttpOnly cookies
  • Rate-limit transformations (to prevent abuse)
  • Possibly cache transformed images so you don’t redo the same work
  • Sanitize user inputs (avoid path traversal, etc.)

Possible Improvements / Future Work

Here are some ideas to expand:

  • Use cloud storage (AWS S3, Google Cloud Storage, etc.) instead of local disk
  • Process image transformations asynchronously (via message queue)
  • Cache transformed images, use CDN
  • Add more filters / effects (blur, sharpen, color adjustments)
  • Add versioning of images
  • Implement access control (public / private images)
  • Logging, metrics, monitoring (Prometheus, etc.)
  • SDKs / client libraries for ease of use
  • UI / frontend dashboard

Contributing

I’d love for you to help improve IPS! Here’s how:

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Write your feature / fix + tests
  4. Submit a Pull Request
  5. I’ll review and merge (with discussion)

Please follow existing code style and include tests where possible.


License

This project is licensed under the MIT License — see the LICENSE file for details. (GitHub)


If you like, I can generate a .md-file version you can paste directly into your repo, or even generate badges (build, coverage, etc.) for your README. Do you want me to send you that?

roadmap-Link

About

Image Processing Service a backend system with full jwt authentication service

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages