refactor: reorganize project structure and update paths for backend and frontend
Docker / Docker Build & Push (push) Successful in 7m52s
Lint / Lint (push) Successful in 15s
Tests / Go backend (push) Successful in 19s
Tests / Dashboard checks (push) Successful in 18s

This commit is contained in:
Gabriel20xx committed 2026-08-03 22:40:08 +02:00
1 parent 6c1ea2da47
commit 64d22d0aac
11 files changed
+120 -112

No files matched your search

+3 -3
View File
@@ -4,8 +4,8 @@
.env .env
*.log *.log
node_modules node_modules
webui/node_modules frontend/node_modules
webui/.svelte-kit frontend/.svelte-kit
webui/build frontend/build
data/ data/
collabtable.db collabtable.db
+8 -3
View File
@@ -5,14 +5,18 @@ on:
branches: branches:
- "**" - "**"
paths: paths:
- 'CollabTableServer/**' - 'backend/**'
- 'frontend/**'
- 'docker/**'
- '.github/workflows/docker.yml' - '.github/workflows/docker.yml'
pull_request: pull_request:
branches: branches:
- main - main
- master - master
paths: paths:
- 'CollabTableServer/**' - 'backend/**'
- 'frontend/**'
- 'docker/**'
- '.github/workflows/docker.yml' - '.github/workflows/docker.yml'
workflow_dispatch: {} workflow_dispatch: {}
@@ -56,7 +60,8 @@ jobs:
- name: Build and push - name: Build and push
uses: docker/build-push-action@v7 uses: docker/build-push-action@v7
with: with:
context: ./CollabTableServer context: .
file: ./docker/Dockerfile
platforms: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && 'linux/amd64,linux/arm64' || 'linux/amd64' }} platforms: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
+6 -4
View File
@@ -5,14 +5,16 @@ on:
branches: branches:
- "**" - "**"
paths: paths:
- 'CollabTableServer/**' - 'backend/**'
- 'frontend/**'
- '.github/workflows/lint.yml' - '.github/workflows/lint.yml'
pull_request: pull_request:
branches: branches:
- main - main
- master - master
paths: paths:
- 'CollabTableServer/**' - 'backend/**'
- 'frontend/**'
- '.github/workflows/lint.yml' - '.github/workflows/lint.yml'
workflow_dispatch: {} workflow_dispatch: {}
@@ -22,7 +24,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults: defaults:
run: run:
working-directory: CollabTableServer/webui working-directory: frontend
permissions: permissions:
contents: read contents: read
@@ -35,7 +37,7 @@ jobs:
with: with:
node-version: '20' node-version: '20'
cache: 'npm' cache: 'npm'
cache-dependency-path: CollabTableServer/webui/package-lock.json cache-dependency-path: frontend/package-lock.json
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
+9 -7
View File
@@ -5,14 +5,16 @@ on:
branches: branches:
- "**" - "**"
paths: paths:
- 'CollabTableServer/**' - 'backend/**'
- 'frontend/**'
- '.github/workflows/tests.yml' - '.github/workflows/tests.yml'
pull_request: pull_request:
branches: branches:
- main - main
- master - master
paths: paths:
- 'CollabTableServer/**' - 'backend/**'
- 'frontend/**'
- '.github/workflows/tests.yml' - '.github/workflows/tests.yml'
workflow_dispatch: {} workflow_dispatch: {}
@@ -22,7 +24,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults: defaults:
run: run:
working-directory: CollabTableServer working-directory: backend
permissions: permissions:
contents: read contents: read
@@ -33,18 +35,18 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version-file: CollabTableServer/go.mod go-version-file: backend/go.mod
cache: true cache: true
- name: Test - name: Test
run: go test ./... run: go test ./...
webui: frontend:
name: Dashboard checks name: Dashboard checks
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults: defaults:
run: run:
working-directory: CollabTableServer/webui working-directory: frontend
permissions: permissions:
contents: read contents: read
@@ -57,7 +59,7 @@ jobs:
with: with:
node-version: '22' node-version: '22'
cache: npm cache: npm
cache-dependency-path: CollabTableServer/webui/package-lock.json cache-dependency-path: frontend/package-lock.json
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
+7 -5
View File
@@ -8,11 +8,13 @@ CollabTableAndroid/*.iml
CollabTableAndroid/.DS_Store CollabTableAndroid/.DS_Store
CollabTableAndroid/captures/ CollabTableAndroid/captures/
# Server # Backend
CollabTableServer/node_modules/ backend/.env
CollabTableServer/dist/ backend/*.log
CollabTableServer/.env
CollabTableServer/*.log # Frontend
frontend/node_modules/
frontend/dist/
# IDEs # IDEs
.vscode/ .vscode/
+71 -75
View File
@@ -2,7 +2,7 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Android](https://img.shields.io/badge/Android-26%2B-green.svg)](https://android.com) [![Android](https://img.shields.io/badge/Android-26%2B-green.svg)](https://android.com)
[![Go](https://img.shields.io/badge/Go-1.26%2B-00ADD8.svg)](https://go.dev) [![Go](https://img.shields.io/badge/Go-1.26%2B-00ADD8.svg)](https://go.dev)
A collaborative list management system with Android app and server for creating and managing shared lists with custom fields and items. A collaborative list management system with Android app and server for creating and managing shared lists with custom fields and items.
@@ -20,7 +20,7 @@ CollabTable allows multiple users to collaboratively create and manage lists wit
- ✨ **Beautiful Material 3 design** with dynamic colors - ✨ **Beautiful Material 3 design** with dynamic colors
- 📱 **Native Android app** built with Jetpack Compose - 📱 **Native Android app** built with Jetpack Compose
- 💾 **Offline-first** with Room database - 💾 **Offline-first** with Room database
- 🔄 **Synchronization** via transactional HTTP sync and notification polling - 🔄 **Synchronization** via transactional HTTP sync and notification polling
- 🎨 **Custom fields** (name, link, price, category, etc.) - 🎨 **Custom fields** (name, link, price, category, etc.)
- ✏️ **Inline editing** of items with auto-save - ✏️ **Inline editing** of items with auto-save
- 📤 **Export functionality** (CSV format) - 📤 **Export functionality** (CSV format)
@@ -30,11 +30,11 @@ CollabTable allows multiple users to collaboratively create and manage lists wit
- 🎯 **Column alignment** options (left, center, right) - 🎯 **Column alignment** options (left, center, right)
### Server ### Server
- 🚀 **Go REST API** built with `net/http` - 🚀 **Go REST API** built with `net/http`
- 🐳 **Fully containerized** with Docker - 🐳 **Fully containerized** with Docker
- 💾 **PostgreSQL** database (bring your own instance) - 💾 **PostgreSQL** database (bring your own instance)
- 🔄 **Advanced sync protocol** for conflict resolution - 🔄 **Advanced sync protocol** for conflict resolution
- 🔔 **Notification polling** for background updates - 🔔 **Notification polling** for background updates
- 🔐 **Single-admin-account dashboard login** (session cookie) plus long-lived API tokens for sync clients/devices - 🔐 **Single-admin-account dashboard login** (session cookie) plus long-lived API tokens for sync clients/devices
- 📊 **Complete CRUD operations** for all entities - 📊 **Complete CRUD operations** for all entities
@@ -42,7 +42,7 @@ CollabTable allows multiple users to collaboratively create and manage lists wit
### Server ### Server
- **Docker** and a PostgreSQL instance (bring your own - this app does not run Postgres for you) - **Docker** and a PostgreSQL instance (bring your own - this app does not run Postgres for you)
- Or **Go 1.26+** and Node.js 22+ for local development - Or **Go 1.26+** and Node.js 22+ for local development
### Android App ### Android App
- **Android Studio** Hedgehog or later - **Android Studio** Hedgehog or later
@@ -54,19 +54,14 @@ CollabTable allows multiple users to collaboratively create and manage lists wit
### Server (Docker) ### Server (Docker)
1. **Navigate to server directory:** 1. **From the repository root, copy the environment file (optional):**
```bash
cp backend/.env.example backend/.env
```
2. **Build and run the server, pointing at your own PostgreSQL instance:**
```bash ```bash
cd CollabTableServer docker build -f docker/Dockerfile -t collabtable-server .
```
2. **Copy environment file (optional):**
```bash
cp .env.example .env
```
3. **Build and run the server, pointing at your own PostgreSQL instance:**
```bash
docker build -t collabtable-server .
docker run -d --name collabtable-server --restart unless-stopped \ docker run -d --name collabtable-server --restart unless-stopped \
-p 3000:3000 \ -p 3000:3000 \
-e DATABASE_URL=postgres://user:password@host:5432/collabtable \ -e DATABASE_URL=postgres://user:password@host:5432/collabtable \
@@ -75,7 +70,7 @@ CollabTable allows multiple users to collaboratively create and manage lists wit
Server runs on `http://localhost:3000`. Open it in a browser to create the admin account, Server runs on `http://localhost:3000`. Open it in a browser to create the admin account,
then generate an API token from the dashboard's Settings page for your sync clients/devices then generate an API token from the dashboard's Settings page for your sync clients/devices
— see `CollabTableServer/README.md`'s "Authentication" section for details. — see `backend/README.md`'s "Authentication" section for details.
**Database:** PostgreSQL, bring your own instance via `DATABASE_URL`. **Database:** PostgreSQL, bring your own instance via `DATABASE_URL`.
@@ -119,12 +114,13 @@ CollabTable/
│ │ └── build.gradle │ │ └── build.gradle
│ └── README.md │ └── README.md
│ │
└── CollabTableServer/ # Go server ├── backend/ # Go backend
├── *.go # HTTP handlers, auth, sync, and database layer │ ├── *.go # HTTP handlers, auth, sync, and database layer
├── go.mod # Go dependencies │ ├── go.mod # Go dependencies
├── webui/ # SvelteKit web dashboard (read-only database viewer) │ └── README.md # Backend documentation
├── Dockerfile ├── frontend/ # SvelteKit web dashboard (read-only database viewer)
└── README.md └── docker/ # Container build files
└── Dockerfile
``` ```
## Technology Stack ## Technology Stack
@@ -133,18 +129,18 @@ CollabTable/
- **Language:** Kotlin - **Language:** Kotlin
- **UI Framework:** Jetpack Compose with Material 3 - **UI Framework:** Jetpack Compose with Material 3
- **Database:** Room (SQLite) - **Database:** Room (SQLite)
- **Networking:** Retrofit and OkHttp (HTTP) - **Networking:** Retrofit and OkHttp (HTTP)
- **Async:** Coroutines & Flow - **Async:** Coroutines & Flow
- **Architecture:** MVVM with Repository pattern - **Architecture:** MVVM with Repository pattern
- **Build System:** Gradle with Kotlin DSL - **Build System:** Gradle with Kotlin DSL
### Server ### Server
- **Runtime:** Go 1.26+ - **Runtime:** Go 1.26+
- **Framework:** Go `net/http` - **Framework:** Go `net/http`
- **Language:** Go - **Language:** Go
- **Database:** PostgreSQL (pgx) - **Database:** PostgreSQL (pgx)
- **Containerization:** Docker - **Containerization:** Docker
- **Updates:** HTTP notification polling - **Updates:** HTTP notification polling
## API Endpoints ## API Endpoints
@@ -154,7 +150,7 @@ Fields, Items, sync) require an API token generated from the web dashboard's Set
Authorization: Bearer your_api_token_here Authorization: Bearer your_api_token_here
``` ```
The dashboard itself has its own separate single-admin-account login (session cookie, not a The dashboard itself has its own separate single-admin-account login (session cookie, not a
bearer token) — see `CollabTableServer/README.md`'s "Authentication" section. bearer token) — see `backend/README.md`'s "Authentication" section.
### Lists ### Lists
- `GET /api/lists` - Get all lists - `GET /api/lists` - Get all lists
@@ -177,19 +173,19 @@ bearer token) — see `CollabTableServer/README.md`'s "Authentication" section.
- `PUT /api/items/:id` - Update an item - `PUT /api/items/:id` - Update an item
- `DELETE /api/items/:id` - Delete an item (soft delete) - `DELETE /api/items/:id` - Delete an item (soft delete)
### Sync ### Sync
- `POST /api/sync` - Synchronize data - `POST /api/sync` - Synchronize data
- `GET /api/notifications/poll?since=<timestamp-ms>` - Poll for remote changes - `GET /api/notifications/poll?since=<timestamp-ms>` - Poll for remote changes
### Health ### Health
- `GET /health` - Server health check - `GET /health` - Server health check
### Web UI ### Web UI
`/`, `/about`, and `/lists/:id` serve an embedded SvelteKit dashboard (a single-page app with client-side routing) for browsing lists/fields/items read-only. The dashboard shell is public; its data endpoints require the admin session. `/`, `/about`, and `/lists/:id` serve an embedded SvelteKit dashboard (a single-page app with client-side routing) for browsing lists/fields/items read-only. The dashboard shell is public; its data endpoints require the admin session.
- `GET /web/data` - JSON snapshot of all lists, fields, items, and values, used by the dashboard - `GET /web/data` - JSON snapshot of all lists, fields, items, and values, used by the dashboard
- `GET /web/info` - JSON tech stack info, shown on the dashboard's About page - `GET /web/info` - JSON tech stack info, shown on the dashboard's About page
See [Server README](CollabTableServer/README.md) for detailed API documentation. See [Server README](backend/README.md) for detailed API documentation.
## Development ## Development
@@ -197,36 +193,36 @@ See [Server README](CollabTableServer/README.md) for detailed API documentation.
**Local development without Docker:** **Local development without Docker:**
1. Run the Go backend: 1. Run the Go backend:
```bash
cd CollabTableServer
go test ./...
go run .
```
2. Create `.env` file:
```bash ```bash
cp .env.example .env cd backend
go test ./...
go run .
``` ```
3. Check and build the dashboard when changing web UI code: 2. Create `.env` file:
```bash ```bash
cd webui cp .env.example .env
npm ci ```
npm run check
npm run build 3. Check and build the dashboard when changing web UI code:
cd .. ```bash
cp -R webui/build web cd ../frontend
go build -o collabtable-server . npm ci
``` npm run check
npm run build
**Useful backend commands:** cd ..
```bash cp -R frontend/build backend/web
go test ./... # Run Go tests go -C backend build -o collabtable-server .
go vet ./... # Run static checks ```
```
**Useful backend commands:**
### Android Development ```bash
go -C backend test ./... # Run Go tests
go -C backend vet ./... # Run static checks
```
### Android Development
1. Open `CollabTableAndroid` in Android Studio 1. Open `CollabTableAndroid` in Android Studio
@@ -350,7 +346,7 @@ docker logs -f collabtable-server
# Rebuild container # Rebuild container
docker stop collabtable-server && docker rm collabtable-server docker stop collabtable-server && docker rm collabtable-server
docker build -t collabtable-server . && docker run -d --name collabtable-server ... docker build -f docker/Dockerfile -t collabtable-server . && docker run -d --name collabtable-server ...
``` ```
**Database connection error (PostgreSQL)** **Database connection error (PostgreSQL)**
@@ -361,7 +357,7 @@ docker build -t collabtable-server . && docker run -d --name collabtable-server
### Getting Help ### Getting Help
- Check the [Android README](CollabTableAndroid/README.md) for app-specific details - Check the [Android README](CollabTableAndroid/README.md) for app-specific details
- Check the [Server README](CollabTableServer/README.md) for server-specific details - Check the [Server README](backend/README.md) for server-specific details
- Review Docker logs: `docker logs -f collabtable-server` - Review Docker logs: `docker logs -f collabtable-server`
- Open an issue on GitHub with detailed error messages - Open an issue on GitHub with detailed error messages
@@ -369,10 +365,10 @@ docker build -t collabtable-server . && docker run -d --name collabtable-server
CollabTable uses a sophisticated sync protocol to keep data consistent across clients: CollabTable uses a sophisticated sync protocol to keep data consistent across clients:
### Sync Strategy ### Sync Strategy
- **Transport:** HTTP POST (`/api/sync`) - **Transport:** HTTP POST (`/api/sync`)
- **Background updates:** Notification polling (`/api/notifications/poll`) - **Background updates:** Notification polling (`/api/notifications/poll`)
- **Conflict Resolution:** Latest timestamp wins - **Conflict Resolution:** Latest timestamp wins
### How It Works ### How It Works
1. **Client → Server:** Client sends all local changes since last sync timestamp 1. **Client → Server:** Client sends all local changes since last sync timestamp
@@ -393,7 +389,7 @@ Client Server
| | | |
``` ```
### Features ### Features
- **Automatic Sync:** Triggered on app start and after local changes - **Automatic Sync:** Triggered on app start and after local changes
- **Soft Deletes:** Deleted items can be recovered on server - **Soft Deletes:** Deleted items can be recovered on server
- **Optimistic Updates:** UI updates immediately, syncs in background - **Optimistic Updates:** UI updates immediately, syncs in background
@@ -421,7 +417,7 @@ docker logs -f collabtable-server
**Rebuild and restart:** **Rebuild and restart:**
```bash ```bash
docker build -t collabtable-server . && docker restart collabtable-server docker build -f docker/Dockerfile -t collabtable-server . && docker restart collabtable-server
``` ```
**Check running containers:** **Check running containers:**
@@ -434,9 +430,9 @@ docker ps
**Environment Variables** **Environment Variables**
Configure these in `.env` or your `docker run` command: Configure these in `.env` or your `docker run` command:
```env ```env
PORT=3000 # Server port PORT=3000 # Server port
APP_VERSION=dev # Dashboard version label APP_VERSION=dev # Dashboard version label
DATABASE_URL=postgres://user:pass@postgres:5432/collabtable DATABASE_URL=postgres://user:pass@postgres:5432/collabtable
COOKIE_SECURE=true # Requires HTTPS COOKIE_SECURE=true # Requires HTTPS
``` ```
@@ -455,7 +451,7 @@ server {
location / { location / {
proxy_pass http://localhost:3000; proxy_pass http://localhost:3000;
proxy_set_header Host $host; proxy_set_header Host $host;
} }
} }
``` ```
@@ -477,7 +473,7 @@ Contributions are welcome! Here's how you can help:
**Code Style** **Code Style**
- **Android:** Follow Kotlin conventions, use ktlint for formatting - **Android:** Follow Kotlin conventions, use ktlint for formatting
- **Server:** Follow Go conventions, run `gofmt`, and keep handlers testable - **Server:** Follow Go conventions, run `gofmt`, and keep handlers testable
- Keep functions small and focused - Keep functions small and focused
- Write meaningful variable and function names - Write meaningful variable and function names
- Add comments for complex logic - Add comments for complex logic
+1 -1
View File
@@ -5,7 +5,7 @@
# Local Go build/test cache # Local Go build/test cache
.gocache/ .gocache/
# Generated: webui build output, copied to ./web before the Go build. # Generated: frontend build output, copied to ./web before the Go build.
web/ web/
!web/ !web/
!web/.gitkeep !web/.gitkeep
+5 -4
View File
@@ -16,7 +16,8 @@ Svelte dashboard and the Android synchronization API from one container.
## Quick start with Docker ## Quick start with Docker
```bash ```bash
docker build -t collabtable-server . cd ..
docker build -f docker/Dockerfile -t collabtable-server .
docker run -d --name collabtable-server --restart unless-stopped \ docker run -d --name collabtable-server --restart unless-stopped \
-p 3000:3000 \ -p 3000:3000 \
-e DATABASE_URL=postgres://user:password@host:5432/collabtable \ -e DATABASE_URL=postgres://user:password@host:5432/collabtable \
@@ -40,13 +41,13 @@ go run .
To build the dashboard for the embedded production binary: To build the dashboard for the embedded production binary:
```bash ```bash
cd webui cd ../frontend
npm ci npm ci
npm run check npm run check
npm run build npm run build
cd .. cd ..
Copy-Item -Recurse -Force webui/build web Copy-Item -Recurse -Force frontend/build backend/web
go build -o collabtable-server . go -C backend build -o collabtable-server .
``` ```
The Dockerfile performs those dashboard and Go build steps automatically. The Dockerfile performs those dashboard and Go build steps automatically.
+7 -7
View File
@@ -1,16 +1,16 @@
FROM node:22-alpine AS webui-builder FROM node:22-alpine AS frontend-builder
WORKDIR /webui WORKDIR /frontend
COPY webui/package*.json ./ COPY frontend/package*.json ./
RUN npm ci RUN npm ci
COPY webui/ ./ COPY frontend/ ./
RUN npm run build RUN npm run build
FROM golang:1.26-alpine AS builder FROM golang:1.26-alpine AS builder
WORKDIR /app WORKDIR /app
COPY go.mod go.sum ./ COPY backend/go.mod backend/go.sum ./
RUN go mod download RUN go mod download
COPY *.go ./ COPY backend/*.go ./
COPY --from=webui-builder /webui/build ./web COPY --from=frontend-builder /frontend/build ./web
RUN apk add --no-cache ca-certificates && \ RUN apk add --no-cache ca-certificates && \
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o server . CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o server .
+2 -2
View File
@@ -1,11 +1,11 @@
{ {
"name": "collabtable-server-webui", "name": "collabtable-server-frontend",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "collabtable-server-webui", "name": "collabtable-server-frontend",
"version": "1.0.0", "version": "1.0.0",
"dependencies": { "dependencies": {
"@lucide/svelte": "latest", "@lucide/svelte": "latest",
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"name": "collabtable-server-webui", "name": "collabtable-server-frontend",
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,
"type": "module", "type": "module",