Skip to content

Commit b3fa3ee

Browse files
authored
Merge pull request #66 from GRACENOBLE/first-week-friction
feat: first-week friction improvements (#50–#58)
2 parents 348580f + e12919d commit b3fa3ee

74 files changed

Lines changed: 2726 additions & 645 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/backend-ci.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ jobs:
2929
- name: Install dependencies
3030
run: go mod download
3131

32+
- name: Check Swagger docs are up to date
33+
run: |
34+
make swagger
35+
git diff --exit-code docs/swagger/
36+
3237
- name: Vet
3338
run: go vet ./...
3439

‎.github/workflows/mobile-ci.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,8 @@ jobs:
3838
- name: Lint
3939
run: ./gradlew lint
4040

41+
- name: Check formatting (ktlint via Spotless)
42+
run: ./gradlew spotlessCheck
43+
4144
- name: Run unit tests
4245
run: ./gradlew test

‎CONTRIBUTING.md‎

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,19 @@ Feature suggestions are welcome. Open an issue with:
6464

6565
```bash
6666
# Backend
67+
cd backend && go vet ./...
68+
cd backend && make lint # golangci-lint
6769
cd backend && make test
6870

6971
# Web
70-
cd web && pnpm lint && pnpm build
72+
cd web && pnpm lint
73+
cd web && pnpm test
74+
cd web && pnpm build
7175

7276
# Mobile
73-
cd mobile && ./gradlew lint && ./gradlew test
77+
cd mobile && ./gradlew lint
78+
cd mobile && ./gradlew spotlessCheck # ktlint formatting
79+
cd mobile && ./gradlew test
7480
```
7581

7682
6. **Open your pull request** against `main`. Fill in the PR template including:
@@ -82,21 +88,47 @@ Feature suggestions are welcome. Open an issue with:
8288

8389
## Development Setup
8490

85-
See [README.md — Getting Started](README.md#getting-started) for the full setup guide.
91+
### Prerequisites
8692

87-
Quick summary:
93+
| Tool | Minimum version | Check |
94+
|---|---|---|
95+
| Go | 1.25 | `go version` |
96+
| Node.js | 22 | `node --version` |
97+
| pnpm | any | `pnpm --version` |
98+
| Docker Desktop | running | `docker info` |
99+
| JDK | 17 | `java -version` |
100+
| Android SDK | API 35 | `$ANDROID_HOME` set |
101+
102+
### First-time setup
103+
104+
Run the setup script once after cloning. It checks prerequisites, installs dependencies, copies `.env` files, and runs database migrations:
105+
106+
```bash
107+
# macOS / Linux
108+
./setup.sh
109+
110+
# Windows
111+
./setup.ps1
112+
```
113+
114+
### Starting all services
88115

89116
```bash
90-
# Start the database
91-
cd backend && make docker-run
117+
# macOS / Linux — starts Postgres, backend, and web in one terminal
118+
./dev.sh
92119

93-
# Backend (hot reload)
94-
cd backend && make watch
120+
# Windows — opens three separate PowerShell windows
121+
./dev.ps1
122+
```
95123

96-
# Web (hot reload)
97-
cd web && pnpm dev
124+
Or start services individually:
125+
126+
```bash
127+
cd backend && make docker-run # Postgres
128+
cd backend && make watch # backend hot reload → :8080
129+
cd web && pnpm dev # web → :3000
98130

99-
# Mobile — open mobile/ in Android Studio, or build via Gradle
131+
# Mobile — open mobile/ in Android Studio, or:
100132
cd mobile && ./gradlew assembleDebug
101133
```
102134

@@ -119,7 +151,9 @@ This project uses topic-based documentation in `backend/docs/` and `web/docs/` t
119151
| Component patterns or TypeScript conventions | `web/docs/components.md` |
120152
| Composable conventions, theme, or Material3 usage | `mobile/docs/compose-conventions.md` |
121153
| Activity setup, lifecycle, or ViewModel pattern | `mobile/docs/architecture.md` |
154+
| UiState<T>, UiStateContent, or loading/error patterns | `mobile/docs/ui-states.md` |
122155
| Test setup or testing patterns (mobile) | `mobile/docs/testing.md` |
156+
| Data table component or TanStack Table usage | `web/docs/data-table.md` |
123157

124158
### How to update a doc
125159

‎TEMPLATE_STATUS.md‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Template Readiness Status
2+
3+
Tracks all identified gaps from the June 2026 template analysis. Issues live in the [fullstack-template GitHub project](https://github.com/users/GRACENOBLE/projects/8).
4+
5+
---
6+
7+
## Priority: Critical — Day 1 blockers
8+
9+
| # | Issue | Status |
10+
|---|-------|--------|
11+
| [#44](https://github.com/GRACENOBLE/fullstack-template/issues/44) | `backend` CORS origin hardcoded to localhost:3000 → make config-driven | ✅ Done (merged) |
12+
| [#45](https://github.com/GRACENOBLE/fullstack-template/issues/45) | `web` `.env.example` missing BACKEND_URL, SENTRY_ORG, SENTRY_PROJECT | ✅ Done (merged) |
13+
| [#46](https://github.com/GRACENOBLE/fullstack-template/issues/46) | `backend` Standardized API response envelope (`JSON`, `JSONError` helpers) | ✅ Done (merged) |
14+
| [#47](https://github.com/GRACENOBLE/fullstack-template/issues/47) | `backend` Request ID middleware (`X-Request-ID`, propagated to logs) | ✅ Done (merged) |
15+
| [#48](https://github.com/GRACENOBLE/fullstack-template/issues/48) | `web` Error pages: `not-found.tsx`, `error.tsx`, `global-error.tsx` | ✅ Done (merged) |
16+
| [#49](https://github.com/GRACENOBLE/fullstack-template/issues/49) | `mobile` HTTP client for backend API calls (OkHttp + Firebase token interceptor) | ✅ Done (merged) |
17+
18+
---
19+
20+
## Priority: High — First-week friction
21+
22+
| # | Issue | Status |
23+
|---|-------|--------|
24+
| [#50](https://github.com/GRACENOBLE/fullstack-template/issues/50) | `infra` Root dev script to start all services with one command | 🔁 In review |
25+
| [#51](https://github.com/GRACENOBLE/fullstack-template/issues/51) | `backend` Add `.golangci.yml` linter config | 🔁 In review |
26+
| [#52](https://github.com/GRACENOBLE/fullstack-template/issues/52) | `mobile` Add ktlint and integrate into CI | 🔁 In review |
27+
| [#53](https://github.com/GRACENOBLE/fullstack-template/issues/53) | `infra` Renovate / Dependabot for automated dependency updates | 🔁 In review |
28+
| [#54](https://github.com/GRACENOBLE/fullstack-template/issues/54) | `infra` First-run setup script for new contributors | 🔁 In review |
29+
| [#55](https://github.com/GRACENOBLE/fullstack-template/issues/55) | `backend` Swagger generation check in CI (fail if stale) | 🔁 In review |
30+
| [#56](https://github.com/GRACENOBLE/fullstack-template/issues/56) | `mobile` Loading state and skeleton screen pattern | 🔁 In review |
31+
| [#57](https://github.com/GRACENOBLE/fullstack-template/issues/57) | `mobile` Error state and retry UI pattern (`UiState<T>` sealed class) | 🔁 In review |
32+
| [#58](https://github.com/GRACENOBLE/fullstack-template/issues/58) | `web` Data table with sorting, filtering, and pagination (TanStack Table) | 🔁 In review |
33+
34+
---
35+
36+
## Priority: Medium — Polish
37+
38+
| # | Issue | Status |
39+
|---|-------|--------|
40+
| [#59](https://github.com/GRACENOBLE/fullstack-template/issues/59) | `mobile` Settings screen: show user profile + sign-out button | ⬜ Open |
41+
| [#60](https://github.com/GRACENOBLE/fullstack-template/issues/60) | `web` Dashboard page: fetch and display `/api/v1/me` | ⬜ Open |
42+
| [#61](https://github.com/GRACENOBLE/fullstack-template/issues/61) | `backend` Redis stream consumers: wire with feature flag or document as opt-in | ⬜ Open |
43+
| [#62](https://github.com/GRACENOBLE/fullstack-template/issues/62) | `backend` pprof endpoints for runtime profiling (gated to internal network) | ⬜ Open |
44+
45+
---
46+
47+
## Priority: Low — Nice-to-have
48+
49+
| # | Issue | Status |
50+
|---|-------|--------|
51+
| [#63](https://github.com/GRACENOBLE/fullstack-template/issues/63) | `infra` Architecture Decision Records (ADRs) for key technology choices | ⬜ Open |
52+
| [#64](https://github.com/GRACENOBLE/fullstack-template/issues/64) | `infra` Deployment runbook for staging and production | ⬜ Open |
53+
54+
---
55+
56+
## Legend
57+
58+
| Symbol | Meaning |
59+
|--------|---------|
60+
| ✅ Done | Merged to main |
61+
| 🔁 In review | PR open, pending merge |
62+
| ⬜ Open | Not started |
63+
| 🚧 In progress | Branch exists, work ongoing |
64+
65+
---
66+
67+
_Last updated: 2026-06-25 — #50–#58 implemented (first-week friction), PR pending._

‎backend/.golangci.yml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: "2"
2+
3+
linters:
4+
default: none
5+
enable:
6+
- errcheck # check errors are handled
7+
- gosimple # simplify code
8+
- govet # go vet checks
9+
- ineffassign # detect ineffectual assignments
10+
- staticcheck # staticcheck suite
11+
- unused # unused code
12+
- gofmt # formatting
13+
- goimports # import ordering
14+
- misspell # spelling mistakes
15+
- revive # drop-in golint replacement
16+
- bodyclose # HTTP response body close check
17+
- noctx # HTTP requests without context
18+
- exhaustive # exhaustive switch on enums (skip if too noisy — comment it out)
19+
20+
linters-settings:
21+
revive:
22+
rules:
23+
- name: exported
24+
disabled: true # don't require godoc on all exports
25+
26+
issues:
27+
exclude-rules:
28+
- path: _test\.go
29+
linters:
30+
- errcheck # test code can ignore errors freely

‎backend/Makefile‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ swagger:
3939
@echo "Generating Swagger docs..."
4040
@go run github.com/swaggo/swag/cmd/swag@v1.16.6 init -g cmd/api/main.go -o docs/swagger
4141

42+
# Lint the application
43+
lint:
44+
@echo "Linting..."
45+
@golangci-lint run ./...
46+
4247
# Live Reload
4348
watch:
4449
@powershell -ExecutionPolicy Bypass -Command "if (Get-Command air -ErrorAction SilentlyContinue) { \
@@ -77,6 +82,6 @@ migrate-version:
7782
migrate-create:
7883
@go run ./cmd/migrate create $(name)
7984

80-
.PHONY: all build run test clean watch docker-run docker-down itest swagger \
85+
.PHONY: all build run test clean watch lint docker-run docker-down itest swagger \
8186
migrate-up migrate-up-one migrate-down migrate-down-to migrate-reset \
8287
migrate-status migrate-version migrate-create

‎backend/docs/environment.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ sources:
77
- internal/bootstrap/bootstrap.go
88
- internal/infrastructure/database/postgres/db.go
99
- pkg/firebase/admin.go
10+
- .golangci.yml
11+
- Makefile
1012
---
1113

1214
# Environment Variables
@@ -58,6 +60,17 @@ The `.gitignore` in `backend/` excludes `.env` (verify before committing).
5860

5961
Docker Compose reads the same `.env` file to configure the Postgres container, so the values must be consistent between the app and Docker.
6062

63+
## Quality commands
64+
65+
| Command | What it runs |
66+
|---|---|
67+
| `make test` | `go test ./... -v` |
68+
| `make itest` | `go test ./internal/infrastructure/... -v` (requires Docker) |
69+
| `make lint` | `golangci-lint run ./...` |
70+
| `make swagger` | regenerates `docs/swagger/` from swaggo annotations |
71+
72+
`make lint` uses the config in `backend/.golangci.yml`. Enabled linters: `errcheck`, `gosimple`, `govet`, `ineffassign`, `staticcheck`, `unused`, `gofmt`, `goimports`, `misspell`, `revive`, `bodyclose`, `noctx`, `exhaustive`. The `revive` `exported` rule is disabled. Run `make lint` locally before pushing; CI also runs it.
73+
6174
## Adding a new environment variable
6275
1. Add to `backend/.env` with a descriptive name.
6376
2. Read it in `internal/bootstrap/bootstrap.go` inside `loadConfig()` and store it on `Config`.

‎dev.ps1‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# dev.ps1 — start all services in separate PowerShell windows (Windows equivalent of dev.sh)
2+
# Usage: .\dev.ps1
3+
# Close each terminal window manually when done.
4+
5+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
6+
7+
Write-Host "[postgres] Starting Docker Compose (Postgres)..." -ForegroundColor Blue
8+
Start-Process powershell -ArgumentList "-NoExit", "-Command", "Set-Location '$ScriptDir\backend'; make docker-run" `
9+
-WindowStyle Normal
10+
11+
Write-Host "[backend] Waiting 5s for Postgres, then starting Go backend on :8080..." -ForegroundColor Green
12+
Start-Process powershell -ArgumentList "-NoExit", "-Command", "Set-Location '$ScriptDir\backend'; Start-Sleep 5; make watch" `
13+
-WindowStyle Normal
14+
15+
Write-Host "[web] Starting Next.js dev server on :3000..." -ForegroundColor Yellow
16+
Start-Process powershell -ArgumentList "-NoExit", "-Command", "Set-Location '$ScriptDir\web'; pnpm dev" `
17+
-WindowStyle Normal
18+
19+
Write-Host ""
20+
Write-Host "All three services are starting in separate windows:" -ForegroundColor Cyan
21+
Write-Host " - Postgres (blue window)" -ForegroundColor Blue
22+
Write-Host " - Go backend (green window) → http://localhost:8080" -ForegroundColor Green
23+
Write-Host " - Next.js web (yellow window) → http://localhost:3000" -ForegroundColor Yellow
24+
Write-Host ""
25+
Write-Host "Close each window individually when you are done." -ForegroundColor Cyan

‎dev.sh‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
# dev.sh — start all services in parallel in a single terminal
3+
# Usage: ./dev.sh
4+
# Press Ctrl+C to stop everything.
5+
6+
set -euo pipefail
7+
8+
BLUE='\033[1;34m'
9+
GREEN='\033[1;32m'
10+
YELLOW='\033[1;33m'
11+
RESET='\033[0m'
12+
13+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
14+
15+
# Kill all background jobs when the script exits (Ctrl+C or error)
16+
trap 'echo ""; echo "Stopping all services..."; kill $(jobs -p) 2>/dev/null; wait' EXIT
17+
18+
# ── Postgres (Docker Compose) ──────────────────────────────────────────────────
19+
echo -e "${BLUE}[postgres] Starting Docker Compose (Postgres)...${RESET}"
20+
(cd "$SCRIPT_DIR/backend" && make docker-run) &
21+
22+
# ── Backend (Air hot-reload) — wait for Postgres to be ready ──────────────────
23+
(
24+
echo -e "${GREEN}[backend] Waiting 5s for Postgres to be healthy...${RESET}"
25+
sleep 5
26+
echo -e "${GREEN}[backend] Starting Go backend with Air (hot-reload) on :8080...${RESET}"
27+
cd "$SCRIPT_DIR/backend" && make watch
28+
) &
29+
30+
# ── Web (Next.js) ─────────────────────────────────────────────────────────────
31+
echo -e "${YELLOW}[web] Starting Next.js dev server on :3000...${RESET}"
32+
(cd "$SCRIPT_DIR/web" && pnpm dev) &
33+
34+
# Block until Ctrl+C triggers the trap above
35+
wait

‎mobile/.editorconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[*.kt]
2+
ktlint_standard_function-naming = disabled
3+
ktlint_standard_backing-property-naming = disabled
4+
ktlint_standard_no-wildcard-imports = disabled

0 commit comments

Comments
 (0)