A backend system for image upload + processing + JWT-based auth, built in Go.
-
- Prerequisites
- Installation
- Configuration
- Running
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.
Based on the roadmap “Image Processing Service” idea, the intended features include:
- Sign-Up — register a new user with email & password
- Login — authenticate users
- JWT — protect endpoints using access & refresh tokens
- Upload Image — via multipart form-data
- Retrieve Image — by image ID or path
- List Images — show user’s uploaded images + metadata
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
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 setuputils/— helper utilities (e.g. file handling, image utilities)static/original/— directory to store original uploaded imagestest/— testscmd/IPS— main application entry point
Flow:
- Client registers / logs in → receives JWT access + refresh tokens
- For protected endpoints, client includes
Authorization: Bearer <token> - Upload image → file is stored, metadata is recorded
- Transformation request → service processes image as per instructions, returns a URL / image response
- 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.
- Go 1.20+ (or your version)
gd,jpeg,pnglibs (or whatever your image library needs)git- (Optional) database (if you swap from in-memory / file-based to DB)
git clone https://github.com/CrimsonKarma44/IPS.git
cd IPS
go mod downloadYou’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.
go run cmd/IPS/main.goOr build and run:
go build -o ips cmd/IPS/main.go
./ipsYou should now have the service listening on http://localhost:8080 (or your configured port).
Here’s a sample of endpoints and how to use them:
-
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_tokencookie (HttpOnly).
-
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).
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,mirrorcompress/qualityadjustment
You can combine transformations in a single request. E.g.:
{
"transformations": {
"resize": { "width": 300, "height": 200 },
"format": "webp",
"filters": { "grayscale": true }
}
}- 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.)
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
I’d love for you to help improve IPS! Here’s how:
- Fork the repo
- Create a feature branch (
git checkout -b feature/my-feature) - Write your feature / fix + tests
- Submit a Pull Request
- I’ll review and merge (with discussion)
Please follow existing code style and include tests where possible.
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?