Skip to content

NeuralQuery: Intelligent Search & Filtering Engine built with Next.js 16 and Supabase. Features fuzzy keyword matching, multi-filter composition, deep linking, and server-side optimizations.

Notifications You must be signed in to change notification settings

GivenBY/neuralquery

Repository files navigation

NeuralQuery

Intelligent Search & Filtering Engine built with Next.js 16 and Supabase.

View Live Demo

Features

NeuralQuery Homepage

  • Intelligent Search: Keyword search across title, description, and company using PostgreSQL pg_trgm for fuzzy matching.
  • Advanced Filtering: Combine Location, Experience, and Salary range filters seamlessly.
  • Dynamic Sorting: Sort by Salary or Date (Newest first).
  • Pagination: Efficient server-side pagination.
  • Deep Linking: All search states (query, filters, sort, page) are synced to the URL, enabling easy sharing and navigation history.
  • Optimization: Debounced search inputs to reduce database load.
  • Rate Limiting: IP-based rate limiting to prevent abuse.

Loading Skeleton to make it UX friendly

Loading Skeleton

Tech Stack

  • Frontend: Next.js 16 (App Router), React 19, Tailwind CSS.
  • Backend: Next.js Server Actions / API Routes.
  • Database: Supabase (PostgreSQL).
  • Styling: Tailwind CSS + Lucide Icons.

Setup Instructions

  1. Clone and Install

    git clone <repo-url>
    cd neuralquery
    npm install
  2. Supabase Setup

    • Create a new project on Supabase.
    • Go to the SQL Editor in your Supabase dashboard.
    • Copy the contents of supabase/schema.sql and run it. This will:
      • Enable pg_trgm extension.
      • Create the jobs table.
      • Enable Row Level Security (RLS).
      • Create optimized indexes.
      • Seed the database with sample data.
  3. Environment Variables

    • Copy .env.example to .env.local
    • Fill in your Supabase URL and Anon Key.
    cp .env.example .env.local
  4. Run Development Server

    npm run dev

    Open http://localhost:3000.

API Endpoints

Create Record

POST /api/records

Create Record

Request Body:

{
  "title": "Software Engineer",
  "description": "Develop web applications",
  "company": "Tech Corp",
  "location": "Remote",
  "experience": 3,
  "salary": 120000
}

List & Search Records

GET /api/records

Query Parameters:

  • q: Search query
  • location: Filter by location
  • minExperience, maxExperience: Filter by years of experience
  • minSalary, maxSalary: Filter by salary range
  • sortBy: created_at (default) or salary
  • order: asc or desc (default)
  • page: Page number (default 1)
  • limit: Items per page (default 10)

Architecture & Logic

Search Logic

The core search logic resides in lib/services/jobs.ts. It constructs a dynamic Supabase query based on provided parameters:

  • Keyword Search: Uses OR logic combined with ilike operators on title, description, and company columns. (Note: For large scale, tsvector Full Text Search would be the next upgrade).
  • Filtering: Applies AND filters for accurate drill-down.
  • Performance:
    • GIN Indexes (gin_trgm_ops) are used on text columns for fast pattern matching.
    • B-Tree Indexes are used on numeric/date columns for range queries and sorting.

Project Structure

  • app/: Next.js App Router pages and API routes.
  • components/: Reusable UI components (Client components for interactivity).
  • lib/: Shared types and business logic (Service layer).
  • utils/: Database client utilities.

🚧 Future Improvements & Limitations

  • Authentication: Usage of Supabase Auth is potential next step. Currently, the application is open for demonstration purposes (anyone can post jobs). In a production environment, Row Level Security (RLS) policies would be restricted to authenticated users.
  • API Security: The API endpoints (POST /api/records) currently have no authentication or rate limiting beyond basic IP-based throttle. production use would require API keys or OAuth.
  • Full Text Search: Migrate to tsvector for scalable full-text search.
  • Analytics: Dashboard for job view counts and application tracking.

About

NeuralQuery: Intelligent Search & Filtering Engine built with Next.js 16 and Supabase. Features fuzzy keyword matching, multi-filter composition, deep linking, and server-side optimizations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published