Prompt file imported from traianBaciu/rivalpr-intel (
.github/prompts/plan-rivalPrIntel.prompt.md). Copyright stays with the author.
Plan: RivalPR Intel — Full-Stack Implementation
Build the RivalPR Intel PR Agency CRM from your Architecture.md. 4 mandatory layers (Next.js, Go/Gin, PostgreSQL, Docker) plus Anthropic Claude AI for pitch generation. Structured into 4 phases aligned with the hackathon timeline, with custom Copilot agent modes per layer.
Phase 0 — Project Scaffolding & Agent Setup (Start of Week 2)
- Initialize Git repo with proper
.gitignore(Go, Node, Docker,.env) - Create project folder structure:
backend/— Go module withcmd/server/,internal/{models,handlers,middleware,services,worker,config}/frontend/— Next.js App Router withsrc/{app,components,lib}/.github/agents/— 4 Copilot agent modes.github/copilot-instructions.md— project-wide conventions
- Create 4 custom Copilot agent modes:
backend.agent.md— Go/Gin specialist (tools: read, edit, search, execute). Knows Gin routing, GORM, JWT, Go project layout. Restricted tobackend/only.frontend.agent.md— Next.js/shadcn/ui specialist (tools: read, edit, search, execute). Knows App Router, Tailwind, TypeScript. Restricted tofrontend/only.database.agent.md— PostgreSQL/GORM specialist (tools: read, edit, search). Knows model definitions, migrations, relationships, soft-delete, UUID PKs. Restricted to models/migration code.devops.agent.md— Docker/compose/CI specialist (tools: read, edit, search, execute). Knows multi-stage Dockerfiles, compose orchestration, GitHub Actions. Restricted to infra files.
- Create workspace-wide
copilot-instructions.mdwith project conventions (naming, error handling, auth patterns)
Phase 1 — Database & Backend Core (Week 2: Apr 8–14)
- Docker Compose baseline (parallel with step 6) —
docker-compose.ymlwithfrontend,backend,dbservices. PostgreSQL alpine with persistent volume. Go backend withairhot-reload..env.examplewith all 6 env vars. - GORM models & auto-migration (parallel with step 5) — All 8 tables:
User,Outlet,Client,Journalist,CrmRelationship,Campaign,Pitch,PitchVersion. UUID PKs,gorm.Modelfor soft-delete tables, CHECK constraint onpitches.status, composite unique indexes. - Auth system (depends on 6) —
POST /auth/register(bcrypt cost ≥ 12),POST /auth/login(returns JWT), JWT middleware extracting user ID into Gin context. - CRUD API endpoints (depends on 7) — Full REST for Clients, Outlets, Journalists (cursor-paginated), CRM Relationships, Campaigns, Pitches — all user-scoped where applicable. 6 resource groups.
- Rate limiting middleware (parallel with 8) — Token bucket per user: 10/min auth, 20/min AI, 120/min other.
- Postman/Bruno collection (depends on 8) — Exported collection with all endpoints + auth flow examples.
Week 2 Deliverable: Working API with core endpoints + API collection
Phase 2 — Frontend & Integration (Week 3: Apr 15–21)
- Next.js project setup — App Router, TypeScript, Tailwind, shadcn/ui. API client utility with JWT token management. Auth context/provider.
- Auth pages (depends on 11) — Login (
/login), Register (/register), auth guard middleware. - Core views (5 pages) (depends on 12):
- Dashboard (
/) — client count, active campaigns, recent pitches - Clients (
/clients) — list, create, edit, soft-delete - Journalists (
/journalists) — paginated list, outlet selection, CRM score slider - Campaigns (
/campaigns) — list, create with press release text - Pitches (
/pitches) — create, generate AI version, version picker with side-by-side comparison
- Dashboard (
- Docker integration (parallel with 13) — Frontend Dockerfile (multi-stage), verify
docker compose upruns all 3 services. - Responsive design pass (depends on 13) — Mobile viewport support, consistent component usage.
Week 3 Deliverable: FE connected to BE + docker-compose running locally
Phase 3 — AI Integration & Polish (Week 4: Apr 22–30)
- Anthropic Claude integration — Async goroutine worker + job channel. Context injection: press release, journalist niche, outlet name, CRM score. POST to Claude API. Store
pitch_versionswithprompt_snapshot. - Optimistic UI (depends on 16) — Local status updates on "Mark as Sent", loading states with polling for AI generation.
- README.md (parallel with 16) — Project description, prerequisites, setup, architecture overview, env var docs,
docker compose upinstructions. - Unit tests (bonus +5 pts, parallel with 16) — Backend tests for auth service and CRUD handlers.
- CI/CD pipeline (bonus +5 pts, parallel with 19) — GitHub Actions: lint, test, build Docker images.
- Demo prep (depends on all) — Seed DB with realistic PR data. Practice demo flow: register → create client → add journalist → create campaign → generate AI pitch → compare versions → send. Prepare architecture defense.
Week 4 Deliverable: Live demo + code walkthrough + architecture defense
Relevant Files
| Area | Path | Purpose |
|---|---|---|
| Agents | .github/agents/backend.agent.md |
Go/Gin coding agent |
| Agents | .github/agents/frontend.agent.md |
Next.js/shadcn agent |
| Agents | .github/agents/database.agent.md |
GORM/PostgreSQL agent |
| Agents | .github/agents/devops.agent.md |
Docker/CI agent |
| Instructions | .github/copilot-instructions.md |
Project-wide conventions |
| Backend entry | backend/cmd/server/main.go |
App entrypoint, router, DB connect |
| Models | backend/internal/models/*.go |
8 GORM models |
| Handlers | backend/internal/handlers/*.go |
HTTP handlers per resource |
| Auth MW | backend/internal/middleware/auth.go |
JWT validation |
| Rate limit | backend/internal/middleware/ratelimit.go |
Per-user rate limiting |
| AI worker | backend/internal/worker/worker.go |
Async Claude API goroutine pool |
| AI client | backend/internal/services/anthropic.go |
Anthropic API wrapper |
| Config | backend/internal/config/config.go |
Env var loader |
| Frontend API | frontend/src/lib/api.ts |
REST client with JWT |
| Pages | frontend/src/app/(dashboard)/*/page.tsx |
5 core views |
| Docker | docker-compose.yml |
Orchestrates all 3 services |
| CI/CD | .github/workflows/ci.yml |
Bonus: GitHub Actions pipeline |
Verification
docker compose up— all 3 containers start; frontend at :3000, backend at :8080, DB at :5432- Register user → login → receive JWT → use for authenticated requests
- CRUD all resources (clients, outlets, journalists, campaigns, pitches) via API
- Trigger AI pitch generation → verify
pitch_versionscreated with body + prompt snapshot - Navigate all 5 frontend views — real backend data, no hardcoded mocks
- Full demo flow: register → client → journalist with outlet → campaign → generate pitch → compare versions → send
- Rate limiting: confirm 429 responses when exceeding limits
- Soft delete: delete a client, verify it disappears but historical pitches remain
Decisions
- Go backend — aligns with company's V3 rewrite evaluation; demonstrates concurrency via goroutine worker pool
- PostgreSQL — relational integrity for PR domain (pitches → clients, campaigns, journalists)
- shadcn/ui — maximizes frontend velocity for solo developer
- Async AI (202 + polling) — prevents request timeouts on Claude API calls
- Scope boundary — Core CRM + AI pitch generation. Excluded: real email sending, analytics dashboards, multi-tenancy
Further Considerations
- Anthropic API key: Obtain before Week 4. During Weeks 2-3, stub the AI worker with mock responses so the full flow is testable without the key.
- Live deployment (+5 bonus): Docker images make this straightforward via Railway or Fly.io. Decision deferred — plan supports it.
- Test coverage (+5 bonus): Focus on backend unit tests for auth and pitch generation — highest ROI for a solo build.