A production-ready Node.js + TypeScript backend for user authentication and image processing. The project supports secure user accounts, image uploads via Cloudinary, image transformations, pagination, and background processing with a clean layered architecture.
- JWT Authentication (Register / Login / Profile)
- Image Uploads using Multer + Cloudinary
- Image Transformations (resize, crop, rotate, format, filters)
- Paginated Image Listing per user
- Background Worker (BullMQ + Redis)
- Prisma ORM with SQLite
- Centralized Error Handling Scalable Architecture (Controller / Service / Model)
backend
├── package.json
├── tsconfig.json
├── jest.config.ts
├── prisma
│ ├── schema.prisma
│ └── migrations
├── src
│ ├── app.ts
│ ├── server.ts
│ ├── worker.ts
│ ├── cache
│ │ └── redis.ts
│ ├── config
│ │ └── cloudinary.ts
│ ├── middlewares
│ │ ├── auth.ts
│ │ ├── requestLogger.ts
│ │ └── validate.ts
│ ├── modules
│ │ ├── users
│ │ │ ├── user.controller.ts
│ │ │ ├── user.controller.spec.ts
│ │ │ ├── user.model.ts
│ │ │ ├── user.route.ts
│ │ │ ├── user.service.ts
│ │ │ └── user.validation.ts
│ │ └── images
│ │ ├── image.controller.ts
│ │ ├── image.controller.spec.ts
│ │ ├── image.model.ts
│ │ ├── image.route.ts
│ │ ├── image.service.ts
│ │ └── image.validation.ts
│ ├── queue
│ │ └── bullmq.ts
│ ├── storage
│ │ └── multer.ts
│ ├── types
│ │ ├── customError.ts
│ │ └── HTTPStatusText.ts
│ └── utils
│ ├── errorHandler.ts
│ ├── hash.ts
│ ├── jwt.ts
│ ├── logger.ts
│ ├── rateLimiter.ts
│ └── verifyToken.ts
backend/src/app.tssets up routes and middlewarebackend/src/server.tsstarts the HTTP serverbackend/src/worker.tsruns background queue jobs
- Node.js
- TypeScript
- Express
- Prisma ORM
- SQLite
- Cloudinary
- Multer
- JWT
- BullMQ
- Redis
Create a .env file:
DATABASE_URL="file:./dev.db"
JWT_SECRET=your_jwt_secret
CLOUDINARY_CLOUD_NAME=xxxx
CLOUDINARY_API_KEY=xxxx
CLOUDINARY_API_SECRET=xxxxnpm installGenerate Prisma client:
npx prisma generateApply database schema:
npx prisma migrate dev --name initcd backend
npm install
npm run devcd backend
npm run build
npm startcd backend
npm run start_workercd frontend
npm install
npm run devThe repository now includes a minimal GitHub-themed dark frontend in frontend/ that uses all backend routes.
cd frontend
npm install
npm run dev- Frontend URL: http://localhost:3000
- API base URL: http://localhost:5000 (adjust with
NEXT_PUBLIC_API_BASE_URLinfrontend/.env.local)
- Register / Login / Profile (
/users/*) - Image upload (
POST /images) - Upload status (
GET /images/:id/status) - Get image by public ID (
GET /images/:publicId) - Paginated images (
GET /images?page=&limit=) - Transform image (
POST /images/transform)
| Method | Endpoint | Description |
|---|---|---|
| POST | /users/register |
Register user |
| POST | /users/login |
Login |
| GET | /users/profile |
Get profile (JWT required) |
| Method | Endpoint | Description |
|---|---|---|
| POST | /images |
Upload image (JWT + multipart) |
| POST | /images/transform |
Transform image |
| GET | /images?page=1&limit=10 |
Paginated images (JWT) |
| GET | /images/:publicId |
Get image by ID |
- Controllers: HTTP layer only
- Services: Business logic
- Models: Database access (Prisma)
- Utils: Shared helpers
- Middlewares: Auth & validation
All errors go through a centralized error handler:
{
"status": "error",
"message": "Error description"
}Solution for Image Processing Service Project https://roadmap.sh/projects/image-processing-service