Platform Demo
Overview
SPN uses a PostgreSQL-first hybrid approach. PostgreSQL is the single source of truth for all structured data. Sanity CMS is used exclusively for rich media content (logos, hero images, galleries).Why PostgreSQL-First?
No Document Limits
Sanity free tier caps at 10K documents. PostgreSQL handles millions of records with no limits.
Full-Text Search
PostgreSQL
tsvector delivers sub-50ms search across 100K+ records — no external search service needed.Relational Integrity
UUID foreign keys with CASCADE ensure referential integrity across companies, users, products, and contacts.
Simpler Integrations
One-way pushes to Zoho and WhatsApp — no complex bi-directional syncs to maintain.
| Aspect | Old Approach | New Approach |
|---|---|---|
| Company data | Sanity CMS (10K limit) | PostgreSQL (unlimited) |
| Catalog | Sanity + DB split | PostgreSQL only |
| Search | Sanity API | PostgreSQL tsvector (<50ms) |
| Direct API | XML bulk feed | |
| CRM sync | Bi-directional | One-way push |
Tech Stack
Backend
Backend
- Python 3.11 / FastAPI 0.115
- PostgreSQL 15 + SQLAlchemy 2.0 (async)
- Alembic — database migrations
- Pydantic 2.x — request/response validation
- slowapi — rate limiting
- Docker — containerised deployment
Frontend
Frontend
- React 19 / TypeScript 5.9
- Vite 7 — build tool
- Tailwind CSS 4 — styling
- React Router DOM 7 — routing
- Axios — HTTP client with JWT interceptor
External Services
External Services
- Sanity CMS v3 — rich media content only
- AWS S3 — file storage (product images, profile pictures)
- Google Gemini AI — virtual try-on image generation
- TalkingShops — WhatsApp Business API
- Zoho CRM — one-way lead sync
- Caddy — reverse proxy + automatic HTTPS
Database Schema
Core Tables
| Table | Purpose |
|---|---|
users | User accounts (linked to a company) |
companies | Supplier/buyer company profiles |
catalog_products | Product listings |
contacts | Company contact persons |
enquiries | Buyer-to-supplier leads |
refresh_tokens | JWT refresh token store |
tryon_jobs | AI try-on generation jobs |
created_at / updated_at timestamps.
Full-Text Search
Integration Patterns
WhatsApp Catalog
Zoho CRM
Sanity CMS (Media Only)
Rate Limiting
All endpoints useslowapi. Limits are configurable via environment variables.
| Tier | Default | Applied To |
|---|---|---|
AUTH | 20/min | Login, register, password reset |
GENERAL | 120/min | Authenticated CRUD endpoints |
UPLOAD | 10/min | File uploads |
PUBLIC | 60/min | Public unauthenticated endpoints |
RATE_LIMIT_ENABLED=false to disable all limits (useful for testing).
Project Structure
Next Steps
Quickstart
Run SPN locally in under 5 minutes
API Reference
Explore all REST endpoints