Skip to content

πŸš€ Wallzen API: High-performance wallpaper management system built with Node.js and PostgreSQL. Features intelligent image processing, rate limiting, and comprehensive REST endpoints. πŸ”— Part of the Wallzen project

Notifications You must be signed in to change notification settings

justkelvin/wallzen-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ–ΌοΈ Wallzen Backend

A modern, high-performance wallpaper management API built with Node.js, Express, and PostgreSQL

Features β€’ Tech Stack β€’ Getting Started β€’ API Endpoints β€’ Environment Setup


✨ Features

  • πŸš€ High-performance image serving
  • πŸ”’ Rate limiting for API protection
  • πŸ“± Responsive image resizing
  • πŸ” Advanced search capabilities
  • 🏷️ Tag-based categorization
  • 🎨 Color extraction and filtering
  • πŸ“Š Download and view statistics
  • πŸ—ƒοΈ PostgreSQL database with Prisma ORM

πŸ› οΈ Tech Stack

  • Runtime: Node.js
  • Framework: Express.js
  • Database: PostgreSQL
  • ORM: Prisma
  • Image Processing: Sharp
  • File Storage: Local filesystem
  • API Security: Express Rate Limit
  • Documentation: Swagger/OpenAPI

πŸš€ Getting Started

  1. Clone the repository
git clone https://github.com/yourusername/wallzen-backend.git
cd wallzen-backend
  1. Install dependencies
npm install
  1. Set up environment variables
cp .env.example .env
  1. Initialize the database
npx prisma migrate dev
npx prisma generate
  1. Start the development server
npm run dev

πŸ“‘ API Endpoints

Wallpapers

  • GET /api/wallpapers - Get all wallpapers (paginated)
  • GET /api/wallpapers/:id - Get wallpaper by ID
  • GET /api/wallpapers/random - Get random wallpapers
  • GET /api/wallpapers/search - Search wallpapers
  • GET /api/wallpapers/filter - Filter wallpapers

Downloads

  • GET /api/wallpapers/:id/download - Download wallpaper
  • GET /api/wallpapers/:id/preview - Get wallpaper preview

Statistics

  • GET /api/status - Get API status
  • GET /api/health - Health check endpoint

πŸ”§ Environment Variables

# Server Configuration
PORT=3001
NODE_ENV=development

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/wallpaper_db"

# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
API_RATE_LIMIT=100
DOWNLOAD_RATE_LIMIT=30
SEARCH_RATE_LIMIT=50

# File Storage
UPLOAD_DIR="./uploads"
PREVIEWS_DIR="./previews"

πŸ“Š API Response Format

interface PaginatedResponse<T> {
  data: T[];
  pagination: {
    currentPage: number;
    totalPages: number;
    totalItems: number;
    itemsPerPage: number;
  };
}

πŸ”’ Rate Limiting

  • API: 100 requests per 15 minutes
  • Downloads: 30 downloads per 15 minutes
  • Search: 50 searches per 15 minutes
  • Health: 10 requests per minute

πŸ“¦ Project Structure

src/
β”œβ”€β”€ controllers/    # Request handlers
β”œβ”€β”€ middleware/     # Express middleware
β”œβ”€β”€ models/        # Database models
β”œβ”€β”€ routes/        # API routes
β”œβ”€β”€ services/      # Business logic
β”œβ”€β”€ utils/         # Helper functions
└── app.ts         # Application entry

πŸ“ License

MIT Β© [justkelvin]


Made with ❀️ by justkelvin

About

πŸš€ Wallzen API: High-performance wallpaper management system built with Node.js and PostgreSQL. Features intelligent image processing, rate limiting, and comprehensive REST endpoints. πŸ”— Part of the Wallzen project

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published