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
|
.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
|
||||||
@@ -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 }}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
@@ -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/
|
||||||
|
|||||||
@@ -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
|
```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
|
```bash
|
||||||
cp .env.example .env
|
docker build -f docker/Dockerfile -t collabtable-server .
|
||||||
```
|
|
||||||
|
|
||||||
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
|
||||||
@@ -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
|
||||||
@@ -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/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
|
||||||
|
|
||||||
@@ -199,7 +195,7 @@ See [Server README](CollabTableServer/README.md) for detailed API documentation.
|
|||||||
|
|
||||||
1. Run the Go backend:
|
1. Run the Go backend:
|
||||||
```bash
|
```bash
|
||||||
cd CollabTableServer
|
cd backend
|
||||||
go test ./...
|
go test ./...
|
||||||
go run .
|
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:
|
3. Check and build the dashboard when changing web UI code:
|
||||||
```bash
|
```bash
|
||||||
cd webui
|
cd ../frontend
|
||||||
npm ci
|
npm ci
|
||||||
npm run check
|
npm run check
|
||||||
npm run build
|
npm run build
|
||||||
cd ..
|
cd ..
|
||||||
cp -R webui/build web
|
cp -R frontend/build backend/web
|
||||||
go build -o collabtable-server .
|
go -C backend build -o collabtable-server .
|
||||||
```
|
```
|
||||||
|
|
||||||
**Useful backend commands:**
|
**Useful backend commands:**
|
||||||
```bash
|
```bash
|
||||||
go test ./... # Run Go tests
|
go -C backend test ./... # Run Go tests
|
||||||
go vet ./... # Run static checks
|
go -C backend vet ./... # Run static checks
|
||||||
```
|
```
|
||||||
|
|
||||||
### Android Development
|
### Android Development
|
||||||
@@ -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
|
||||||
|
|
||||||
@@ -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:**
|
||||||
|
|||||||
+1
-1
@@ -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
@@ -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
@@ -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 .
|
||||||
|
|
||||||
|
|||||||
Generated
+2
-2
@@ -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,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",
|
||||||
|
|||||||
Reference in new issue
Block a user