Case study
Astrology marketplace
An astrology marketplace for human and AI sessions, kundli charts, and a wallet. Recharge is mock UPI or card. A call product was built and then removed.

Summary
A marketplace for human astrologers and AI personas, with kundli and panchang, YouTube live, a shop and pooja, and a wallet. Recharge is mock UPI and card. A call product was built and then removed.
Role. The engineering notes record this as an end-to-end astrology marketplace, including design and implementation. Human chat and AI chat share one wallet.
Outcome. Human chat and AI chat both debit the wallet per minute. Charts use Swiss Ephemeris. Language models are Groq, Gemini, and xAI. Payments are mock recharge. Without the optional Socket.IO Redis adapter, chat stays on one process.
The business gap
The gap
Sessions with a person and sessions with a model need the same wallet, the same minute tick, and a chart that does not depend on a chat transcript. Recharge cannot be described as a live processor.
Why it was built
The notes describe a marketplace that had to run human chat, an AI astrologer, kundli and panchang, live and shop surfaces, and a wallet. A call product was built and then removed.
How the build closed it
A web SPA, an Expo customer app, and an Expo provider app enter through nginx into Fastify and Socket.IO. Postgres holds users, sessions, and the wallet. Redis and BullMQ run OTP, AI state, and the panchang cron. Human chat stores a rate per minute, debits the wallet, writes a SessionBillingTick, and prechecks affordable minutes. AI chat routes a cheap Groq model first, Gemini for complex turns and vision, and xAI as fallback. Swiss Ephemeris produces Lahiri sidereal charts, dasha, ashtakoot milan, and a panchang cron. Recharge is mock UPI and card. firebase-admin is listed with no send path. The Socket.IO Redis adapter is optional; without it, chat is single-process.
Architecture
The source notes describe this system as a graph, not as a picture file. The diagram below is that graph: every box and every link is a node or an edge from the notes.
- Client
- API
- Queue
- Data
- External
Parts
- Vite SPA: Customer and admin in one app.
- Expo customer: Android app. Zustand holds wallet and session.
- Expo provider: Astrologer queue, live, and payouts.
- nginx TLS: SPA, API, and MinIO proxy.
- Fastify + Socket.IO: Auth, chat, shop, live, AI bot, and CMS.
- Postgres Prisma: Users, sessions, wallet, shop, and AI.
- Redis + BullMQ: OTP limits, AI state, five job queues, and the panchang cron.
- MinIO: Uploads and profile photos.
- Groq / Gemini / xAI: Hybrid model routing for the AI astrologer.
- Swiss Ephemeris: Lahiri sidereal kundli, dasha, and milan.
Connections
- Vite SPA to nginx TLS: HTTPS.
- Expo customer to nginx TLS: HTTPS.
- Expo provider to nginx TLS: HTTPS.
- nginx TLS to Fastify + Socket.IO: proxy.
- Fastify + Socket.IO to Postgres Prisma: billing tick.
- Fastify + Socket.IO to Redis + BullMQ: queues.
- Fastify + Socket.IO to MinIO: media.
- Fastify + Socket.IO to Groq / Gemini / xAI: AI turn.
- Fastify + Socket.IO to Swiss Ephemeris: kundli.
High-level design
- A web SPA, an Expo customer app, and an Expo provider app enter through nginx TLS into Fastify and Socket.IO.
- Postgres holds users, sessions, and the wallet. Redis and BullMQ run OTP, AI state, and the panchang cron.
- Human and AI chat both tick the wallet per minute. Groq, Gemini, and xAI serve the AI astrologer. Swiss Ephemeris builds the kundli.
Low-level design
- Human chat stores a rate per minute, debits the wallet, writes a SessionBillingTick, and prechecks affordable minutes.
- AI chat routes a cheap Groq model first, Gemini for complex turns and vision, and xAI as fallback.
- Swiss Ephemeris produces Lahiri sidereal charts, dasha, ashtakoot milan, and a panchang cron.
Infrastructure and services
- Postgres Prisma. Users, sessions, wallet, shop, and AI.
- Redis + BullMQ. OTP limits, AI state, five job queues, and the panchang cron.
- MinIO. Uploads and profile photos.
- Groq / Gemini / xAI. Hybrid model routing for the AI astrologer.
- Swiss Ephemeris. Lahiri sidereal kundli, dasha, and milan.
Tech stack
Fastify
Prisma
PostgreSQL
Redis
- BullMQ
Socket.IO
nginx
Vite
Expo
MinIO
Gemini
- Groq
xAI
- Swiss Ephemeris
Logos are Simple Icons shipped with this site. Where a brand mark is unavailable, the name is shown on its own.
Client review
Human sessions, AI sessions and the wallet are cleanly separated. Recharge paths are obvious without mixing live payments into the pilot.
Client testimonial
We could walk stakeholders through a booking and a wallet top-up in one sitting. That alone cut weeks of back-and-forth.
Constraints in the source
- Per-minute billing covers human and AI chat, with an idle end and concurrent caps.
- The Socket.IO Redis adapter is optional. Without it, chat is single-process.
- Payments are mock. firebase-admin is in the dependency list with no send path.
