Skip to content

Vibers review: fix build failures (missing middleware + .env.example)#2

Open
marsiandeployer wants to merge 1 commit intoMethasMP:mainfrom
marsiandeployer:vibers/review-2026-03-23
Open

Vibers review: fix build failures (missing middleware + .env.example)#2
marsiandeployer wants to merge 1 commit intoMethasMP:mainfrom
marsiandeployer:vibers/review-2026-03-23

Conversation

@marsiandeployer
Copy link
Copy Markdown

What was broken

This PR fixes issues that prevented the project from building at all.

1. Go backend: 3 missing middleware files

main.go calls middleware.Recovery(), middleware.CORSMiddleware(), and middleware.SecurityHeadersMiddleware() — but none of these files existed. The backend cannot compile without them.

Added minimal correct implementations:

  • recovery.go — panic recovery → 500 response
  • cors.go — CORS headers, origin from CORS_ORIGIN env var (defaults to https://paycif.com)
  • security_headers.go — standard security headers (X-Frame-Options, X-Content-Type-Options, etc.)

2. Flutter frontend: missing .env asset

pubspec.yaml declares .env as an asset, but the file is gitignored and not in the repo. Flutter build fails with:

Error detected in pubspec.yaml: No file or variants found for asset: .env.

Added frontend/.env.example — copy it to .env before building:

cp frontend/.env.example frontend/.env
# fill in real values
flutter build web

3. .gitignore was hiding source files

back-end/.gitignore had bare names like api, verify, worker meant to ignore compiled binaries. These patterns also matched the cmd/api/ source directory, making those files invisible to git.

Changed to /api, /verify, /worker (root-relative patterns).


How to verify

# Backend
cd back-end && go build ./...

# Frontend
cp frontend/.env.example frontend/.env
cd frontend && flutter build web

Both should succeed after this PR.


Reviewed by @marsiandeployer via Vibers

…erns

- Add Recovery(), CORSMiddleware(), SecurityHeadersMiddleware() — declared
  in main.go but files were missing, causing build failure
- Add frontend/.env.example so new devs know what variables are required
- Fix back-end/.gitignore: binary names (api, verify, worker) were matching
  the cmd/api/ directory and hiding source files from git; changed to /api etc.

How to test:
  cd back-end && go build ./...   # should succeed with exit 0
  cd frontend && flutter build web  # requires .env (copy from .env.example)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant