A Beckn Application Provider (BAP) backend service that acts as middleware between the Jobstack application and the Beckn network. It handles protocol translation, job search, profile synchronization, and job-profile matching.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Jobstack App │──────│ BAP Onest Lite │──────│ Beckn Network │
│ (Frontend) │ │ (This App) │ │ (BPP/BC) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
├── PostgreSQL (Jobs, Profiles, Applications)
├── Redis (Caching, Pub/Sub)
├── FAISS (Vector Search)
└── GCP Gemini (Embeddings)
- Beckn Protocol Communication: Translates between REST API and Beckn protocol format
- Job Search: Searches for jobs from BPP (Beckn Provider Platform) via Jobstack
- Profile Sync: Fetches and stores candidate profiles from Jobstack seeker service
- Match Scoring: Computes job-profile compatibility scores using embeddings
- Job Applications: Handles job application submissions
- Notifications: Sends WhatsApp notifications for high-match candidates
- Vector Search: Uses FAISS for semantic job matching
- RESTful API for job search, selection, application, and status tracking
- Beckn protocol integration (on_search, on_select, on_init, on_confirm, on_status)
- PostgreSQL database for persistent storage
- Redis for caching and pub/sub messaging
- FAISS vector search for semantic job matching
- GCP Gemini embeddings for candidate-job matching
- Background cron jobs for data synchronization
- WhatsApp notifications for high-match candidates
- Rust 1.77+ (with cargo)
- PostgreSQL 14+
- Redis 6+
- Docker & Docker Compose (optional, for containerized setup)
- FAISS (optional, for vector search on macOS)
brew install faiss
export LIBRARY_PATH="/opt/homebrew/lib:$LIBRARY_PATH"
export DYLD_LIBRARY_PATH="/opt/homebrew/lib:$DYLD_LIBRARY_PATH"git clone <repository-url>
cd bap-onest-litecargo build --release# Copy environment template
cp .env.example .env
# Edit .env with your database credentials# Copy example configuration
cp config/example.yaml config/local.yaml
# Edit config/local.yaml with your settings# Make migration script executable
chmod +x migrate.sh
# Run migrations
./migrate.sh| File | Purpose |
|---|---|
config/local.yaml |
Local development configuration |
config/dev.yaml |
Development environment |
config/prod.yaml |
Production environment |
config/example.yaml |
Template with all options |
The YAML configuration includes:
- http: Server address and port
- bap: BAP identifier, URIs, domain, version, TTL
- redis: Redis connection URL
- db: PostgreSQL connection string
- cache: TTL and throttle settings
- cron: Scheduled task intervals
- gcp: Google Gemini embedding config
- services: External service URLs (seeker, notification, geocoding)
- bpp: BPP configuration for profiles
- auth: API key authentication
- match_score: Match scoring configuration
See .env.example for all required environment variables.
cargo run -- config/local.yamlThe server will start on http://0.0.0.0:3008 (or configured port).
# Build and start all services
docker compose build --no-cache
docker compose up -d
# View logs
docker compose logs -f bap-onest-lite
# Stop services
docker compose down- bap-postgres: PostgreSQL database
- bap-redis: Redis cache
- bap-onest-lite: This application
GET /api/v1/search- Basic job searchGET /api/v2/search- Advanced search with filteringGET /api/v3/search- Database-backed searchGET /api/v1/search/top- Vector similarity search
POST /api/v1/apply- Submit job application (V1)POST /api/v2/apply- Submit job application (V2)GET /api/v1/job-applications- List applications
POST /api/v1/draft- Create draftGET /api/v1/draft- List draftsPUT /api/v1/draft/:id- Update draftDELETE /api/v1/draft/:id- Delete draft
GET /api/v1/profiles- Search profilesGET /api/v1/profiles/:id- Get profile by ID
POST /webhook/on_search- Job search responsePOST /webhook/on_select- Selection responsePOST /webhook/on_init- Initialization responsePOST /webhook/on_confirm- Confirmation responsePOST /webhook/on_status- Status update
POST /api/v1/admin/rebuild-faiss- Rebuild FAISS index
The application uses tokio-cron-scheduler for background tasks:
| Task | Default Interval | Description |
|---|---|---|
fetch_jobs |
3600s (1 hour) | Fetches open jobs from BPP |
fetch_profiles |
86400s (24 hours) | Syncs profiles from Jobstack |
compute_match_scores |
10800s (3 hours) | Calculates job-profile match scores |
notification |
Weekly (configurable) | Sends WhatsApp notifications for high matches |
Edit the cron section in your YAML config:
cron:
fetch_jobs:
seconds: 3600
fetch_profiles:
seconds: 86400
compute_match_scores:
seconds: 10800
batch: 50
source: 'empeding'
notification:
schedule_type: 'weekly'
weekday: 1
hour: 1
minute: 1
min_score: 7
batch: 30Migrations are stored in the migrations/ directory and use SQLx.
| File | Description |
|---|---|
20250702105235_job_applications.sql |
Job application tracking |
20250805051511_draft_applications.sql |
Draft applications |
20260113090834_profiles.sql |
Candidate profiles |
20260202091820_jobs.sql |
Job records |
20260204070509_job_profile_matches.sql |
Match scores with trigram indexes |
20260307193403_add_is_active_column_to_jobs.sql |
Active job flag |
20260324053703_add_embedding_to_jobs.sql |
Embedding column for vector search |
# Run all pending migrations
./migrate.sh
# Or use SQLx CLI directly
cargo install sqlx-cli
sqlx migrate runThe match scoring system uses config/match_score.json to define weights for different factors. The configuration supports:
- Skill matching weights
- Experience matching weights
- Location proximity scoring
- Salary range matching
- Business logic application
cargo testcargo fmt
cargo clippyEdit Cargo.toml and run:
cargo update- Ensure PostgreSQL is running and accessible
- Check Redis connection URL in config
- Verify firewall rules allow connections
# If FAISS fails to load, set library paths
export LIBRARY_PATH="/opt/homebrew/lib:$LIBRARY_PATH"
export DYLD_LIBRARY_PATH="/opt/homebrew/lib:$DYLD_LIBRARY_PATH"- Check application logs for cron initialization messages
- Verify cron intervals are properly configured
- Ensure database is accessible for background tasks
- Adjust batch sizes in cron configuration
- Monitor Redis memory usage
- Consider increasing PostgreSQL connection pool size
bap-onest-lite/
├── src/
│ ├── main.rs # Application entry point
│ ├── config.rs # Configuration management
│ ├── http/ # HTTP server and routes
│ │ └── routes/ # API endpoint handlers
│ ├── services/ # Business logic layer
│ ├── db/ # Database operations
│ ├── models/ # Data models
│ ├── utils/ # Utility functions
│ ├── cron/ # Scheduled tasks
│ ├── events/ # Event system
│ ├── workers/ # Background workers
│ └── vector/ # FAISS vector search
├── migrations/ # Database migrations
├── config/ # Configuration files
├── docker-compose.yml # Docker setup
├── Dockerfile # Container build
├── migrate.sh # Migration script
└── README.md # This file
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions, please open an issue or contact the maintainers.