Next.js app with a Hono API and a simple multi agent AI system.
- Stores users, conversations, messages, orders, deliveries, invoices, payments, refunds
- Routes each incoming message to a specialized agent using an LLM router
- Enforces tools first behavior in sub agents by calling DB backed tools before generating text
- Next.js App Router UI
- Hono API mounted at
/api/* - Prisma with PostgreSQL
- Vercel AI SDK with Google Gemini via
@ai-sdk/google
- Install
npm install- Create
.envfrom.env.exampleand set values
Required
DATABASE_URL="postgresql://..."
GOOGLE_GENERATIVE_AI_API_KEY="..."Optional
GOOGLE_GENERATIVE_AI_MODEL="gemini-2.5-flash"- Database
npm run prisma:generate
npm run prisma:migrate
npm run prisma:seed- Run
npm run devGET /api/healthPOST /api/chat/messagesGET /api/chat/conversations?userId=demo-userGET /api/chat/conversations/:idDELETE /api/chat/conversations/:idGET /api/agentsGET /api/agents/:type/capabilities
The seed creates a demo user and sample data.
Demo user
- Email
demo@acme.com - UI uses
userId=demo-userand the server maps it to the seeded demo user id
Orders
- Order number
A10001statusSHIPPEDcarrierUPStracking1Z999AA10123456784 - Order number
A10002statusPROCESSINGcarrierUSPStracking94001118992238569210
Invoices
- Invoice number
INV-10001statusPAIDtotal129.99 USD - Invoice number
INV-10002statusOPENtotal49.99 USD
Refunds
- Payment for
INV-10001has a refund row with statusNONE
Use these in the UI after seeding.
Where is my order A10001?Check delivery status for A10002Can I get invoice INV-10001?Do I have a refund for INV-10001?How do I reset my password?
If you see quota errors from Gemini, verify GOOGLE_GENERATIVE_AI_API_KEY or change your key.
- If you see an 'An error was encountered' or similar on the hosted app, please let me know chances are the api key is facing quota issues.
- The hosted version has rate limiting of 10 req/min so try to stay under that limit. If you need more for testing, then I can tweak the limit, just let me know.