Skip to content

Repository files navigation

🏈 8x Sports Jersey Studio – Backend Server

Node.js Express Status

A powerful Node.js Express backend for AI-powered jersey design analysis and search 🚀

FeaturesAPI EndpointsQuick StartArchitecture


✨ Features

Feature Description Status
🖼️ Image Upload Secure file upload with validation ✅ Ready
🎯 Polygon Detection YOLO-powered object detection ✅ Ready
🔍 AI Search DINO + FAISS for similar designs ✅ Ready
✂️ Smart Cropping Intelligent area extraction ✅ Ready
🚀 High Performance Optimized for production ✅ Ready
🔒 CORS Security Cross-origin request handling ✅ Ready

🛠️ API Endpoints

🔍 Health Check

GET /api/test

Response:

{
  "message": "Server is working!",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "endpoints": ["/api/upload-image", "/api/generate-jersey", "/api/test"]
}

📤 Image Upload & Analysis

POST /api/upload-image
Content-Type: multipart/form-data

Body: { image: File }

Response:

{
  "imageUrl": "/uploads/1234567890-image.jpg",
  "polygons": [[[x1,y1], [x2,y2], ...]]
}

🏈 Jersey Design Search

POST /api/generate-jersey
Content-Type: multipart/form-data

Body: {
  image: File,
  area?: [[x,y], [x,y], ...],
  isPolygon?: boolean
}

Response:

{
  "imageUrl": "/uploads/processed-image.jpg",
  "message": "Similar designs found!",
  "similarDesigns": [...],
  "features": [...]
}

⚡ Quick Start

1. 🚀 Clone & Install

git clone https://github.com/Devam0311/Server-backend.git
cd Server-backend
pnpm install

2. ⚙️ Environment Setup

Create .env file:

# Frontend URL
FRONTEND_URL=https://localhost:8081

# FastAPI Services
FASTAPI_YOLO_URL=http://0.0.0.0:8000/yolo
FASTAPI_DINO_URL=http://0.0.0.0:8000/dino
FASTAPI_FAISS_URL=http://0.0.0.0:8000/faiss

3. 🎯 Start Server

node server.cjs

🌐 Server running at: http://localhost:3001


🏗️ Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Frontend      │    │   Backend       │    │   FastAPI       │
│   (React)       │◄──►│   (Express)     │◄──►│   Services      │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                              │
                              ▼
                       ┌─────────────────┐
                       │   File System   │
                       │   (uploads/)    │
                       └─────────────────┘

📁 Project Structure

backend/
├── 🚀 server.cjs          # Main Express server
├── 📦 package.json        # Dependencies & scripts
├── 📁 uploads/            # Uploaded images (auto-created)
├── 📁 profiles/           # User profiles (auto-created)
├── 📁 catalogue/          # Design catalogue
├── 📁 src/                # Source code
│   ├── 📁 lib/            # Utilities
│   └── 📁 pages/          # API routes
└── 📄 README.md           # This file

🧩 Tech Stack

Core Dependencies

  • Express - Web framework
  • Multer - File upload handling
  • CORS - Cross-origin resource sharing
  • Axios - HTTP client
  • Sharp - Image processing
  • Form-data - Multipart form handling

Development Tools

  • Node.js ≥ 18.0.0
  • pnpm ≥ 8.0.0
  • TypeScript support
  • ESLint + Prettier

🔧 Development

Available Scripts

# Install dependencies
pnpm install

# Run development server
node server.cjs

# Lint code
pnpm lint

# Format code
pnpm format

# Type checking
pnpm type-check

Environment Variables

Variable Description Default
FRONTEND_URL Frontend application URL https://localhost:8081
FASTAPI_YOLO_URL YOLO detection service http://0.0.0.0:8000/yolo
FASTAPI_DINO_URL DINO feature extraction http://0.0.0.0:8000/dino
FASTAPI_FAISS_URL FAISS search service http://0.0.0.0:8000/faiss

🤝 Contributing

We love contributions! Here's how you can help:

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch (git checkout -b feature/amazing-feature)
  3. 💾 Commit your changes (git commit -m 'Add amazing feature')
  4. 📤 Push to the branch (git push origin feature/amazing-feature)
  5. 🔄 Open a Pull Request

🐛 Bug Reports

Found a bug? Open an issue with:

  • Bug description
  • Steps to reproduce
  • Expected vs actual behavior
  • Environment details

Made with ❤️ for 8x Sports Jersey Studio

GitHub stars GitHub forks

Empowering sports enthusiasts with AI-driven jersey design 🏆

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages