refactor: reorganize project structure and update paths for backend and frontend
This commit is contained in:
1 parent
6c1ea2da47
commit
64d22d0aac
11 files changed
+72
-64
No files matched your search
+3
-3
@@ -4,8 +4,8 @@
|
||||
.env
|
||||
*.log
|
||||
node_modules
|
||||
webui/node_modules
|
||||
webui/.svelte-kit
|
||||
webui/build
|
||||
frontend/node_modules
|
||||
frontend/.svelte-kit
|
||||
frontend/build
|
||||
data/
|
||||
collabtable.db
|
||||
@@ -5,14 +5,18 @@ on:
|
||||
branches:
|
||||
- "**"
|
||||
paths:
|
||||
- 'CollabTableServer/**'
|
||||
- 'backend/**'
|
||||
- 'frontend/**'
|
||||
- 'docker/**'
|
||||
- '.github/workflows/docker.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
paths:
|
||||
- 'CollabTableServer/**'
|
||||
- 'backend/**'
|
||||
- 'frontend/**'
|
||||
- 'docker/**'
|
||||
- '.github/workflows/docker.yml'
|
||||
workflow_dispatch: {}
|
||||
|
||||
@@ -56,7 +60,8 @@ jobs:
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: ./CollabTableServer
|
||||
context: .
|
||||
file: ./docker/Dockerfile
|
||||
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' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
|
||||
@@ -5,14 +5,16 @@ on:
|
||||
branches:
|
||||
- "**"
|
||||
paths:
|
||||
- 'CollabTableServer/**'
|
||||
- 'backend/**'
|
||||
- 'frontend/**'
|
||||
- '.github/workflows/lint.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
paths:
|
||||
- 'CollabTableServer/**'
|
||||
- 'backend/**'
|
||||
- 'frontend/**'
|
||||
- '.github/workflows/lint.yml'
|
||||
workflow_dispatch: {}
|
||||
|
||||
@@ -22,7 +24,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: CollabTableServer/webui
|
||||
working-directory: frontend
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -35,7 +37,7 @@ jobs:
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: CollabTableServer/webui/package-lock.json
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
@@ -5,14 +5,16 @@ on:
|
||||
branches:
|
||||
- "**"
|
||||
paths:
|
||||
- 'CollabTableServer/**'
|
||||
- 'backend/**'
|
||||
- 'frontend/**'
|
||||
- '.github/workflows/tests.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
paths:
|
||||
- 'CollabTableServer/**'
|
||||
- 'backend/**'
|
||||
- 'frontend/**'
|
||||
- '.github/workflows/tests.yml'
|
||||
workflow_dispatch: {}
|
||||
|
||||
@@ -22,7 +24,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: CollabTableServer
|
||||
working-directory: backend
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -33,18 +35,18 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: CollabTableServer/go.mod
|
||||
go-version-file: backend/go.mod
|
||||
cache: true
|
||||
|
||||
- name: Test
|
||||
run: go test ./...
|
||||
|
||||
webui:
|
||||
frontend:
|
||||
name: Dashboard checks
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: CollabTableServer/webui
|
||||
working-directory: frontend
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -57,7 +59,7 @@ jobs:
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: npm
|
||||
cache-dependency-path: CollabTableServer/webui/package-lock.json
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
+7
-5
@@ -8,11 +8,13 @@ CollabTableAndroid/*.iml
|
||||
CollabTableAndroid/.DS_Store
|
||||
CollabTableAndroid/captures/
|
||||
|
||||
# Server
|
||||
CollabTableServer/node_modules/
|
||||
CollabTableServer/dist/
|
||||
CollabTableServer/.env
|
||||
CollabTableServer/*.log
|
||||
# Backend
|
||||
backend/.env
|
||||
backend/*.log
|
||||
|
||||
# Frontend
|
||||
frontend/node_modules/
|
||||
frontend/dist/
|
||||
|
||||
# IDEs
|
||||
.vscode/
|
||||
|
||||
@@ -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
|
||||
cd CollabTableServer
|
||||
cp backend/.env.example backend/.env
|
||||
```
|
||||
|
||||
2. **Copy environment file (optional):**
|
||||
2. **Build and run the server, pointing at your own PostgreSQL instance:**
|
||||
```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
|
||||
@@ -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
|
||||
@@ -189,7 +185,7 @@ bearer token) — see `CollabTableServer/README.md`'s "Authentication" section.
|
||||
- `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
|
||||
|
||||
@@ -199,7 +195,7 @@ See [Server README](CollabTableServer/README.md) for detailed API documentation.
|
||||
|
||||
1. Run the Go backend:
|
||||
```bash
|
||||
cd CollabTableServer
|
||||
cd backend
|
||||
go test ./...
|
||||
go run .
|
||||
```
|
||||
@@ -211,19 +207,19 @@ See [Server README](CollabTableServer/README.md) for detailed API documentation.
|
||||
|
||||
3. Check and build the dashboard when changing web UI code:
|
||||
```bash
|
||||
cd webui
|
||||
cd ../frontend
|
||||
npm ci
|
||||
npm run check
|
||||
npm run build
|
||||
cd ..
|
||||
cp -R webui/build web
|
||||
go build -o collabtable-server .
|
||||
cp -R frontend/build backend/web
|
||||
go -C backend build -o collabtable-server .
|
||||
```
|
||||
|
||||
**Useful backend commands:**
|
||||
```bash
|
||||
go test ./... # Run Go tests
|
||||
go vet ./... # Run static checks
|
||||
go -C backend test ./... # Run Go tests
|
||||
go -C backend vet ./... # Run static checks
|
||||
```
|
||||
|
||||
### Android Development
|
||||
@@ -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
|
||||
|
||||
@@ -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:**
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
# Local Go build/test cache
|
||||
.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/.gitkeep
|
||||
+5
-4
@@ -16,7 +16,8 @@ Svelte dashboard and the Android synchronization API from one container.
|
||||
## Quick start with Docker
|
||||
|
||||
```bash
|
||||
docker build -t collabtable-server .
|
||||
cd ..
|
||||
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 \
|
||||
@@ -40,13 +41,13 @@ go run .
|
||||
To build the dashboard for the embedded production binary:
|
||||
|
||||
```bash
|
||||
cd webui
|
||||
cd ../frontend
|
||||
npm ci
|
||||
npm run check
|
||||
npm run build
|
||||
cd ..
|
||||
Copy-Item -Recurse -Force webui/build web
|
||||
go build -o collabtable-server .
|
||||
Copy-Item -Recurse -Force frontend/build backend/web
|
||||
go -C backend build -o collabtable-server .
|
||||
```
|
||||
|
||||
The Dockerfile performs those dashboard and Go build steps automatically.
|
||||
|
||||
+7
-7
@@ -1,16 +1,16 @@
|
||||
FROM node:22-alpine AS webui-builder
|
||||
WORKDIR /webui
|
||||
COPY webui/package*.json ./
|
||||
FROM node:22-alpine AS frontend-builder
|
||||
WORKDIR /frontend
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm ci
|
||||
COPY webui/ ./
|
||||
COPY frontend/ ./
|
||||
RUN npm run build
|
||||
|
||||
FROM golang:1.26-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
COPY backend/go.mod backend/go.sum ./
|
||||
RUN go mod download
|
||||
COPY *.go ./
|
||||
COPY --from=webui-builder /webui/build ./web
|
||||
COPY backend/*.go ./
|
||||
COPY --from=frontend-builder /frontend/build ./web
|
||||
RUN apk add --no-cache ca-certificates && \
|
||||
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o server .
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "collabtable-server-webui",
|
||||
"name": "collabtable-server-frontend",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "collabtable-server-webui",
|
||||
"name": "collabtable-server-frontend",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@lucide/svelte": "latest",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "collabtable-server-webui",
|
||||
"name": "collabtable-server-frontend",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
Reference in new issue
Block a user