refactor: reorganize project structure and update paths for backend and frontend
This commit is contained in:
1 parent
6c1ea2da47
commit
64d22d0aac
11 files changed
+120
-112
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://android.com)
|
||||
[](https://go.dev)
|
||||
[](https://go.dev)
|
||||
|
||||
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
|
||||
- 📱 **Native Android app** built with Jetpack Compose
|
||||
- 💾 **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.)
|
||||
- ✏️ **Inline editing** of items with auto-save
|
||||
- 📤 **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)
|
||||
|
||||
### Server
|
||||
- 🚀 **Go REST API** built with `net/http`
|
||||
- 🚀 **Go REST API** built with `net/http`
|
||||
- 🐳 **Fully containerized** with Docker
|
||||
- 💾 **PostgreSQL** database (bring your own instance)
|
||||
- 🔄 **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
|
||||
- 📊 **Complete CRUD operations** for all entities
|
||||
|
||||
@@ -42,7 +42,7 @@ CollabTable allows multiple users to collaboratively create and manage lists wit
|
||||
|
||||
### Server
|
||||
- **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 Studio** Hedgehog or later
|
||||
@@ -54,19 +54,14 @@ CollabTable allows multiple users to collaboratively create and manage lists wit
|
||||
|
||||
### 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
|
||||
cd CollabTableServer
|
||||
```
|
||||
|
||||
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 build -f docker/Dockerfile -t collabtable-server .
|
||||
docker run -d --name collabtable-server --restart unless-stopped \
|
||||
-p 3000:3000 \
|
||||
-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,
|
||||
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`.
|
||||
|
||||
@@ -119,12 +114,13 @@ CollabTable/
|
||||
│ │ └── build.gradle
|
||||
│ └── README.md
|
||||
│
|
||||
└── CollabTableServer/ # Go server
|
||||
├── *.go # HTTP handlers, auth, sync, and database layer
|
||||
├── go.mod # Go dependencies
|
||||
├── webui/ # SvelteKit web dashboard (read-only database viewer)
|
||||
├── Dockerfile
|
||||
└── README.md
|
||||
├── backend/ # Go backend
|
||||
│ ├── *.go # HTTP handlers, auth, sync, and database layer
|
||||
│ ├── go.mod # Go dependencies
|
||||
│ └── README.md # Backend documentation
|
||||
├── frontend/ # SvelteKit web dashboard (read-only database viewer)
|
||||
└── docker/ # Container build files
|
||||
└── Dockerfile
|
||||
```
|
||||
|
||||
## Technology Stack
|
||||
@@ -133,18 +129,18 @@ CollabTable/
|
||||
- **Language:** Kotlin
|
||||
- **UI Framework:** Jetpack Compose with Material 3
|
||||
- **Database:** Room (SQLite)
|
||||
- **Networking:** Retrofit and OkHttp (HTTP)
|
||||
- **Networking:** Retrofit and OkHttp (HTTP)
|
||||
- **Async:** Coroutines & Flow
|
||||
- **Architecture:** MVVM with Repository pattern
|
||||
- **Build System:** Gradle with Kotlin DSL
|
||||
|
||||
### Server
|
||||
- **Runtime:** Go 1.26+
|
||||
- **Framework:** Go `net/http`
|
||||
- **Language:** Go
|
||||
- **Database:** PostgreSQL (pgx)
|
||||
- **Runtime:** Go 1.26+
|
||||
- **Framework:** Go `net/http`
|
||||
- **Language:** Go
|
||||
- **Database:** PostgreSQL (pgx)
|
||||
- **Containerization:** Docker
|
||||
- **Updates:** HTTP notification polling
|
||||
- **Updates:** HTTP notification polling
|
||||
|
||||
## 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
|
||||
```
|
||||
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
|
||||
- `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
|
||||
- `DELETE /api/items/:id` - Delete an item (soft delete)
|
||||
|
||||
### Sync
|
||||
- `POST /api/sync` - Synchronize data
|
||||
- `GET /api/notifications/poll?since=<timestamp-ms>` - Poll for remote changes
|
||||
### Sync
|
||||
- `POST /api/sync` - Synchronize data
|
||||
- `GET /api/notifications/poll?since=<timestamp-ms>` - Poll for remote changes
|
||||
|
||||
### Health
|
||||
- `GET /health` - Server health check
|
||||
|
||||
### 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/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
|
||||
|
||||
@@ -197,36 +193,36 @@ See [Server README](CollabTableServer/README.md) for detailed API documentation.
|
||||
|
||||
**Local development without Docker:**
|
||||
|
||||
1. Run the Go backend:
|
||||
```bash
|
||||
cd CollabTableServer
|
||||
go test ./...
|
||||
go run .
|
||||
```
|
||||
|
||||
2. Create `.env` file:
|
||||
1. Run the Go backend:
|
||||
```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
|
||||
cd webui
|
||||
npm ci
|
||||
npm run check
|
||||
npm run build
|
||||
cd ..
|
||||
cp -R webui/build web
|
||||
go build -o collabtable-server .
|
||||
```
|
||||
|
||||
**Useful backend commands:**
|
||||
```bash
|
||||
go test ./... # Run Go tests
|
||||
go vet ./... # Run static checks
|
||||
```
|
||||
|
||||
### Android Development
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
3. Check and build the dashboard when changing web UI code:
|
||||
```bash
|
||||
cd ../frontend
|
||||
npm ci
|
||||
npm run check
|
||||
npm run build
|
||||
cd ..
|
||||
cp -R frontend/build backend/web
|
||||
go -C backend build -o collabtable-server .
|
||||
```
|
||||
|
||||
**Useful backend commands:**
|
||||
```bash
|
||||
go -C backend test ./... # Run Go tests
|
||||
go -C backend vet ./... # Run static checks
|
||||
```
|
||||
|
||||
### Android Development
|
||||
|
||||
1. Open `CollabTableAndroid` in Android Studio
|
||||
|
||||
@@ -350,7 +346,7 @@ docker logs -f collabtable-server
|
||||
|
||||
# Rebuild container
|
||||
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)**
|
||||
@@ -361,7 +357,7 @@ docker build -t collabtable-server . && docker run -d --name collabtable-server
|
||||
### Getting Help
|
||||
|
||||
- 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`
|
||||
- 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:
|
||||
|
||||
### Sync Strategy
|
||||
- **Transport:** HTTP POST (`/api/sync`)
|
||||
- **Background updates:** Notification polling (`/api/notifications/poll`)
|
||||
- **Conflict Resolution:** Latest timestamp wins
|
||||
### Sync Strategy
|
||||
- **Transport:** HTTP POST (`/api/sync`)
|
||||
- **Background updates:** Notification polling (`/api/notifications/poll`)
|
||||
- **Conflict Resolution:** Latest timestamp wins
|
||||
|
||||
### How It Works
|
||||
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
|
||||
- **Soft Deletes:** Deleted items can be recovered on server
|
||||
- **Optimistic Updates:** UI updates immediately, syncs in background
|
||||
@@ -421,7 +417,7 @@ docker logs -f collabtable-server
|
||||
|
||||
**Rebuild and restart:**
|
||||
```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:**
|
||||
@@ -434,9 +430,9 @@ docker ps
|
||||
**Environment Variables**
|
||||
Configure these in `.env` or your `docker run` command:
|
||||
```env
|
||||
PORT=3000 # Server port
|
||||
APP_VERSION=dev # Dashboard version label
|
||||
DATABASE_URL=postgres://user:pass@postgres:5432/collabtable
|
||||
PORT=3000 # Server port
|
||||
APP_VERSION=dev # Dashboard version label
|
||||
DATABASE_URL=postgres://user:pass@postgres:5432/collabtable
|
||||
COOKIE_SECURE=true # Requires HTTPS
|
||||
```
|
||||
|
||||
@@ -455,7 +451,7 @@ server {
|
||||
|
||||
location / {
|
||||
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**
|
||||
- **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
|
||||
- Write meaningful variable and function names
|
||||
- Add comments for complex logic
|
||||
|
||||
Reference in new issue
Block a user