A Go Backend, a SwiftUI App
I'm a big fan of Todo apps and task managers. I bought the first Apple watch, specifically so I could use the OmniFocus app. I've bounced around between note apps. Never really finding something I stick with for too long. Evernote, the notes app, Google Docs, plain markdown in folders. Since I've been wanting to learn SwiftUI so I've decided to throw my hat in the ring and build my own.
A mix between task management and a notes app. Of course, it will be a Go backend for syncing the data but for Mac and iOS it will be SwiftUI.
The Data Model
The core model is fairly straightforward. There are three main entities:
- Projects - top-level containers for organising work
- Cards - individual tasks or items within a project
- Actions - discrete steps or subtasks within a card
A project has many cards, and a card has many actions. Nothing revolutionary, but it maps well to how I think about work. A card is a topic about something and the actions are the pieces of work to be done. Say you are building a SwiftUI frontend and want for an app. You can have a card talking about the MVVM design and actions for what needs to be implemented for a particular view to be rendered. 😁
PostgreSQL and Migrations
For persistence I'm using PostgreSQL. I considered SQLite for simplicity but PostgreSQL is what I use at work and I wanted the backend to be something I could deploy properly if I ever wanted to sync across devices.
Database migrations are handled with golang-migrate. Which I've recently come across. Each migration is a pair of SQL files (up and down), and the migration tool runs them in order. Keeping schema changes in version-controlled SQL files has saved me from a few headaches already.
CREATE TABLE projects (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL,
description TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
What's Next
The backend is in a good enough state to start building the SwiftUI frontend against it. It's live in the homelab for now and hitting it from the iOS simulator. The next step is getting the card and action views working in SwiftUI, which is what I actually set out to learn in the first place 😅.
As always, I appreciate any feedback or if you want to reach out, I'm
@neuralsandwich on twitter and most other places.