
Budson Valley: Cannabis Directory with Real-Time Inventory Tracking
A comprehensive cannabis directory for the Hudson Valley region featuring live inventory tracking, historical analytics, and real-time data aggregation from multiple dispensary APIs powered by Supabase.
Role
Full-Stack Developer
Duration
Sep 2024 – Present
Published
September 13, 2025
Technology Stack
Background
The Hudson Valley cannabis market needed a comprehensive resource for consumers to discover licensed dispensaries and track product availability. Existing solutions were fragmented, outdated, or lacked real-time inventory information. This created an opportunity to build something genuinely useful for both consumers and the emerging legal cannabis industry.
The project began as a simple directory but evolved into a sophisticated platform featuring live inventory tracking, historical market analytics, and comprehensive dispensary coverage across the Greater Hudson Valley region.
Market Context
- 63+ dispensaries across 30+ cities in the Hudson Valley
- Fragmented information spread across individual dispensary websites
- No centralized inventory tracking for product availability and pricing
- Limited historical data for market trends and analytics
- Regulatory compliance requirements from NY State cannabis laws
Objectives
Create a comprehensive cannabis directory that would serve as the definitive resource for Hudson Valley cannabis consumers while providing valuable market insights through data aggregation.
Primary Goals
- Comprehensive Coverage: Map all licensed dispensaries in the Hudson Valley region
- Real-Time Inventory: Integrate live product data from dispensary APIs
- Historical Analytics: Track pricing trends and market dynamics over time
- User Experience: Provide intuitive search and discovery tools
- Compliance: Ensure all listings comply with NY State cannabis regulations
Success Metrics
- Cover 63+ dispensaries across 30+ Hudson Valley cities
- Integrate live inventory from 10+ dispensaries
- Process 10,000+ product records with real-time updates
- Achieve 99%+ data accuracy and API reliability
- Build sustainable data pipeline for continuous growth
Approach & Process
Phase 1: Foundation & Architecture (Sep 2024)
Started with Next.js for the frontend framework, choosing it for its excellent SEO capabilities, server-side rendering, and robust TypeScript support. Supabase was selected for the backend to provide real-time capabilities, excellent PostgreSQL performance, and built-in authentication.
Initial Architecture Decisions:
- Next.js 14 with App Router for modern React patterns
- Supabase for PostgreSQL database and real-time subscriptions
- TypeScript throughout for type safety and developer experience
- Tailwind CSS for rapid, responsive UI development
Phase 2: Data Architecture & Aggregation (Oct 2024)
The most complex challenge was designing a data architecture that could handle multiple disparate data sources while maintaining data quality and providing historical analytics.
Database Schema Design:
-- Simplified schema structure
CREATE TABLE dispensaries (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
name TEXT NOT NULL,
address JSONB NOT NULL,
coordinates POINT,
license_number TEXT,
api_integration BOOLEAN DEFAULT false,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
CREATE TABLE products (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
dispensary_id UUID REFERENCES dispensaries(id),
name TEXT NOT NULL,
category TEXT NOT NULL,
brand TEXT,
price_data JSONB,
inventory_data JSONB,
last_updated TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
CREATE TABLE inventory_snapshots (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
product_id UUID REFERENCES products(id),
snapshot_data JSONB NOT NULL,
price DECIMAL(10,2),
availability BOOLEAN,
captured_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
Phase 3: API Integration & Real-Time Updates (Nov 2024)
Developed a sophisticated data aggregation pipeline to integrate with multiple dispensary APIs, starting with the Carrot API which powered several major dispensaries in the region.
API Integration Strategy:
- Carrot API Integration: Real-time inventory from 4 major dispensaries
- Automated Cron Jobs: Vercel-based scheduling for data updates every 2-4 hours
- Error Handling: Comprehensive error tracking and recovery mechanisms
- Data Validation: Quality checks to ensure accurate product information
Technology Choices
Next.js 14 with App Router
Why Next.js?
- SEO Critical: Cannabis businesses need strong local SEO presence
- Performance: Server-side rendering for faster initial page loads
- Developer Experience: Excellent TypeScript support and hot reloading
- Deployment: Seamless integration with Vercel for CI/CD
App Router Benefits:
- File-based Routing: Intuitive organization for dispensary and product pages
- Server Components: Reduced JavaScript bundle size for better performance
- Streaming: Progressive page loading for better user experience
- Built-in Loading States: Improved perceived performance
Supabase as Backend Platform
Why Supabase over alternatives?
- PostgreSQL: Robust relational database with excellent performance
- Real-time Subscriptions: Live updates for inventory changes
- Built-in Authentication: Future-ready for user accounts and favorites
- Edge Functions: Serverless functions for complex data processing
- Row Level Security: Fine-grained access control for sensitive data
PostgreSQL Advantages:
- JSONB Support: Flexible storage for varying product data structures
- Geographic Queries: Built-in support for location-based searches
- Full-text Search: Advanced search capabilities across products and dispensaries
- Time-series Data: Efficient storage and querying of historical inventory
API Integration Architecture
Carrot API Implementation:
// Simplified API integration example
export class CarrotAPIClient {
private baseURL: string;
private spaceId: string;
private origin: string;
async fetchInventory(): Promise<Product[]> {
const response = await fetch(`${this.baseURL}/api/spaces/${this.spaceId}/products`, {
headers: {
'Origin': this.origin,
'User-Agent': 'BudsonValley/1.0'
}
});
const data = await response.json();
return this.transformProducts(data.products);
}
private transformProducts(rawProducts: any[]): Product[] {
return rawProducts.map(product => ({
id: product.id,
name: product.name,
category: product.category,
brand: product.brand?.name,
price: product.variants?.[0]?.price,
availability: product.variants?.[0]?.inventory > 0,
lastUpdated: new Date()
}));
}
}
Implementation Details
Data Aggregation Pipeline
The heart of the platform is a sophisticated data aggregation system that runs on Vercel cron jobs, collecting and processing inventory data from multiple sources.
Pipeline Architecture:
- Scheduled Jobs: Vercel cron functions trigger every 2-4 hours
- API Polling: Fetch latest inventory from integrated dispensaries
- Data Transformation: Normalize data structures across different APIs
- Quality Validation: Check for data consistency and accuracy
- Database Updates: Efficiently update PostgreSQL with delta changes
- Snapshot Storage: Archive historical data for trend analysis
Performance Optimizations:
- Delta Updates: Only process changed inventory items
- Batch Processing: Group database operations for efficiency
- Connection Pooling: Optimize database connections
- Error Recovery: Automatic retry logic for failed API calls
Real-Time Features
Live Inventory Updates:
// Real-time subscription for inventory changes
const { data, error } = useSupabaseQuery(
supabase
.from('products')
.select(`
*,
dispensary:dispensaries(name, address),
latest_snapshot:inventory_snapshots(price, availability, captured_at)
`)
.eq('dispensary_id', dispensaryId)
.order('name')
);
// Subscribe to real-time changes
useEffect(() => {
const subscription = supabase
.channel('inventory-updates')
.on('postgres_changes',
{ event: '*', schema: 'public', table: 'products' },
(payload) => {
// Update UI with real-time changes
setProducts(prev => updateProductList(prev, payload));
}
)
.subscribe();
return () => supabase.removeChannel(subscription);
}, []);
Geographic Search Implementation
Location-Based Discovery:
-- Find dispensaries within radius using PostGIS
SELECT
d.*,
ST_Distance(
ST_GeogFromText('POINT(' || $longitude || ' ' || $latitude || ')'),
ST_GeogFromText('POINT(' || (d.coordinates).x || ' ' || (d.coordinates).y || ')')
) / 1609.34 AS distance_miles
FROM dispensaries d
WHERE ST_DWithin(
ST_GeogFromText('POINT(' || $longitude || ' ' || $latitude || ')'),
ST_GeogFromText('POINT(' || (d.coordinates).x || ' ' || (d.coordinates).y || ')'),
$radius_meters
)
ORDER BY distance_miles;
Outcomes
Coverage & Scale
Comprehensive Regional Coverage:
- 63+ dispensaries mapped across the Hudson Valley
- 30+ cities covered including major markets like Kingston, Newburgh, Poughkeepsie
- 5 counties spanning the greater Hudson Valley region
- 1,200+ products tracked with live inventory data
Live Integration Success:
Currently integrated with 4 major dispensaries via Carrot API:
- Green Leaf Newburgh: 1,200+ products
- Big Gas Dispensary (New Paltz): 800+ products
- Catskill Mountain High (Kingston): 900+ products
- Stellar Cannabis Dispensary (Newburgh): 600+ products
Technical Performance
System Reliability:
- 99.7% API success rate for inventory updates
- Sub-2 second page load times for search results
- 2-4 hour update frequency for live inventory data
- Zero downtime since launch thanks to Vercel's infrastructure
Data Quality:
- Automated validation catches 95%+ of data inconsistencies
- Historical tracking enables trend analysis and market insights
- Real-time updates keep inventory information current
- Comprehensive error logging for continuous improvement
User Experience
Search & Discovery:
- Advanced filtering by location, product category, price range
- Interactive maps for visual dispensary discovery
- Mobile-responsive design optimized for on-the-go searches
- SEO optimization for local cannabis searches
Learnings
Technical Wins
Supabase as a Platform: The choice of Supabase proved excellent for this use case. The combination of PostgreSQL's robustness with real-time capabilities provided exactly what was needed for a live inventory system.
API-First Architecture: Building with multiple API integrations from the start created a flexible foundation that easily accommodates new dispensary partnerships.
Next.js Performance: The App Router's server components significantly improved performance, especially important for SEO-critical local business searches.
Challenges Overcome
Data Normalization: Each dispensary API has unique data structures. Building flexible transformation layers was crucial for maintaining data consistency while accommodating various formats.
Rate Limiting & Reliability: Different APIs have varying rate limits and reliability characteristics. Implementing adaptive retry logic and fallback mechanisms improved overall system stability.
Cannabis Industry Compliance: Navigating the legal landscape required careful attention to state regulations and advertising restrictions while building useful consumer tools.
Areas for Enhancement
Expanded Integrations: Currently focused on Carrot API dispensaries. Plans include:
- Dutchie Integration: Several major dispensaries use this platform
- Direct API Partnerships: Custom integrations with larger dispensary groups
- Leafly Connect: Integration with their dispensary network
Advanced Features:
- Price Alerts: Notify users when specific products become available
- Strain Information: Detailed cannabis genetics and effects data
- User Reviews: Community-driven dispensary and product ratings
- Analytics Dashboard: Public market insights and trends
Next Steps
Short-term Roadmap (Q1 2025)
Expand API Integrations:
- Add 6+ more Carrot API dispensaries already identified
- Begin Dutchie platform integration for broader coverage
- Implement direct partnerships with major dispensary groups
Enhanced User Features:
- Advanced search filters (THC/CBD content, effects, genetics)
- Product availability notifications
- Dispensary comparison tools
Long-term Vision (2025)
Market Intelligence Platform:
- Public Analytics: Market trends, pricing insights, popular products
- Business Intelligence: Dispensary performance metrics (with permissions)
- Consumer Insights: Anonymized purchasing pattern analysis
Community Features:
- User Accounts: Save favorites, track purchase history
- Review System: Community-driven dispensary and product ratings
- Educational Content: Cannabis education and responsible use information
Regional Expansion:
- New York State: Expand beyond Hudson Valley to other regions
- Multi-State: Potential expansion to other legal cannabis markets
- White Label: Platform licensing for other cannabis directories
This project demonstrates the power of modern web technologies to create valuable resources for emerging industries. By combining real-time data aggregation with user-friendly interfaces, we've built a platform that serves both immediate consumer needs and long-term market intelligence goals.
Interested in working together?
I'm always open to discussing new projects and opportunities. Let's talk about how we can bring your ideas to life.