/tel-no

Primary LanguageGo

Phone Number Lookup Service / Türkiye Telefon Numarası Sorgulama Servisi

A Go-based web service that allows users to search phone numbers, leave comments, and get information about phone numbers including their operators, regions, and user reviews.

Features

  • 📱 Phone number lookup and validation
  • 💬 User comment system with moderation
  • 🗺️ Dynamic sitemap generation
  • 📊 Rating system for phone numbers
  • 🖼️ Dynamic image generation for phone numbers
  • 🔍 Latest searches and comments tracking
  • 🤖 Google reCAPTCHA integration
  • 📱 Phone number information including:
  • Operator detection (Turkcell, Vodafone, Türk Telekom)
  • Region/City detection
  • Number type classification
  • Written form of numbers in Turkish

Tech Stack

API Endpoints

Public API

GET  /api/phoneNumber         - Search phone number
POST /api/phoneNumber         - Add comment
GET  /api/image               - Get phone number image
GET  /api/latest              - Get latest updates
GET  /api/sitemap/*           - Sitemap endpoints

Admin API

GET    /api/admin/phoneNumber/:number    - Get phone number details
GET    /api/admin/phoneNumber            - List phone numbers (paginated)
GET    /api/admin/phoneNumberUnchecked   - List unchecked numbers
GET    /api/admin/comment                - Get comment by ID
POST   /api/admin/comment                - Update comment
POST   /api/admin/quickComment           - Quick update comment
DELETE /api/admin/comment                - Delete comment

Features in Detail

Phone Number Validation

  • Supports Turkish phone numbers (10 digits)
  • Special handling for 444 numbers (7 digits)
  • Operator detection for major Turkish carriers
  • Regional information for landline numbers

Comment System

  • Three types of comments: RELIABLE, DANGEROUS, NEUTRAL
  • Comment moderation system
  • Aggregate rating calculation
  • Latest comments tracking

Image Generation

  • Dynamic image generation for phone numbers
  • Color coding based on ratings (green, red, gray)
  • Custom font rendering

SEO Features

  • Automated sitemap generation
  • IndexNow integration for faster indexing
  • Structured data with AggregateRating

Environment Variables

The following environment variables need to be set:

Required

MONGODB_CONNECTION_STRING=mongodb://user:pass@host:port
MONGODB_DATABASE=database_name
CAPTCHA_SECRET=your_recaptcha_secret_key

Optional

PORT=8080                      # Default: 8080
ENV=prod                       # Default: dev
LOG_LEVEL=info                 # Default: debug
SITE_BASE_URL=example.com     # Default: localhost
SITE_MAP_BASE_URL=example.com # Default: localhost

Project Structure

.
├── config/             # Configuration and environment setup
├── database/           # MongoDB connection and operations
├── handlers/           # HTTP request handlers
├── models/             # Data models and DTOs
├── model_entity/       # Database entities
├── route/              # API route definitions
├── service/            # Business logic layer
│   ├── image_service/  # Image generation
│   ├── latest_bar/     # Latest updates tracking
│   └── sitemap/        # Sitemap generation
└── main.go             # Application entry point

Setup

  1. Set required environment variables as described above

  2. Install dependencies:

go mod download
  1. Run the application:
go run main.go

Development

Running Tests

go test ./...

Building for Production

go build -o app

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.