DEV Community

slawekluzny
slawekluzny

Posted on Originally published at 24ad.info

Building a Multilingual AI-Powered Classifieds Platform

Building a Multilingual AI-Powered Classifieds Platform

This morning, I woke up to a notification from 24ad.info about a bug in the payments flow. It reminded me of the journey this platform has taken since its inception — from a simple idea to a fully-fledged AI-powered classifieds system. Let’s dive into the technical details and lessons learned along the way.

The Problem: Making Classifieds Effortless

Classifieds platforms have been around forever, but they’re often clunky. Users spend forever writing descriptions, picking categories, and setting prices. What if we could automate all of that? That’s the core idea behind 24ad.info: upload a photo, and let AI handle the rest.

The Tech Stack

Here’s what powers 24ad.info:

  • Frontend: React 19 with Vite for blazing-fast builds, Tailwind CSS for utility-first styling, and shadcn/ui for polished components. Routing is handled by wouter, and tRPC v11 manages the API communication.
  • Backend: Node.js with Express for the server, tRPC v11 for type-safe API endpoints, and Drizzle ORM for database interactions.
  • Database: MySQL, hosted on managed internal infrastructure (exact host name withheld), handles everything from user data to post metadata.
  • AI: OpenRouter provides access to models like Google Gemini 2.5 Flash for vision tasks and Gemini 2.0 Flash for text tasks (translations, graphics prompts).
  • Auth: Google OAuth and email/password authentication (JWT-based) keep things secure.
  • Payments: Stripe handles checkout and webhooks for premium listings and packages.
  • Web Server: Caddy v2 manages wildcard subdomains, HSTS, and compression (zstd+gzip).

The AI Features

The AI-powered features are the heart of 24ad.info:

  1. Photo Analysis: Upload a photo, and OpenRouter’s Google Gemini 2.5 Flash model analyzes it to recognize the item, assess its condition, and suggest a price. This is the first step in automating the listing process.
  2. Category Classification: The AI matches the item to the most relevant category. If the category is inactive, it reactivates it instead of creating a duplicate — keeping the catalog clean.
  3. Description Generation: SEO-optimized descriptions are generated automatically, saving users time and improving search visibility.
  4. Smart Pricing: Based on market data and the photo analysis, the AI suggests a competitive price.
  5. Package Translation: For listings that span multiple countries, the AI translates the title and description.

These features collectively automate the listing process.

The Payment Bug

One of the more embarrassing bugs we encountered was in the payments flow. After a successful Stripe payment, the promotion or package wasn’t being applied to the post. The verifyCheckoutSession endpoint marked the payment as completed but never called applyPackageToPost. This meant users paid for premium features but didn’t get them.

The fix, shipped in v1.4.4 on 2026-05-20, was straightforward: we added the applyPackageToPost step to the checkout verification flow. We also added an admin bypass to manually activate packages for testing purposes. Lesson learned: always test edge cases thoroughly, especially when money is involved.

Search and Location

Searching for listings is a core feature of any classifieds platform. Here’s how we handle it:

  1. Keyword Search: Full-text search across titles and descriptions.
  2. Category Filters: Narrow results by category and custom fields.
  3. Price Range: Filter by minimum and maximum price.
  4. Location: Search by city or postcode, with a radius slider (1-100 km) for nearby listings.

The location search is powered by a single-pass SQL query that resolves city names or postcodes to city IDs. A separate radius-search procedure finds nearby cities by distance. There’s no multi-step funnel or full-text fallback — keeping the search fast and efficient.

Image Optimization

All image uploads are converted to WebP on the fly using sharp (quality 82, effort 4). This reduces file sizes significantly. The v1.4.2 update batch-converted existing images to WebP, ensuring consistency across the platform.

Infrastructure and Scaling

Caddy v2 handles the web server duties, including wildcard subdomains, HSTS, and compression. The encode zstd gzip directive ensures all responses are compressed, regardless of file type or size.

Behind the scenes, PM2 manages four Node.js instances for load balancing. The /api/system-health endpoint checks five items (globe_js, uploads_dir, env_forge_url, env_forge_key, database); the earlier eight-point description existed only in v1.4.1 changelog notes before the implementation was simplified.

The API Architecture

The backend is built around a single unified tRPC API composed of 24 domain routers (posts, admin, payments, search, AI, etc.). The admin dashboard primarily interacts with the dedicated admin router, ensuring separation of concerns and easier maintenance.

Version 1.4.4: Streamlining Post Creation

The latest update (v1.4.4, shipped 2026-05-20) streamlined the post-creation process:

  • Country Selector Removed: The country is now auto-detected from the subdomain (e.g., pl.24ad.info → Poland).
  • Currency Auto-Selection: The currency is auto-selected from the subdomain on form load.
  • Category Filters: Labels and options are now translated using values from the database’s translations field.

While basic currency auto-detection existed since v1.1-1.2, this update made it fully subdomain-driven.

Lessons Learned

Building 24ad.info has been a journey filled with technical challenges and valuable lessons:

  1. Test Payment Flows Thoroughly: Small oversights can lead to significant issues when money is involved.
  2. AI is a Double-Edged Sword: While AI automates many tasks, it requires careful tuning and monitoring to ensure accuracy.
  3. Compression Matters: Converting all images to WebP improved performance without requiring complex configurations.
  4. Architecture is Key: A well-structured API architecture (like tRPC’s domain routers) simplifies maintenance and scalability.

What’s Next?

We’re constantly iterating on 24ad.info, with plans to improve the AI models, expand language support, and enhance the user experience. If you’re interested in following our journey, check out the live site at https://24ad.info.

Building in public isn’t always glamorous — bugs happen, features fail — but the transparency and community feedback make it all worthwhile. Here’s to the next chapter in the 24ad.info story.

Top comments (0)