AlejoTaller uses Pusher Channels as its real-time event bus. When an operator confirms or rejects a customer sale, the operator Android app updates Appwrite and then calls theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/danielitoCode/AlejoTaller/llms.txt
Use this file to discover all available pages before exploring further.
alejo_publisher microservice, which signs and triggers a Pusher event on a per-user channel. Both the client Android app and the Svelte web client subscribe to that channel and update their UI instantly — without polling. This page explains how to create and wire up the Pusher app that powers this flow.
Why Pusher (and Not Direct Client Triggering)
Pusher’s server-side trigger API requires an app secret, which must never be bundled inside a mobile APK or a client-side JavaScript bundle. AlejoTaller solves this by routing all publish calls through thealejo_publisher microservice:
- The operator app calls
POST /sale-verification/publishon the publisher (authenticated with a Bearer token). - The publisher holds the Pusher secret server-side and signs the trigger request.
- Pusher delivers the event to all subscribed clients.
Setup Steps
alejo-taller-prod).Select the cluster closest to your users. For AlejoTaller’s primary market in Latin America,
mt1 (US East / Miami) offers the lowest latency.The cluster value must be identical in every place it appears:
PUSHER_CLUSTER in the publisher .env, VITE_PUSHER_CLUSTER in the web .env, and PUSHER_CLUSTER in Android local.properties. A mismatch will cause subscription failures.PUSHER_APP_IDVITE_PUSHER_APP_IDPUSHER_APP_IDPUSHER_KEYVITE_PUSHER_KEYPUSHER_API_KEYPUSHER_SECRETVITE_PUSHER_SECRETS ⚠️PUSHER_API_SECRETSPUSHER_CLUSTERVITE_PUSHER_CLUSTERPUSHER_CLUSTERThe Key is public and safe to ship in the browser bundle and APK. The Secret must only live in server-side environments.
In the Pusher dashboard under App Settings, you can restrict which origins are allowed to connect. Set this to your production web domain (e.g.
https://alejotaller.onrender.com) to prevent unauthorized subscriptions.For the
alejo_publisher microservice, configure the ALLOW_ORIGIN environment variable to your web client’s domain so the Express CORS middleware only accepts requests from trusted origins.VITE_PUSHER_APP_ID=<your-app-id>
VITE_PUSHER_KEY=<your-pusher-key>
VITE_PUSHER_CLUSTER=mt1
# Named channels — choose names that match across all surfaces
VITE_PUSHER_SUPPORT_CHANNEL=support-channel
VITE_PUSHER_PROMO_CHANNEL=promo-channel
VITE_PUSHER_NOTIFICATION_CHANNEL=notification-channel
VITE_PUSHER_IA_CHANNEL=ia-channel
PUSHER_APP_ID=<your-app-id>
PUSHER_KEY=<your-pusher-key>
PUSHER_SECRET=<your-pusher-secret>
PUSHER_CLUSTER=mt1
PUSHER_APP_ID=<your-app-id>
PUSHER_API_KEY=<your-pusher-key>
PUSHER_API_SECRETS=<your-pusher-secret>
PUSHER_CLUSTER=mt1
PUSHER_SALE_CHANNEL=sale-verification-
PUSHER_SUPPORT_CHANNEL=support-channel
PUSHER_PROMO_CHANNEL=promo-channel
PUSHER_NOTIFICATION_CHANNEL=notification-channel
PUSHER_IA_CHANNEL=ia-channel
Channel Naming Conventions
AlejoTaller uses a small set of well-defined channel names. All channel names must be consistent across the publisher, the web client, and the two Android apps.Sale Verification Channel
sale-verification- prefix:
Named Broadcast Channels
These channels carry application-wide events and are configured by name in the environment variables. The channel names are arbitrary strings — what matters is that the publisher and all subscribers use the same value.| Channel Variable | Purpose |
|---|---|
VITE_PUSHER_SUPPORT_CHANNEL | Customer support messages and operator responses. |
VITE_PUSHER_PROMO_CHANNEL | Promotional broadcasts pushed to all connected clients. |
VITE_PUSHER_NOTIFICATION_CHANNEL | General in-app notifications (e.g. stock updates, announcements). |
VITE_PUSHER_IA_CHANNEL | Reserved for AI-driven interaction events. |
Events Reference
sale-verification-{userId} channel
| Event | Trigger | Payload fields |
|---|---|---|
sale:confirmed | Operator approves the sale. | saleId, userId, decision, timestamp, amount, productCount, type, cause |
sale:rejected | Operator rejects the sale. | saleId, userId, decision, timestamp, amount, productCount, type, cause |
decision field in the payload mirrors the event name (confirmed or rejected). The cause field is null for confirmations and may contain a rejection reason string for rejections.
A typical confirmed-sale payload looks like this:
Verifying the Integration
Once all credentials are in place, use the Pusher dashboard’s Debug Console to observe live events:- Open the Pusher dashboard for your app and go to Debug Console.
- Start your local publisher:
cd function/alejo_publisher && npm run dev. - Send a test publish request:
- The Debug Console should show the event arriving on channel
sale-verification-test-user-001with event namesale:confirmed.
For the complete list of Pusher-related environment variables across all surfaces, see the Environment Variables Reference.