# This service runs on Turn Zero Cloud The service in this folder is hosted on Turn Zero Cloud. It started from the platform's `ai-chat` template: a Node.js service with a web page and sign-in for its users. The page keeps a conversation with an AI model called through the platform's AI route. Calls draw the account's balance, with no key of your own. This file describes the template the service started from: keep it current as the service changes. ## Where you build - The page: `client/`, plain HTML, CSS, and script, which the platform serves at the application's address. It keeps the conversation for the page's life and posts its turns with each message. - The routes: `src/server.mjs`. The service started with one route under `/api/`, `POST /api/ask`, which reads the signed-in user and answers the conversation's next turn. - The AI model: `src/ai.mjs`, which calls the platform's AI route with the conversation's most recent turns. Calls draw the account's balance, with no key of your own. ## Where the rules are Turn Zero Cloud serves its rules to a coding tool through the MCP server `turnzero`, one connection to the products your account holds. The rules change with the platform, so none is repeated here. - Where the server is not connected, set up Turn Zero Cloud first: https://turnzero.ai/cloud/getting-started/set-up/ - Before you change or deploy this service, read the server's `deploy` skill, and before you change its sign-in or its AI call, the server's `add-sign-in` or `use-ai-allowance` skill. ## What you run here - The tests: `npm test`, in this folder. - A local run and a deploy: the `deploy` skill gives each step and the line to run, in this order: `tzcloud_submit_manifest`, the local run, `tzcloud_deploy_command`. - Sign-in on a local run: start it with `--sign-in` and the application's own hostname, then open the address its port line names; the command sends the sign-in routes to that hostname. Without `--sign-in`, the page a local run serves has no sign-in routes, sign-in is on the deployed application's own address, and a local run's API routes take a session as a Bearer.