# Development (/docs/development)
## Run it locally [#run-it-locally]
You need Node 24 or newer, [pnpm](https://pnpm.io) and the
[Turso CLI](https://docs.turso.tech/cli), which serves the local database.
```sh
pnpm install
cp apps/goatside/.env.example apps/goatside/.env.local # then fill it in
pnpm dev # local DB on :8080, app on :3000, this site on :3001
pnpm db:migrate # first run, and after schema changes
```
Sign in at [localhost:3000](http://localhost:3000) with the `GOATSIDE_USERNAME` and
`GOATSIDE_PASSWORD` from your `.env.local`. Locally, AI needs an `AI_GATEWAY_API_KEY`
from the AI Gateway dashboard. Without one, entries save uncategorized.
## Repo layout [#repo-layout]
| Path | What |
| --------------- | ---------------------------------------------------------------------------------- |
| `apps/goatside` | The app you self-host, on TanStack Start, deployed to Vercel |
| `apps/web` | This site, the landing page and these docs, built with Fumadocs |
| `packages/core` | The entry parser, account matching, money and dates, in plain TypeScript |
| `packages/db` | The Drizzle schema and migrations for Turso |
| `packages/auth` | Sign-in for the one account, with credentials from env and a signed session cookie |
| `packages/ai` | The agent's logic for categories, people, accounts and questions |
| `packages/ui` | shadcn/ui components on Base UI, the coin brand, theme and styles |
## Commands [#commands]
```sh
pnpm typecheck
pnpm test # vitest
pnpm lint # oxlint
pnpm format # oxfmt
pnpm db:generate # new migration after editing packages/db/src/schema
pnpm db:studio # browse the local DB
```
`pnpm install` sets up a pre-commit hook with [lefthook](https://lefthook.dev). It formats
the files you stage with oxfmt and lints them with oxlint, so a commit with a lint warning
stops. To skip it once, commit with `--no-verify`.
Sample data and evals:
```sh
# 3 months of sample data into a separate local DB (local URLs only)
TURSO_DATABASE_URL=http://127.0.0.1:8090 pnpm --filter @workspace/db demo
# live accuracy evals for categorizing (needs AI_GATEWAY_API_KEY)
pnpm --filter @workspace/ai eval
# chat agent scenarios against a local demo DB (writes to it)
TURSO_DATABASE_URL=http://127.0.0.1:8090 pnpm --filter app eval:ask
```
Add shadcn components from an app directory. The CLI installs them into `packages/ui`:
```sh
pnpm dlx shadcn@latest add drawer -c apps/goatside
```
## Writing these docs [#writing-these-docs]
The docs are MDX files in `apps/web/content/docs`. [Fumadocs](https://fumadocs.dev)
renders them on TanStack Start. Each folder's `meta.json` sets the order in the sidebar.
The site also serves every page as Markdown at its URL plus `.md`, and the whole set at
[`/llms.txt`](/llms.txt) and [`/llms-full.txt`](/llms-full.txt).
# Accounts and transfers (/docs/guide/accounts)
Goatside can keep track of where your money is: banks, e-wallets, credit cards and cash,
each with its balance. Accounts are optional. If you don't add any, entries have no
account.
## Setting them up [#setting-them-up]
Add accounts on the **Accounts** page, or tell the agent: "add my BPI savings with
₱15,000". Entries that don't name an account stay unfiled. To send them to one account,
pick it as your **default** on the Accounts page.
A credit card shows what you owe and the credit left. When your limit changes, open the
card on the **Accounts** page and choose **Edit**. The same form changes an account's
name, color, last four digits and nicknames. Your entries stay as they are.
## Naming the account in a line [#naming-the-account-in-a-line]
```txt
200 taxi via gcash
1500 groceries using bpi card
89 spotify
```
Say which account you used after _via_, _using_, _thru_, _gamit_, _paid with_ or
_charged to_, among others. Goatside matches accounts by name or nickname, so `bpi card`
and `bpi` can be different accounts. _Cash_ and _credit card_ mean your only account of that
kind.
Bills and subscriptions go on the account they were charged to last time, so `89 spotify`
lands on the same card each month.
A name you haven't set up, like `using unionbank`, becomes a question. You can add it as a
bank, e-wallet or card, or say it isn't an account. Goatside recognizes well-known
Philippine banks and e-wallets without a cue word, such as GCash, BPI, BDO, UnionBank,
GoTyme and SeaBank.
## Transfers [#transfers]
Moving money between your own accounts is a transfer, not spending:
```txt
1000 cash in gcash from bpi
3000 atm
5000 pay bpi card
2000 transfer from bdo to gotyme
```
Transfer words include _cash in_, _top up_, _ATM_, _withdraw_, _cash out_, _card payment_,
_transfer_, _instapay_ and _deposit_. A fee, like `15 atm fee`, is spending. When a line could
go either way, the agent asks.
Transfers never count in your totals or charts.
## Balances [#balances]
A balance is where the account started plus everything filed to it, so it's never out
of sync with your entries. When it doesn't match your bank, use **Correct the balance**
on the account, or tell the agent "my Maya actually has ₱2,000". Your entries stay as
they are.
Archive an account you've closed to hide it without losing its history.
Behind on logging? [Import the statement](/docs/guide/importing) your bank or card sends
you, and Goatside adds the rows you didn't type.
# Asking the agent (/docs/guide/asking)
Type a question in the composer, or press ⌘ J to open **Ask
Goatside**. Anything that doesn't start with an amount, or ends in `?`, is a question.
```txt
how much on food this month?
what were my biggest expenses last week?
who owes me money?
how much is left on my credit card?
when did I last pay my BPI card?
```
The agent can look through every entry, including transfers between your accounts, money
you lent or borrowed, and repayments. You can name an account by its name, a nickname,
its last four digits, or its kind when you have only one ("my card").
Every figure in an answer comes from your ledger, through fixed, read-only lookups. The
agent never writes its own database queries.
## Asking it to do things [#asking-it-to-do-things]
The agent can also make changes:
- "move all grab rides this month to Transport"
- "that 5,000 payment on my card is a transfer from BPI, not income"
- "the 500 lunch on the 12th was a loan to Nini"
- "delete the duplicate lunch"
- "log 350 lunch yesterday"
- "Daniel paid me back 500"
- "add my Security Bank savings with ₱15,000"
- "my Maya actually has ₱2,000"
It can change what an entry is (spending, income, a transfer, money lent or borrowed),
along with its category, account, person, description or date. It never changes an
amount.
Nothing changes until you confirm. First, a card lists the exact entries that will
change. The server builds that list from your ledger, so it isn't the model's own
description. Approve or decline it. You can undo any change afterwards.
When the card moves entries to a category, **Another category…** lists the others and
lets you add a new one. Pick one and the agent moves the entries there instead.
## What it can't do [#what-it-cant-do]
- Answer without a connection, or without AI configured.
- Delete more than 50 entries in one go, or change more than 20.
- Change a split bill's type or people. Open the entry to do that.
- See anything outside your own ledger.
The chat model is DeepSeek V4.1 Flash by default. Goatside sends it your question and the
rows it looks up, through your AI Gateway. See [What leaves your instance](/docs/guide/privacy).
# Dashboard (/docs/guide/dashboard)
On a screen 1024px or wider, Goatside is for reviewing more than logging. A sidebar holds
**Overview**, **Transactions**, **Accounts**, **People**, **Settings** and **Ask
Goatside**, which ⌘ J also opens. The composer moves to a single
line in the header, and ⌘ K jumps to it. On Windows and Linux,
use Ctrl instead of ⌘.
## Overview [#overview]
The month at a glance, from top to bottom:
- **Headline numbers.** Money in, money out and what's left.
- **Your accounts**, each with its balance.
- **Pace.** This month against last month, with a projection to the month's end.
Repeating bills count once. Everything else runs at your everyday rate.
- **Where it went.** A donut of your top categories, with the rest folded into Other.
- **Day by day** beside a calendar heatmap, stronger on bigger days.
- **Six months** stacked by category, and money in and out per month.
- **Biggest changes** per category against the same point last month, your largest
expenses, and recent entries.
- **People** who owe you or whom you owe, and your **repeats**.
IOUs and transfers between your own accounts never count as spending.
## Transactions [#transactions]
The full ledger in a table:
- A period picker: any month, the last 3 months, this year, or all time.
- Search, plus filters for category, account and type. The types are out, in, IOUs and
transfers.
- Sorting on any column.
- Select rows to move them to a category or an account, or to delete them with Undo.
Shift-click selects a range.
- **Export** exactly what's filtered as a CSV.
Click any row to open it in the edit drawer.
## Editing an entry [#editing-an-entry]
The edit drawer covers everything the agent decides, so no fix needs a model or a
retyped entry. You can change the amount, date, description, category, account, who it
was split with and whether it repeats every month. You can also change its type to
spent, received, transfer, lent or borrowed.
Goatside saves every change you make as a correction, so the agent files the next
similar entry your way.
# Importing statements (/docs/guide/importing)
When you've fallen behind on logging, import the statement your bank or card sends you.
Goatside adds the rows you didn't log, links the ones you did, and saves nothing until
you've reviewed them.
## Importing one [#importing-one]
1. Open the account on the **Accounts** page and choose **Choose a statement**.
2. Pick the PDF your bank or card sends you, or a CSV export.
3. If the PDF has a password, type it. Banks often use your birthday or part of your
account number.
4. Review the rows and choose **Import**.
Each statement goes into the account you opened it from. If the account has its last four
digits set and the statement never mentions them, Goatside warns you before you import.
## The file stays on your device [#the-file-stays-on-your-device]
Your browser opens the file and reads it. The PDF and its password never reach your
server or any AI model, and Goatside doesn't keep them. What gets saved is each row's
date, details and amount, the balances the statement printed, and a fingerprint of the
file so you can see if you import it again.
## Every row has to add up [#every-row-has-to-add-up]
Goatside checks the rows against the statement before it shows them to you:
- Each running balance equals the one before it plus that row.
- The money in and out add up to the totals the statement prints.
- The opening balance plus every row equals the closing balance.
- Every row is dated inside the statement period.
If a check fails, nothing is imported, and you see the first row that doesn't fit. A
statement with no running balance and no totals that match its rows can't be checked, so
it isn't imported either. No model reads your amounts. Code reads every number, as it does
for the entries you type.
Credit card statements print what you owe instead of a balance, and a payment shows as a
negative amount. Goatside reads them that way when you import into a credit card account.
A payment becomes a transfer from one of your accounts. A refund or cashback is money
back, not a payment.
## Reviewing the rows [#reviewing-the-rows]
The review sorts the rows into groups:
- **Maybe logged** rows are close to an entry you typed but not exact: ₱180 typed for a
₱185 charge, a date up to a week off, or the right amount filed under another account
(entries that name no account go to your default). Choose **Same entry** to link them.
The entry takes the statement's amount and account. Otherwise the row is added as new.
- **New** rows get filed like typed entries, with a category from the agent. Rows that
read the same, like 30 "Qr Payment" lines, get one question between them, and your
answer files them all. Untick any you don't want. A row that looks like a transfer, such
as "Outbound interbank transfer", has a menu to make it one.
- **Transfers** are money moving between your own accounts. A card payment, an ATM
withdrawal or a row that names another of your accounts lands here, with the other
account picked. If you already logged the other side, like the bank's transfer out
for a card payment, the two become one transfer.
- **Already logged** rows match an entry you typed: same amount, within two days. They're
linked, not added again. Choose **Not the same** if the match is wrong.
- Rows from a statement you imported before are left alone, so overlapping statements
never add a row twice. That includes rows you deleted after importing: they stay
deleted.
Imported rows don't create IOUs. "Transfer to Nini" on a bank statement could be a loan,
a gift or a bill, so file it with Nini by hand if it's a loan.
## After importing [#after-importing]
Goatside then compares its balance on the statement's last day with what the statement
says, leaving out anything dated after it. If they differ, usually because of money from
before you started using Goatside, choose **Match the statement**. That keeps your entries
and moves the starting balance, like **Correct the balance**, so entries after the
statement still count on top.
To take an import back, choose **Undo import** right after, or **Undo** next to it under
**Imported before**. Undo removes the rows it added and puts back entries it linked, moved
or turned into transfers, as they were before.
## What it can read [#what-it-can-read]
- Text PDFs: statements you download from your bank's app or website. Scanned paper
statements have no text to read.
- CSV exports with a date, details, amounts and a running balance. Numeric dates like
`09/12/2026` are read in whichever order the file makes clear. When every date could
be either, Goatside picks the order that keeps the rows within weeks of each other.
Built against GoTyme deposit account and Maya credit card statements. Other banks work
when their statements print a running balance or totals.
# Logging entries (/docs/guide/logging)
You log everything in the composer, the input at the bottom of the app. Type a line that
starts with an amount and press Enter. The entry shows up right away, and the agent fills
in its category a moment later.
```txt
180 iced coffee
+18000 client payment
2400 dinner with nini and daniel split 3
350 lunch yesterday
200 taxi via gcash
```
## The amount [#the-amount]
The amount comes first, and code reads it exactly as typed. The agent never changes a
number.
| You type | Amount |
| ----------------- | --------- |
| `500` | ₱500 |
| `1,250.50` | ₱1,250.50 |
| `1.5k` | ₱1,500 |
| `₱500`, `php 500` | ₱500 |
Every amount is in your currency, up to two decimal places. Pick the currency in
**Settings**. It starts as Philippine pesos, which the examples here use. A currency sign
or code in front of the number, like `$20` or `usd 20`, is skipped, not converted.
## Money in or out [#money-in-or-out]
You don't need to say. The agent works out whether `client payment` is money in and
`iced coffee` is money out, and asks you when it can't tell. A leading `+` settles it as
money in, and `-` as money out.
## The date [#the-date]
Goatside dates an entry today unless the line says otherwise:
| You type | Date |
| ------------------------------------------------- | ----------------------------------------------- |
| `yesterday`, `yday` | Yesterday |
| `3 days ago` | Three days back |
| `friday`, `on fri` | The most recent Friday, or today if it's Friday |
| `last friday` | The Friday before today |
| `oct 3`, `october 3rd`, `3 oct`, `3rd of october` | The most recent October 3 |
| `2026-10-03` | That exact date |
Dates follow the time zone set in **Settings**. Goatside ignores dates in the future.
## Splitting a bill [#splitting-a-bill]
Add `split` and the number of ways, you included. Your share is what counts as your
spending. The rest becomes what each person owes you.
```txt
2400 dinner with nini and daniel split 3
```
That's ₱800 of food for you, and ₱800 owed by each of Nini and Daniel. See
[People and IOUs](/docs/guide/people).
## Several at once [#several-at-once]
Put more than one entry on a line by starting each with its sign:
```txt
-500 lunch, -120 coffee
```
Without signs, Goatside reads everything after the first amount as one description.
## Undo [#undo]
Type `undo` to remove the last line you logged, including every entry it made. Changes
in the app also show an **Undo** button for a few seconds.
## Not an amount? It's a question [#not-an-amount-its-a-question]
A line that doesn't start with an amount, or that ends in `?`, goes to the agent as a
question instead: `how much on food this month?` See
[Asking the agent](/docs/guide/asking).
## Quick picks [#quick-picks]
Entries you log often show up as chips above the empty composer, favoring the ones you
usually log around this time of day. Tap one to log it again.
# People and IOUs (/docs/guide/people)
Mention someone in a line and Goatside keeps track of what's owed. The home screen and
**People** show where you stand with everyone, with one-tap **Settle**.
```txt
1000 lent nini
2400 dinner with nini and daniel split 3
+500 daniel paid me back
350 lunch, daniel paid
```
The agent works out what kind of line it is:
| Kind | Example | What it records |
| ---------------- | ------------------------------------------ | -------------------------------------------------------- |
| You lent | `1000 lent nini` | Nini owes you ₱1,000 |
| You borrowed | `350 lunch, daniel paid` | You owe Daniel ₱350 |
| Paid back to you | `+500 daniel paid me back` | Daniel owes you ₱500 less |
| You paid back | `1000 paid back nini` | You owe Nini ₱1,000 less |
| Shared | `2400 dinner with nini and daniel split 3` | ₱800 is your spending, and Nini and Daniel owe ₱800 each |
IOUs never count as spending or income. Only your own share does. When a line could be
either your own spending or an IOU, the agent asks, and **Just my spending** is always
an option.
Goatside looks for names after words like _with_, _by_, _from_, _to_, _for_ and _lent_. It
recognizes anyone you've logged before anywhere in a line.
## On the People page [#on-the-people-page]
- Each person's balance and history.
- **Settle** all or part of a balance.
- **Nicknames**, so "nins" and "Nini" are the same person, and **merge** two people
who turned out to be one.
- **Add an IOU** by hand: who, which way, how much and what for.
- **Draft a reminder.** The agent writes a short, friendly payment reminder from their
open IOUs. Edit it, then copy or share it yourself. Goatside never sends it for you.
## Editing a split [#editing-a-split]
Open a split bill in the edit drawer to change who it was split with, the number of
ways or the total. Goatside divides the shares evenly again, and everyone's rows move
together when you change the date, description or account.
# On your phone (/docs/guide/phone)
On a phone, Goatside is a logger first. It shows your month's summary, daily spending,
people and recent entries, with the composer pinned where your thumb is.
## Getting around [#getting-around]
A tab bar at the bottom opens **Overview**, **Transactions**, **Accounts** and
**People**. Tap the tab you're on to jump back to the top. The chat button, top right,
opens **Ask Goatside** with your current conversation. **Settings**, the theme and
**Sign out** are in the menu behind your initial, next to it. The tab bar steps aside
while you type.
Goatside follows your device's light or dark setting. To pick one for this device,
choose **Light** or **Dark** in that menu or under **Settings → Appearance**.
In the installed app, pull down at the top of any page to reload it.
## Install it [#install-it]
Goatside is an installable web app. Open it in your browser and go to
**Settings → Home screen**:
- On Android and desktop Chrome, tap **Install**.
- On iPhone and iPad, tap **Share**, then **Add to Home Screen**. Settings shows these
steps too.
It then opens full screen from its own icon, like any other app.
## Offline [#offline]
- **Opening.** The four tab pages, and any page you've opened before, load from your
phone when there's no signal, so your overview is there on a plane. They show what
was last loaded. A page you've never opened says you're offline.
- **Logging.** Goatside saves every entry on your phone first, then sends it. With no signal it
shows in your feed as **Waiting to sync**, and goes out by itself when you're back
online. Tap a waiting entry to remove it. A dropped connection or a reload can't lose
it, and an entry typed "yesterday" keeps its meaning even if it syncs days later.
- **Asking** the agent needs a connection.
## Updates [#updates]
The installed app checks for a new version when you come back to it. When there is
one, it loads the next time you return after a while away, never while you're in the
middle of something.
Signing out clears the pages kept on your phone, even with no signal. So does a sign-in
that has expired: the next time Goatside opens online, they're deleted, and pages older
than 30 days never open offline.
# What leaves your instance (/docs/guide/privacy)
Your ledger lives in your own Turso database. Goatside has no server of its own and
collects nothing: no analytics, no telemetry, no account with us.
Goatside sends two things out, both through your own Vercel AI Gateway:
| When | What goes out | Model |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| You log an entry | The entry's text and amount, plus your category names with a few recent entries in each, and the people and accounts the line might involve | TypeSafe's Jev, `typesafe-ai/jev` |
| You ask the agent | Your question, the recent chat, and the ledger rows its tools look up to answer | DeepSeek V4.1 Flash, `deepseek/deepseek-v4.1-flash` |
Importing a statement sends each new row's details and amount to Jev for a category,
the same as a typed entry. Your browser reads the statement file, so the file and its
password never leave your device. See [Importing statements](/docs/guide/importing).
Nothing goes out when you only browse your dashboard, edit an entry by hand or settle up
with someone.
## What stays on your phone [#what-stays-on-your-phone]
So Goatside opens with no signal, your browser keeps a copy of the four tab pages
(Overview, Transactions, Accounts and People) and of any other page you open. Each copy
shows your ledger as it was when it loaded. Entries you log offline wait on the phone
until they sync.
These copies are deleted when you sign out, when the sign-in page shows, and when a
page load finds the session has ended. A copy older than 30 days never opens. See
[On your phone](/docs/guide/phone).
## Running without AI [#running-without-ai]
AI is optional. Without AI Gateway credits or credentials, Goatside still works:
- Entries save with their amount and description, uncategorized.
- An entry without a sign still gets an "in or out?" question.
- You can file categories, people and accounts by hand in the edit drawer.
The agent's chat is the one feature that needs a model.
## Choosing other models [#choosing-other-models]
You can swap either model for any model on AI Gateway with the `DECISION_MODEL` and
`CHAT_MODEL` variables. See [Environment variables](/docs/self-hosting/environment).
# When the agent asks (/docs/guide/questions)
The agent only files an entry on its own when it's confident. When it isn't, it saves
the entry with its best guess and asks you, one card at a time above the composer. Entries
with an open question show a **Check** marker in your feed.
The questions you'll see:
- **Money in or out?** For an entry without a sign that it's torn on, it asks something
like `Was ₱500 for "Lunch" money out or in?`
- **Which category?** Its top three guesses. **Other…** lists the rest and lets you add a
new category.
- **Who's involved?** Whether a line was your own spending, a loan, or a shared bill.
- **Is this a duplicate?** **Keep both** or **Remove this one**, when the same payment
looks logged twice.
- **Which account?** When a line names an account you haven't set up, like
`500 groceries using unionbank`. You can add it as a bank, e-wallet or card, or say it
isn't an account.
- **Transfer or spending?** When a line could be moving money between your own
accounts.
One tap answers. **Keep guess** confirms what's already there.
## How it learns [#how-it-learns]
Goatside remembers every answer, and every fix you make in the edit drawer. The next time
you log the same thing, it files it the way you did, often without asking the model at
all. Categories also learn from the entries you've filed in them, so a category of your
own starts catching the right entries after a few uses.
Goatside marks bills that come back month after month as **repeating**. The pace
projection and the Repeats card count them once a month.
## Without AI [#without-ai]
With no AI configured, Goatside doesn't categorize anything for you, but a line without a
sign still gets a "money out or in?" card.
# Introduction (/docs)
Type what you spent or received in plain words, like `180 iced coffee`, and Goatside
turns it into a categorized transaction. On your phone it's a quick logger and a chat
with its agent. On a wide screen it's a dashboard for reviewing your money, with charts
and a full transactions table.
## How it works [#how-it-works]
1. **You write one line.** `180 iced coffee`, `+18000 client payment`,
`2400 dinner with nini and daniel split 3`. Code reads the amount exactly as you
typed it. No model ever changes a number.
2. **The agent files it.** It picks the category, notices bills that repeat, spots
people you lent to or split with, and works out which account the money moved in.
3. **It asks when it isn't sure.** A small question card shows its best guess, and one
tap confirms or fixes it. Every answer teaches the next guess.
4. **You ask it things.** "How much on food this month?" gets an answer from your own
ledger. It can also re-file, log or delete entries for you, after you confirm.
5. **You catch up from statements.** Fell behind? Import your bank's PDF or CSV. Your
browser reads it, every row has to add up to the statement's balances, and entries you
already typed are linked instead of added twice.
## Built for one person [#built-for-one-person]
There's no Goatside service to sign up for. Each copy belongs to one person, who
deploys it to their own Vercel account with their own database. It has exactly one
account, and you set its username and password yourself.
What you need:
- A [Vercel](https://vercel.com) account, for hosting and AI Gateway.
- A [Turso](https://turso.tech) database, for your ledger.
- About 15 minutes.
Hosting and the database fit in the free tiers for one person. The agent needs AI Gateway
credit, $10 at the least. Hundreds of entries a month cost well under a dollar, so $10
covers far more than the year it lasts. See [What it costs](/docs/self-hosting#what-it-costs).
# Database (/docs/self-hosting/database)
Goatside keeps everything in one [Turso](https://turso.tech) database. The schema and its
migrations are written with [Drizzle](https://orm.drizzle.team) and live in `packages/db`.
## Migrations [#migrations]
Vercel doesn't migrate the database, so an update that changes the tables needs its
migrations run too. You can run them from GitHub Actions or from your computer. If a
deploy is ahead of its database, Goatside opens on a page that says how many migrations
haven't run, instead of failing on every page.
### Your URL and token [#your-url-and-token]
Both ways need your database's URL and token.
They're your Vercel project's `TURSO_DATABASE_URL` and `TURSO_AUTH_TOKEN`. In the
project, open **Storage** and select the database to see them. Or copy them into your
clone with the Vercel CLI:
```sh
cd apps/goatside
vercel link # first time only
vercel env pull .env.production.local --environment=production
```
Delete that file once you've used the values. Git ignores it, but it holds your
production token.
```sh
turso db show goatside --url
turso db tokens create goatside
```
### With GitHub Actions [#with-github-actions]
Your fork can apply migrations on every push to `main`, once the checks pass.
1. Open your fork's **Actions** tab and enable workflows. GitHub turns them off on
new forks, and until you do, nothing runs.
2. Under **Settings → Secrets and variables → Actions**, add `TURSO_DATABASE_URL` and
`TURSO_AUTH_TOKEN` as repository secrets.
To migrate without pushing, open **CI** on the **Actions** tab and choose **Run
workflow** on `main`. Without the secrets, the migrate job skips its work and leaves a
notice on the run.
Vercel deploys the same push on its own and can finish first. Until the migration lands,
usually a minute or two, Goatside shows that it's waiting for it and checks again every
15 seconds. If you'd rather avoid that, run the migration by hand before you push.
### From your computer [#from-your-computer]
From your clone:
```sh
TURSO_DATABASE_URL=libsql://goatside-.turso.io \
TURSO_AUTH_TOKEN= \
pnpm db:migrate
```
Running it again is safe. It skips migrations that are already applied.
Without `TURSO_DATABASE_URL`, `pnpm db:migrate` targets the local database at
`http://127.0.0.1:8080`. It doesn't read `.env.local`, so pass the URL every time you
mean production.
## What's set up on sign-in [#whats-set-up-on-sign-in]
Every successful sign-in makes sure your settings and default categories exist. It only
adds what's missing, so it never undoes a rename or an archived category.
- Spending categories: Food, Groceries, Transport, Bills, Subscriptions, Shopping,
Health, Fun, Others.
- Income categories: Salary, Freelance, Gifts, Others.
## Locally [#locally]
`pnpm dev` starts a local libSQL server on `:8080` with the data in
`packages/db/.data/local.db`. You can also run it alone with `pnpm db:dev`.
| Command | What it does |
| ------------------ | ---------------------------------------------------------------- |
| `pnpm db:migrate` | Applies migrations |
| `pnpm db:generate` | Writes a new migration after you change `packages/db/src/schema` |
| `pnpm db:studio` | Opens Drizzle Studio to browse the data |
To try Goatside with three months of sample data, start a second local database and fill
it. The demo script refuses remote URLs, and a database that already has entries.
```sh
turso dev --db-file packages/db/.data/demo.db --port 8090
TURSO_DATABASE_URL=http://127.0.0.1:8090 pnpm db:migrate
TURSO_DATABASE_URL=http://127.0.0.1:8090 pnpm --filter @workspace/db demo
```
## Backups [#backups]
Your ledger is only in your database, so keep a copy. Turso keeps point-in-time history
you can restore from, and how far back depends on your plan. With the Turso CLI, you can
also export the database as a SQLite file at any time:
```sh
turso db export goatside
```
For a spreadsheet of your entries, use **Export** on the Transactions page.
# Environment variables (/docs/self-hosting/environment)
Goatside checks its environment the first time it needs it, and fails with one message
listing every missing or invalid variable. On Vercel, set them under **Settings →
Environment Variables**. Locally, copy `apps/goatside/.env.example` to `apps/goatside/.env.local`
and fill it in. `vercel env pull` copies the values set on Vercel into that file.
## Required [#required]
| Variable | What it is |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `GOATSIDE_USERNAME` | Your username. There's exactly one account. |
| `GOATSIDE_PASSWORD` | Your password, at least 12 characters. |
| `SESSION_SECRET` | At least 32 characters, used to sign your sign-in cookies. Generate one with `openssl rand -base64 32`. |
| `TURSO_DATABASE_URL` | Your database. `libsql://…` for Turso; locally, `http://127.0.0.1:8080` from `pnpm db:dev`. The Vercel Marketplace sets it for you. |
Changing the username, password or session secret signs out every device. See
[Sign-in and security](/docs/self-hosting/security).
## Optional [#optional]
| Variable | Default | What it is |
| -------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `TURSO_AUTH_TOKEN` | | Your Turso token. Needed for Turso, not for the local database. The Vercel Marketplace sets it for you. |
| `AI_GATEWAY_API_KEY` | | An AI Gateway key. Not needed on Vercel, where the project's OIDC token signs in. Needed locally or on another host for the agent to work. |
| `DECISION_MODEL` | `typesafe-ai/jev` | The model that files entries. Any AI Gateway model ID. |
| `CHAT_MODEL` | `deepseek/deepseek-v4.1-flash` | The model that answers your questions. Any AI Gateway model ID. |
## Not in the environment [#not-in-the-environment]
- **Time zone.** Set it in the app under **Settings**. It decides which day an entry
belongs to, and defaults to `Asia/Manila`.
- **Currency.** Set it in the app under **Settings**. Every amount shows in it, and it
defaults to Philippine pesos. Changing it relabels your amounts. It doesn't convert
them.
# Deploy to Vercel (/docs/self-hosting)
A Goatside deploy is one Vercel project, built from `apps/goatside`, and one
[Turso](https://turso.tech) database. You'll need a [GitHub](https://github.com) and a
[Vercel](https://vercel.com) account. Everything can be done in the browser. If you'd
rather run the database setup from your computer, you also need Node 24 or newer and
[pnpm](https://pnpm.io).
You can create the database in two ways. Both give Goatside the same two variables, so
the app doesn't care which one you pick.
- **Vercel Marketplace.** Add Turso from your Vercel project's **Storage** tab. Vercel
bills it and sets the variables for you. No Turso account or CLI.
- **Turso directly.** Create it with the [Turso CLI](https://docs.turso.tech/cli) on your
own Turso account, then paste the URL and token into Vercel.
## What it costs [#what-it-costs]
| Service | Cost |
| ---------- | --------------------------------------------------------------------------- |
| Vercel | Free on the Hobby plan, which is for personal, non-commercial use |
| Turso | Free plan, with far more room than one person's ledger needs |
| AI Gateway | $10 of credit, the smallest top-up, plus any card fee. Expires after a year |
Vercel gives every team $5 of free AI Gateway credit a month, but it only covers some
models. Goatside's two aren't among them, so the agent needs credits you buy.
Both models are cheap. Jev, which files your entries, costs $0.042 per million input
tokens, so a hundred entries cost well under a cent. DeepSeek V4.1 Flash, which answers
your questions, costs $0.30 per million input tokens and $1.20 per million output tokens,
about a cent or less per question. Credit expires a year after you buy it, and for one
person, $10 is far more than a year's use. These are
October 2026 prices. The [AI Gateway model list](https://vercel.com/ai-gateway/models)
has current ones.
Skip the credits and Goatside is free to run, without the agent. See
[Running without AI](/docs/guide/privacy#running-without-ai).
## Set it up [#set-it-up]
### Fork the repo [#fork-the-repo]
[Fork goatside on GitHub](https://github.com/joshxfi/goatside/fork). To work from your
computer too, clone your fork and install its dependencies:
```sh
git clone https://github.com//goatside
cd goatside
pnpm install
```
Your fork is what Vercel deploys. Keeping it synced with this repo is how you
[get updates](/docs/self-hosting/updating).
### Import it in Vercel [#import-it-in-vercel]
In Vercel, choose **Add New → Project** and import your fork. Set **Root Directory** to
`apps/goatside`. Vercel detects TanStack Start and builds it with Nitro. Leave the other
build settings as they are.
Before you deploy, add these under **Environment Variables**:
| Variable | Value |
| ------------------- | ------------------------------------------------------------------ |
| `GOATSIDE_USERNAME` | The username you'll sign in with |
| `GOATSIDE_PASSWORD` | A password of 12 or more characters. The app lives on a public URL |
| `SESSION_SECRET` | 32 or more random characters. Run `openssl rand -base64 32` |
Then deploy. The app can't open until it has a database, so this first deploy is only
there to create the project.
### Add the database [#add-the-database]
Pick a location close to where you live. Every request makes a few database calls, so
distance shows up as lag.
In your Vercel project, open **Storage**, choose **Create Database** and pick
**Turso Cloud**. Name the database `goatside`, choose a plan and a region, and connect it
to your project.
Vercel adds `TURSO_DATABASE_URL` and `TURSO_AUTH_TOKEN` to the project's environment
variables. Goatside reads those names, so there's nothing to rename.
Install the [Turso CLI](https://docs.turso.tech/cli), then create a database and a token
for it:
```sh
turso auth login
turso db create goatside
turso db show goatside --url # libsql://goatside-.turso.io
turso db tokens create goatside
```
In your Vercel project, open **Settings → Environment Variables** and add:
| Variable | Value |
| -------------------- | --------------------------------- |
| `TURSO_DATABASE_URL` | The URL from `turso db show` |
| `TURSO_AUTH_TOKEN` | The token from `turso db tokens…` |
### Set up the tables [#set-up-the-tables]
Vercel doesn't migrate the database. Run the migrations from GitHub or from your
computer. Both need the database's URL and token, and
[Database](/docs/self-hosting/database#your-url-and-token) shows where to find them.
1. Open your fork's **Actions** tab and enable workflows. GitHub turns them off on new
forks.
2. Under **Settings → Secrets and variables → Actions**, add `TURSO_DATABASE_URL` and
`TURSO_AUTH_TOKEN` as repository secrets.
3. On the **Actions** tab, open **CI**, choose **Run workflow** on `main` and wait for it
to finish. Its `migrate` job sets up the tables.
From then on, every push to `main` applies new migrations on its own.
From your clone:
```sh
TURSO_DATABASE_URL= \
TURSO_AUTH_TOKEN= \
pnpm db:migrate
```
Run it again whenever an update adds a migration, or switch to GitHub Actions later.
If you skip this, Goatside opens on a page that says the database has no tables yet.
### Turn on AI Gateway [#turn-on-ai-gateway]
The agent runs on [Vercel AI Gateway](https://vercel.com/docs/ai-gateway). On Vercel it
signs in with your project's OIDC token, so there's no key to manage.
1. Open **AI Gateway** on your Vercel team's dashboard and enable it.
2. Choose the credits balance in the top right and buy credit. $10 is the smallest
top-up, and the free monthly credit doesn't cover Goatside's models (see
[What it costs](#what-it-costs)).
3. Optionally, set a [budget](https://vercel.com/docs/ai-gateway/observability-and-spend/budgets)
to cap what it can spend.
If the credits run out, entries still save, uncategorized, and the agent can't answer
until you add more. **Auto-reload** in the same dialog, off by default, can refill the
balance for you.
Skip this and Goatside still works, without the agent. See
[Running without AI](/docs/guide/privacy#running-without-ai).
### Redeploy and sign in [#redeploy-and-sign-in]
Vercel applies new environment variables only to new deployments. Open
**Deployments**, choose **Redeploy** on the latest one, and wait for it to finish.
Open your project's URL and sign in with your username and password. Goatside adds the
default categories the first time you sign in.
Then [install it on your phone](/docs/guide/phone) and log your first entry.
## Pick a function region [#pick-a-function-region]
This step is optional. The app is fastest when its function runs near your database. In
your Vercel project, open **Settings → Functions** and set the **Function Region** to the
one closest to your database. For Singapore, that's `sin1`.
## Preview deployments [#preview-deployments]
Vercel adds environment variables to every environment by default, so a preview
deployment of another branch uses your real database. If you push branches to your fork,
limit the Turso variables to **Production**, or give previews a second database.
## If something's wrong [#if-somethings-wrong]
Goatside checks its setup when a page loads. If it can't run, it shows what's missing
instead of an error:
- **Environment variables** that are missing or too short, by name. Fix them under
**Settings → Environment Variables**, then redeploy.
- **The database can't be opened.** Check `TURSO_DATABASE_URL` and `TURSO_AUTH_TOKEN`,
then redeploy. The function logs under **Logs** have the exact error.
- **Migrations that haven't run.** Run them, then choose **Check again**. Right after an
update, GitHub Actions may still be migrating, so the page checks again on its own.
A new password that doesn't work is a different problem. Changes to variables reach only
new deployments, so the old password still applies until you redeploy.
# Sign-in and security (/docs/self-hosting/security)
A Goatside deploy has exactly one account, set by the username and password in its
environment. There's no sign-up page, no user table and no password reset. To change
your password, change `GOATSIDE_PASSWORD` in Vercel and redeploy.
## Staying signed in [#staying-signed-in]
Signing in sets a cookie that lasts 30 days and renews itself while you keep using the
app, so a phone you use every week stays signed in. The cookie is `HttpOnly` and, in
production, `Secure`.
There are no stored sessions. A cookie is a signature over your username, password and
`SESSION_SECRET`, so changing any of the three signs out every device at once. That is
also how you sign out a lost phone. Pages it kept for offline use are deleted the next
time it opens Goatside online, and a kept page is never shown once it's 30 days old.
## Guessing passwords [#guessing-passwords]
Goatside records every sign-in attempt before checking it, so a burst of parallel
guesses can't slip past the limits:
- **5 failed attempts per IP address** in 15 minutes.
- **25 failed attempts in total** in 15 minutes, from anywhere.
A flood of bad guesses could then lock you out too, so Goatside trusts browsers you've
signed in from. They get a separate year-long cookie that skips both limits. A trusted browser
that fails more than 10 times in a day loses that trust, and changing your password
untrusts every browser.
During an attack, the limits can still block a browser that has never signed in. If that's a
concern, [Vercel Firewall](https://vercel.com/docs/vercel-firewall) rate limits can sit in
front of the sign-in page.
## The agent's actions [#the-agents-actions]
When you ask the agent to change something, it can't do it alone. The server works out
exactly which entries would change and shows you that list. Nothing changes until you
confirm. The server signs each approval with a key derived from `SESSION_SECRET`, so the
browser can't forge one. You can undo every change.
# Updating (/docs/self-hosting/updating)
Your Vercel project deploys every push to your fork's main branch. To update, pull the
new version, migrate your database, then push.
New versions are listed on [GitHub Releases](https://github.com/joshxfi/goatside/releases)
and in `CHANGELOG.md`, with what changed since the last one. To hear about them, choose
**Watch → Custom → Releases** on the repo.
### Pull the update [#pull-the-update]
From your clone:
```sh
git remote add upstream https://github.com/joshxfi/goatside # once
git pull upstream main
pnpm install
```
### Migrate the database [#migrate-the-database]
If GitHub Actions runs your migrations (see
[Database](/docs/self-hosting/database#with-github-actions)), it applies new ones after
you push, and you can skip this step.
Otherwise, the new version may expect new tables or columns, so apply any new
migrations before it deploys. [Database](/docs/self-hosting/database#your-url-and-token)
shows where to find the URL and token.
```sh
TURSO_DATABASE_URL=libsql://goatside-.turso.io \
TURSO_AUTH_TOKEN= \
pnpm db:migrate
```
With nothing new to apply, it does nothing, so it's safe to run every time.
### Push to deploy [#push-to-deploy]
```sh
git push
```
Vercel builds and deploys it. Check that it finished under your project's
**Deployments**.
GitHub's **Sync fork** button works too, but it deploys straight away. If GitHub Actions
doesn't run your migrations, run any new migration first.
If a deploy misbehaves, **Instant Rollback** in Vercel puts the previous version back.