Intelligent Search & Filtering Engine built with Next.js 16 and Supabase.
- Intelligent Search: Keyword search across title, description, and company using PostgreSQL
pg_trgmfor 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.
- 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.
-
Clone and Install
git clone <repo-url> cd neuralquery npm install
-
Supabase Setup
- Create a new project on Supabase.
- Go to the SQL Editor in your Supabase dashboard.
- Copy the contents of
supabase/schema.sqland run it. This will:- Enable
pg_trgmextension. - Create the
jobstable. - Enable Row Level Security (RLS).
- Create optimized indexes.
- Seed the database with sample data.
- Enable
-
Environment Variables
- Copy
.env.exampleto.env.local - Fill in your Supabase URL and Anon Key.
cp .env.example .env.local
- Copy
-
Run Development Server
npm run dev
Open http://localhost:3000.
POST /api/records
Request Body:
{
"title": "Software Engineer",
"description": "Develop web applications",
"company": "Tech Corp",
"location": "Remote",
"experience": 3,
"salary": 120000
}GET /api/records
Query Parameters:
q: Search querylocation: Filter by locationminExperience,maxExperience: Filter by years of experienceminSalary,maxSalary: Filter by salary rangesortBy:created_at(default) orsalaryorder:ascordesc(default)page: Page number (default 1)limit: Items per page (default 10)
The core search logic resides in lib/services/jobs.ts. It constructs a dynamic Supabase query based on provided parameters:
- Keyword Search: Uses
ORlogic combined withilikeoperators ontitle,description, andcompanycolumns. (Note: For large scale,tsvectorFull Text Search would be the next upgrade). - Filtering: Applies
ANDfilters 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.
- GIN Indexes (
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.
- 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
tsvectorfor scalable full-text search. - Analytics: Dashboard for job view counts and application tracking.


