Recipe
Score little league games from your phone
For league organisers and volunteer scorekeepers: give each game to one parent by email, and only that parent can score it, from their phone at the field.
Your little league plays every Saturday, and a different parent keeps score at each game. The scores end up on paper, in group chats and in somebody’s memory. In this recipe you have the agent build a scorebook: a database of the games, an API that holds the rules, and a scoring page that works on a phone. You give each game to one scorekeeper by their email address, and only that person can score it.
What you need
- XataWorks, open, with the agent answering. If it is not yet, Getting started covers the one decision to make first.
- The desktop view. This recipe is shown on it: a dock along the bottom, the chat in its own window, and each program in a window beside it. Choose View ▸ Desktop View and then Restart Now. The same menu item switches back.
- XataWorks Pro, for connecting the database to the API and for sharing the scorebook. Your scorekeepers need only a XataWorks account to sign in with.
- The season’s schedule, in a spreadsheet or just typed into the chat, and each scorekeeper’s email address.
How the pieces fit
- The database keeps the games: the date, the field, the two teams, the score, and the email of the parent scoring it.
- The API is the only way in. Its endpoints run on your computer, and each request tells them the email of the person signed in. XataWorks fills that in, so nobody can pretend to be somebody else. The API lets a scorekeeper change a game only when it is theirs.
- The creation is the page the scorekeeper sees on their phone: their games, and a big scoreboard with a button per team.
The scorekeepers never get the database itself. They get the creation, and the creation can only ask the API.
1. Ask for it in one sentence
In the Chat window, say what you want, the way you would say it to a person:
Make an app called Scorebook for our little league’s Saturday games at Riverside Park and Elm Street Field, starting Saturday 7 November, with the games in a database called Little_League. Each parent sees and keeps score of only their own game, from their phone, with a big + Run button for each team. I add the games and see every one. Grandparents can follow every game but not change anything.
XataWorks has a skill for this kind of app — several people, the same records, and rules that differ per person — and the agent follows it. Before it builds anything, it sends you a plan: what each game holds, which field says whose game it is, and who can see and change what. Whatever your sentence leaves open, it asks about, three questions at most. Read the plan: it is the app’s rules, in plain words. Answer its questions, or, when its guesses suit you, just say so:
That’s right. Go ahead and build it.
Planning comes first for any new creation, not just this one: a second skill has the agent settle who it is for and whether one of XataWorks’ templates already does most of it. You can see both skills, and turn them off, in File ▸ Preferences… ▸ Skills.
2. The agent builds the database, the API and the page
Making the database and the API each ask you first. The agent fills the database with sample games for two made-up parents, so that it can later try the rules on somebody else’s game. Then it writes the API: every endpoint checks who is calling. You can do anything; a parent sees and scores only the games with their email on them; a grandparent can only read. It writes the scoring page too, which talks only to the API. Then it opens the API’s page in the Creations window and stops: only you can connect the database to the API. If the page isn’t in front, ask:
Open the Scorebook API’s page so I can connect it.
The API’s page lists its endpoints and the logic behind each one. You don’t edit the logic there. To change it, ask the agent: “what happens if someone scores a game that’s already Final?” Later you will find the same page under View ▸ Creations ▸ Open Creations, then APIs and Scorebook.
request.caller, which XataWorks fills in.
3. Connect the database to the API
Only you can do this. On the API’s page in the Creations window, press Connections…. Pick Database, Little_League and Can change, and press Connect. Before you do, the dialog warns you: “Whoever uses this API — including people you share a creation with — gets what you allow here, even if they can’t open the data themselves.” That is the point here, and it is why the API’s rule matters. Then tell the agent:
I’ve connected Little_League to the API.
4. The agent proves the rules
The agent asks to let the page call the API. That asks you every time, even later in the same chat. To do it yourself, press APIs… on the creation’s bar, pick Scorebook and press Allow.
Then it tries the rules itself: as you, as a parent on their own game, as the same parent on somebody else’s game, and as a grandparent. Each try asks you first, so it tells you how many are coming; allow them for this chat. A try that changes a score is put back afterwards. It checks that the page shows the same games the API gave you, and finishes with the steps that are yours: web access, sharing, and the parents’ real emails. Then have a look at the page yourself:
Open the Scorebook page so I can see it.
When the page does what you want, press Run on its bar so no chat changes it by accident.
5. Keep it on your dock
In the list in Creations, choose ⋯ on Scorebook and then Install App. XataWorks says so: “Scorebook is installed. Find it in Apps, or keep it in the dock.” Press Keep in Dock to have it there every day. The scorebook is now an app of its own, also listed under My Creations when you press Apps on the dock. It opens in its own window, without the creation bar; to share it or change its APIs, right-click it and choose Edit in Creations.
6. Give each game to its scorekeeper
A game belongs to whoever’s email is in its Scorer field. Type it into the game in the Databases window, or ask:
Give the Riverside Park game on 7 November to sam@example.com.
Change the email and the game moves from one parent’s phone to another’s the next time their page loads.
7. Share the scorebook with the parents
The parents reach your computer through web access, so turn it on first: choose File ▸ Preferences…, open Web access, tick Turn on web access and give the computer a name the parents will recognise, like Coach’s laptop. Leave it off and Share… still saves, but says “Saved. No email was sent, because web access is off.”, and there is nothing for the parents to open.
Press Share… on the creation’s bar. In Share “Scorebook”, type each scorekeeper’s email, choose Can use and press Add. Leave Notify people by email ticked and press Save. Add anyone who only follows the scores, a coach or a grandparent, at Can view. Their page can only read, so every button that changes a score is refused for them.
At the field, the scorekeeper opens the link from the email in their phone’s browser and signs in to their XataWorks account. They see the scorebook on its own, not your desktop, and only their own games. Each tap on + Run goes through the API on your computer, which checks their email against the game before it changes a thing.
The run lands in Little_League on your computer as it is tapped. Ask the agent how a game stands, or open it on your own Scorebook:
The email you share to is the email the API sees, and the one in each game’s Scorer field. Share to the address the parent signs in with: signed in with another account, they can’t open the scorebook at all.
8. Keep it reachable on Saturday
The scorebook runs from the computer that holds it: the creation, the API and the database are all there. That computer has to be on with XataWorks running while the games are played, so a desktop that sleeps through Saturday morning won’t do. An always-on computer at home — a Raspberry Pi, a Synology NAS or an old laptop — covers keeping what you share reachable.
Where this recipe stops
- The rule is the API’s. XataWorks tells each endpoint who is calling; the API’s own logic decides what they may do. Read the endpoints, and have the agent try them as a scorekeeper and as someone else, before you share.
- Check the page yourself. An agent’s summary can say all is well while the page shows an error or nothing at all. Look at the page, and have the agent try the API with it, before you share it.
- Don’t hand out the database. Keep Little_League off the creation’s Databases… and don’t share it with the parents. Either would let them change any game directly, around the API’s rule.
- Endpoints are boxed in. An endpoint’s logic cannot reach the internet or your files, only the data you connected, and it is stopped after 10 seconds.
- The desktop view is new and still experimental. Everything here except step 5 also works in the classic window, where Creations is View ▸ Creations ▸ All Creations.
Read more
- The Builder — Design and Run, versions, connecting databases, sharing.
- Databases — fields, value lists and the database’s own page.
- An always-on computer at home — keeping what you share reachable while your desktop is off.
More recipes like this
-
A game to share with your friends
Describe a game, the agent builds it with a shared high-score table, and your friends play it in their browsers.
The Builder
-
A monthly sales report from your invoices
Invoice by asking, then get a report of what was billed, paid and owed every month.
Databases · Reports
-
Plan an event: guests, replies and budget
Import the guest list, let the agent read the replies into RSVPs, track the budget and print the list.
Databases · Mail · Spreadsheets
-
Run a lending library for your club
Lend tools or kit by asking, see what is overdue, draft reminders and share the desk with volunteers.
Databases · Mail
-
Track expenses from the receipts in your inbox
The agent files each emailed receipt as a record, and a monthly report by category comes from the database.
Mail · Databases · Reports
-
Turn Slack requests into a task list
Requests made in Slack become tasks in a shared database, each linked to its message, collected every week.
Slack · Databases
-
Turn your spreadsheets into a database you can ask questions
Attach your spreadsheets and ask: the agent designs and fills a database, and anyone you share it with can ask it questions.
Spreadsheets · Databases · Microsoft Excel
Back to all recipes.