Smart Vending Machine Platform - Developer Guide
Daycast is a platform for operating smart vending machines. It allows users to:
The Hardware Proxy is the strategy for deploying new machines. This approach allows SandStar (the hardware provider) to continue their standard installation process without any changes - they configure machines to point to TNS-Web as they always have.
How it works: Daycast handles the user interface and Stripe payments, while TNS-Web acts as a bridge to control the physical hardware (door open/close, product detection).
๐ Migration Plan: This bridge will be tested and validated over time. Once stable, the legacy TNS-Web system will be gradually deprecated, and new machines will be migrated to connect directly to the Daycast system without the proxy layer.
Machines with hardware_proxy = True use this mode. Check the admin panel to see which machines are in proxy mode.
daycast-workspace/) to use Claude Code at the root level for both projects simultaneously.
| Status | Code | Description |
|---|---|---|
| PENDING | 1 | Transaction started, door open |
| SUCCESSFUL | 2 | Payment completed successfully |
| PENDING_PAYMENT | 9 | Door closed, awaiting payment |
| FAILED | 3 | Error in the process |
TNS-Web has 23+ Django apps. Key ones for vending: vending/, payments/, integrations/
| File | Purpose |
|---|---|
backend/apps/transactions/ |
Transaction model, states, payment logic |
backend/apps/machines/models.py |
VendingMachine model, test modes, hardware proxy |
frontend/src/machines/VendingMachine.ts |
Main XState machine for purchase flow |
frontend/src/services/index.ts |
All API calls (vmStart, vmPay, etc.) |
tns-web/vending/views.py |
Legacy vending endpoints (hardware control) |
tns-web/integrations/sandstar/ |
SandStar hardware API integration |
To run services
For frontend
For secrets
Search in 1Password under "Daycast":
โข Backend: "Daycast | Backend env.local"
โข Frontend: "Daycast | Frontend env"
TNS-Web is needed when working with vending machines that use the Hardware Proxy bridge.
Search in 1Password: "TNS-Web | env"
TNS-Web runs on http://localhost:8000 - Note: If running both, change Daycast backend port.
| Environment | URL |
|---|---|
| Local Frontend | http://localhost:3000 |
| Local API | http://localhost:8000/api/v1/ |
| Local Admin | http://localhost:8000/admin/ |
| Staging Admin | https://backend.staging.daycast.co/admin/ |
| Production Admin | https://backend.daycast.co/admin/ |
๐ Credentials: Search in 1Password under "Daycast" for admin credentials.
Azure, Sentry, Mailgun, Cloudflare, Stripe, SandStar VMS, Notion y mรกs...
This project is developed using Claude Code as the primary AI assistant. Claude has access to specialized skills and agents that understand the Daycast codebase.
cd skills && ./setup.sh to configure Claude Code skills for this project.
Skills are auto-invoked based on context. You can also call them explicitly.
Django 5.2 + DRF: ViewSets, serializers, models, async tasks
React 18 + XState: Components, hooks, state machines
Payments: Checkout, webhooks, SetupIntents
PostgreSQL queries with Azure credentials
SandStar VMS hardware integration
Azure resources: Key Vault, Web Apps, DB
Automated code review with prioritization
Docker, Compose, GitHub Actions
Opens this documentation in browser
| Agent | Purpose | When Used |
|---|---|---|
| backend-reviewer | Python/Django code review | When reviewing .py files |
| frontend-reviewer | React/TypeScript code review | When reviewing .tsx/.ts files |
| security-auditor | Security vulnerability audit | Security-sensitive code, pre-deploy |
| test-writer | Generates pytest/Vitest tests | When writing tests |
| architect | Architecture decisions | Feature design discussions |
Claude Code has access to Azure MCP (Model Context Protocol) which allows direct interaction with Azure resources without leaving the editor.
| Database Queries | Use /db-query skill - Claude retrieves credentials from Azure Key Vault automatically |
| View Logs | Ask Claude to "show logs from web-app" or "tail staging logs" |
| Key Vault | Claude can read secrets from daycast-keyvault for scripts |
| Resource Info | Ask about web app status, settings, or configuration |
az login with azure@newstand.com.
These are the coding standards and best practices for the Daycast project. All contributors should follow these guidelines.
| Formatter | Black (line-length: 88) |
| Imports | isort with Django profile |
| Linting | flake8 |
| Type Hints | Required on all public functions |
snake_case for functions, variables, modulesPascalCase for classesselect_related / prefetch_related for related objects@extend_schema for API documentationprint() instead of logging.env files| Linting | ESLint (airbnb-style) |
| Formatting | Prettier (integrated) |
| TypeScript | Strict mode enabled |
PascalCase for componentscamelCase for hooks and utilsany type (use proper types)console.log in production code// @ts-ignoreThe app uses the View Transitions API for smooth page transitions between category cards and detail views.
Location: src/hooks/useViewTransition.ts
Elements with matching viewTransitionName will morph smoothly between pages.
Location: src/types/view-transitions.d.ts
React.CSSProperties with viewTransitionNameDocument.startViewTransition() typeViewTransition interfaceprefers-reduced-motionUse conventional commits:
Tests location: backend/tests/<app>/test_*.py
Tests colocated: Component.test.tsx next to component
Tests location: pytests/
| Daycast Swagger | localhost:8000/api/docs/ |
| Daycast ReDoc | localhost:8000/api/redoc/ |
| TNS-Web Swagger | localhost:8000/data/swagger/ |
/api/v1/transactions/setup/ to create SetupIntent/api/v1/transactions/start/Hardware Proxy is the bridge between Daycast and the legacy TNS-Web system for controlling vending machine hardware.
Machines with hardware_proxy = True use this mode.
| PENDING (1) | Door is open, user selecting products |
| SUCCESSFUL (2) | Payment completed |
| FAILED (3) | Error occurred |
| PENDING_PAYMENT (9) | Door closed, processing payment |
| DOOR_MALFUNCTION (6) | Door error detected |
| EMPTY_VEND (7) | No products taken |
Machines with is_free_vend = True allow users to take products without payment. The door opens normally but no charge is made.
Use case: Employee perks, promotional events, or subsidized vending.
All credentials are stored in 1Password under the "Daycast" vault:
Daycast | Backend env.local - Local env fileDaycast | Frontend env - Frontend env fileDaycast | Admin credentials - Staging/prod adminmake upyarn devtest_mode/qr/?vending_machine=MACHINE_IDUse Stripe test cards: 4242 4242 4242 4242
Common issues and how to resolve them. This guide is also useful for the support team.
lsof -i :8000 and lsof -i :5432make down && make updocker-compose build --no-cachecurl http://localhost:8000/api/v1/VITE_API_URL in frontend envThe door closed but payment wasn't processed.
order_detail in transaction)/db-query skill to investigate the statehardware_proxy = TrueTNS_VENDING_API_URLTNS_VENDING_API_TOKENexternal_id matches SandStar machine IDTransactionSetupIntent for error messagesThis requires manual refund investigation.
order_detail for items takenExternal systems and portals used to manage and monitor the Daycast platform.
Vending Management System for monitoring and controlling SandStar hardware.
URL: https://vms-us.sandstar.com/
Login: https://vms-us.sandstar.com/#/login
Credentials: 1Password โ search "SandStar VMS"
Important Slack channels for monitoring and alerts.
| Channel | Purpose |
|---|---|
#ns-sandstar-logs |
SandStar integration errors (API failures, door errors, token issues) |
#ns-sandstar-logs for real-time hardware communication issues.Backend administration panel for managing platform data.
Local: http://localhost:8000/admin/
Production: Check deployment docs for URL
Credentials: 1Password โ search "Daycast Admin"
Payment processing and transaction management.
URL: https://dashboard.stripe.com/
Credentials: 1Password โ search "Stripe"
Account: azure@newstand.com (credentials in 1Password)
| Production |
web-app
Portal
|
| Staging |
daycast-staging
Portal
|
| TNS-Web |
tns-web (prod & staging)
Rancher
|
Azure Portal - Use azure@newstand.com
Monitor errors and exceptions in production.
| Organization | new-stand-ka.sentry.io |
| Project: Daycast | ns-platform |
| Project: TNS-Web | tns-web |
๐ Credentials in 1Password under "Sentry"
Transactional emails: receipts, password resets, notifications.
| Dashboard | app.mailgun.com |
| Domain | mg.daycast.co |
๐ Credentials in 1Password under "Mailgun"
DNS management, CDN, and Cloudflare Pages for frontend hosting.
| Dashboard | dash.cloudflare.com |
| Domain | daycast.co |
| Pages (Frontend) | daycast-pwa |
๐ Credentials in 1Password under "Cloudflare"
Project documentation, specs, and historical context. Contains mixed TNS-Web and Daycast docs.
| Project Docs | New Stand Workspace |
๐ Request access from team lead