Build and Deploy — Clarin CRM
IMPORTANT: No Go compiler installed locally. All builds MUST use Docker.
Build Commands
Backend (Go/Fiber)
bash
cd /root/proyect/clarin && docker compose build backend
Frontend (Next.js/React)
bash
cd /root/proyect/clarin && docker compose build frontend
Both services
bash
cd /root/proyect/clarin && docker compose build backend frontend
Deploy Commands
After a successful build:
bash
cd /root/proyect/clarin && docker compose up -d
Verify Commands
Always check logs after deploy:
bash
# Backend logs docker compose logs --tail=30 backend # Frontend logs docker compose logs --tail=30 frontend # All services docker compose logs --tail=30
Mandatory Workflow
After EVERY code change, follow this exact sequence:
- •Build the affected service(s) —
docker compose build backendand/ordocker compose build frontend - •If build fails: Read the error, fix it, rebuild. Repeat until clean.
- •Deploy —
docker compose up -d - •Check logs —
docker compose logs --tail=30 backendorfrontend - •If runtime errors: Read the logs, fix the issue, rebuild and redeploy.
- •NEVER present code to the user without a successful build and clean logs.
Common Build Errors
- •Go import errors: Check
backend/go.modand ensure all imports match actual package paths. - •Go undefined errors: Usually a missing function or wrong package reference. Check the file where it's defined.
- •TypeScript type errors: Check interface definitions in the component or
@/lib/api.ts. - •Next.js build errors: Often missing dependencies — check
frontend/package.json.
Docker Architecture
- •Backend: Multi-stage build using
golang:1.24-alpinewith CGO_ENABLED=1 (required for whatsmeow/sqlite) - •Frontend: Multi-stage build using
node:20-alpinewith standalone Next.js output - •Dockerfiles are in
deploy/Dockerfile.backendanddeploy/Dockerfile.frontend