How to Build a Time Tracking App
Time tracking apps live or die on two things: a timer that never loses an hour, and a report the client accepts without questions.
Key takeaways
- Store a running timer as a time entry with a start time and no end time, saved in the database. Never keep it only in the browser.
- Compute durations from timestamps at report time. Stored minute counts drift when people edit entries.
- Rates belong to the project or client and are copied onto the invoice when it is created, so changing a rate never rewrites old invoices.
A time tracking app needs three things to be trustworthy: a timer stored on the server so it survives a closed laptop, time entries saved as a start and an end timestamp, and reports that group those entries by client, project and week and export cleanly to an invoice. Build those first. Everything else (idle detection, screenshots, integrations) is optional, and most freelancers and small agencies never miss it.
Who is tracking, and why
The reason people track time decides the shape of the app. A freelancer tracks to bill. An agency tracks to bill and to see which projects lose money. A team lead tracks to see where the week went. A student tracks to study more. Billing is the most demanding use because every minute turns into money and a client will read the report, so design for it and the other uses come along for free.
The data model
- clients: name, contact email, currency, default hourly rate, billing address.
- projects: client, name, hourly rate (overrides the client default), budget in hours (optional), archived flag.
- tasks (optional): project, name, billable flag. Some teams want "Design" and "Meetings" as separate lines on an invoice.
- time_entries: user, project, task, note, started at, ended at (empty while running), billable flag, invoice id (empty until invoiced).
- invoices: client, number, issue date, due date, status (draft, sent, paid), currency, totals.
- invoice_lines: invoice, description, hours, rate, amount. These are copies, frozen when the invoice is made.
The important choice is timestamps over durations. An entry is "started 09:12, ended 10:47", and the 1 hour 35 minutes is calculated when a report runs. If you store "95 minutes" instead, then the first time someone edits the end time, the two numbers disagree and your report is wrong in a way nobody notices until a client does.
The timer is the product
People judge a time tracker in the first week by one experience: they start a timer, close the laptop, open it on their phone at lunch, and the timer is still running with the right number. That only works if starting a timer creates a database row immediately with a start time and no end. The screen just displays "now minus start". Stopping the timer writes the end time.
- One running timer per person. Starting a new one stops the old one at the same moment. Enforce it in the database, not only in the button.
- Forgotten timers. Someone leaves a timer running overnight and wakes up to 14 hours. Show a gentle prompt when a timer passes a limit you choose (say 10 hours) and let them set the real end time.
- Manual entries. Half of all time gets logged after the fact. A fast "add 1h 30m to Project X yesterday" form matters as much as the timer.
- Time zones. Store timestamps in UTC and show them in the person's zone. A week report for a team across zones should say which zone it uses.
Reports people actually read
The weekly timesheet is the default view: rows are projects, columns are days, cells are hours, with totals on the edges. Add two more reports and stop:
- 01Summary by client or project for any date range, with billable and non-billable hours and the money value at current rates.
- 02Detailed list of every entry in a range, with notes, for answering "what did you do on the 14th?".
- 03Budget burn per project: hours used against the budget, so an agency sees trouble at 70 percent instead of 130.
Rounding is a policy, not a detail. Some freelancers bill in 6-minute increments, some in 15, some exact. Make rounding a setting per client and apply it when building the invoice, never to the stored entries, so the raw truth is always there.
From hours to an invoice
Invoicing is where the money is, and where you should be careful about scope. The clean version for a first release: pick a client and a date range, see every uninvoiced billable entry grouped by project or task, and click Create invoice. The app copies the hours and rates into invoice lines, marks those entries with the invoice id so they cannot be billed twice, and gives you a PDF or CSV to send.
Freezing the lines matters. If a project rate goes from $90 to $110 in March, February's invoice must still say $90. That is why invoice lines are copies and not live calculations.
Exports cover most real needs: a CSV for an accountant, and a clean printable invoice page the browser can save as PDF. Pushing invoices into accounting software or taking card payment on them can come later. If you do add payment links, Startbase Cloud payments run through your own Stripe account, so the money goes straight to you.
When a team tracks together
For an agency, the week has an end. Most teams want a simple approval step: on Friday each person submits their week, a manager reviews it, and approved weeks are locked so nobody edits March in June. Model it as a timesheet_weeks table (user, week start, status of open, submitted, approved, and who approved it). Entries inside an approved week become read-only for the person, and a manager who reopens a week leaves a recorded reason.
Visibility matters as much as approval. People should see their own entries, managers the entries of their team, and nobody should see colleagues' hourly cost rates unless they run the business. Keep cost rate (what a person costs you) separate from bill rate (what the client pays), because the gap between them is how an agency sees which projects make money.
A brief to start from
Build a time tracking web app for freelancers and small agencies. Data: clients (currency, default rate), projects (rate override, optional hour budget), optional tasks with a billable flag, time entries with started_at and ended_at in UTC (ended_at empty while running), invoices and frozen invoice lines. A timer in the top bar starts by creating an entry in the database and stops by writing ended_at; only one running timer per user. Add manual entry, a weekly timesheet grid, a summary report by client for any date range, and a budget burn bar per project. Create invoice: pick a client and range, include uninvoiced billable entries, apply that client's rounding rule (exact, 6 or 15 minutes), mark entries as invoiced, and export CSV plus a printable invoice page. Team members see only their own entries; admins see everyone's.
A brief like this lands well because it names the fields and the edge cases. Our guide on describing an app so AI builds it right covers the same habit in more depth.
Leave these for later
- Screenshots and activity monitoring. They destroy trust with freelancers and invite privacy questions. Most small teams do not want them.
- Automatic tracking from apps and browser tabs. That needs a desktop app with operating system access, which is a different project from a web app.
- Payroll and overtime rules. Labor rules vary by country and contract. Export hours to the payroll tool instead.
- Deep calendar sync. Importing calendar events as draft entries is nice. Two-way sync is a rabbit hole.
One useful extra that is cheap: a weekly reminder. A scheduled job that runs Friday afternoon and emails anyone with fewer hours logged than usual ("you have 22 hours this week, anything missing?") recovers more billable time than any clever feature. For more tools in this family, browse the business use cases. For budget ranges on tools like this, see what a SaaS costs, and accepting payments in your app covers card payment on invoices when you get there.
Frequently asked questions
How do time tracking apps keep a timer running when the browser closes?
They save the start time to the server the moment the timer starts. The screen only displays the time elapsed since then, so closing the tab, switching devices or losing battery does not stop or lose the timer.
Should I round time entries?
Store exact times and apply rounding only when you build an invoice, as a setting per client. That keeps the raw record honest and lets different clients have different rules.
Can a time tracking app create invoices?
Yes. The simple version groups uninvoiced billable hours for a client and date range, copies them into invoice lines at the current rate, marks the entries as invoiced and exports a CSV or a printable invoice.
Can I track time from my phone?
A responsive web app works well on a phone for starting, stopping and adding entries. Because the timer lives on the server, you can start it on one device and stop it on another.
