How raja8807/productbase_server works
ProductBase is a multi-tenant product-catalog API. A client’s JWT is verified and converted to a tenant ID; catalog uploads create a product base and tracked import job, then background processing reads and validates Excel rows, generates embeddings, and stores products. Search embeds a query and combines vector and text similarity under tenant filtering. The README documents these capabilities; several peripheral route and service implementations were not sampled, so their internal links are omitted where not evidenced.
Main entry points: routes/products.py Product endpoints · main.py FastAPI application · product_import_service.py Import processing · v1/products.py V1 search endpoint
Components 24
API and identity
- FastAPI application
app/main.py - JWT tenant auth
app/core/auth.py - API key auth
app/core/api_key_auth.py - API key endpoints
app/routes/api_key.py - API key service
app/services/api_key_service.py
Catalog workflows
- Product endpoints
app/routes/products.py - Product base endpoints
app/routes/product_base.py - Product base service
app/services/product_base_service.py - Import processing
app/services/product_import_service.py - Import job endpoints
app/routes/import_job.py - Import job service
app/services/import_job_service.py - Product operations
app/services/product_service.py - Product payload schema
app/schema/product_schema.py
Search and embeddings
- V1 search endpoint
app/routes/v1/products.py - Hybrid search
app/services/product_search_service.py - Embedding generation
app/services/embedding_service.py - Hugging Face inference
Persistence
- API key records
app/models/api_key.py - Import job records
app/models/import_job.py - Product records
app/models/product.py - Product base records
app/models/product_base.py - Database sessions
app/core/database.py
Other components
- Client
- PostgreSQL + pgvector
Connections 30
- Client → FastAPI application: sends requests
README.md - FastAPI application → Product endpoints: mounts routes
app/main.py - FastAPI application → Product base endpoints: mounts routes
app/main.py - FastAPI application → Import job endpoints: mounts routes
app/main.py - FastAPI application → API key endpoints: mounts routes
app/main.py - FastAPI application → V1 search endpoint: mounts routes
app/main.py - Product endpoints → JWT tenant auth: derives tenant
app/routes/products.py - Product base endpoints → JWT tenant auth: derives tenant
app/routes/product_base.py - Import job endpoints → JWT tenant auth: derives tenant
app/routes/import_job.py - API key endpoints → API key service: calls
app/routes/api_key.py - API key service → API key records: manages records
app/services/api_key_service.py - V1 search endpoint → API key auth: requires key
app/routes/v1/products.py - Product endpoints → Import processing: schedules processing
app/routes/products.py - Import processing → Embedding generation: generates vectors
app/services/product_import_service.py - Embedding generation → Hugging Face inference: requests features
app/services/embedding_service.py - Import processing → Product base service: gets product base
app/services/product_import_service.py - Product endpoints → Hybrid search: runs search
app/routes/products.py - Product endpoints → Embedding generation: embeds query
app/routes/products.py - Hybrid search → Product records: queries products
app/services/product_search_service.py - V1 search endpoint → Hybrid search: runs search
app/routes/v1/products.py - V1 search endpoint → Embedding generation: embeds query
app/routes/v1/products.py - Product endpoints → Product operations: calls operations
app/routes/products.py - Product endpoints → Product base records: creates base
app/routes/products.py - Product endpoints → Import job records: creates job
app/routes/products.py - Import processing → Product records: writes products
app/services/product_import_service.py - Import job endpoints → Import job service: calls
app/routes/import_job.py - Import job service → Import job records: reads job state
app/services/import_job_service.py - Product operations → Product records: operates on
app/services/product_service.py - Product endpoints → Product payload schema: accepts payload
app/routes/products.py - Database sessions → PostgreSQL + pgvector: opens sessions