Overview
Recon Dev CRM is a single-owner internal business-operations application for managing intake submissions, service requests, clients, projects, tasks, notes, files, quotes, invoices, settings, and activity. The Next.js workspace uses protected server APIs and Prisma-backed PostgreSQL persistence to carry work from inquiry through delivery and billing. A signed website contact-intake bridge is one input to this system, not the system itself.
Engineering Lifecycle
Completed phases are based on the project's current recorded progress.
4 of 8 phases complete
- DiscoveryComplete
- ResearchComplete
- PlanningComplete
- PrototypeComplete
- ValidationNot complete
- DocumentationNot complete
- ReleaseNot complete
- MaintenanceNot complete
Milestones
No milestones have been documented yet.
Current Focus
Current engineering work is centered on making persisted workflows consistent: standardizing runtime validation, completing transactional and idempotent conversion paths, strengthening relational integrity, and establishing automated coverage for authentication, intake, billing, and project conversion behavior.
Design Decisions
- Model lifecycle stages as separate records
- Represent intake submissions, service requests, clients, projects, quotes, invoices, tasks, notes, files, activity, and settings as distinct persisted entities. This keeps the responsibilities and status of each business stage explicit.
- Persist business records in PostgreSQL
- Use Prisma-backed PostgreSQL storage as the system of record instead of relying on temporary browser state. Client-side context hydrates the workspace through protected JSON APIs.
- Keep database operations behind route handlers
- Place authentication, validation, persistence, and conversion operations in Next.js route handlers so client components do not access the database or server secrets directly.
- Enforce repeat-safe lifecycle conversions
- Use unique database links and duplicate-aware operations for intake-to-request, request-to-project, and quote-to-invoice transitions. The request-to-project path also groups project creation, request status, and activity creation in one transaction.
- Protect the workspace with owner sessions
- Use server-verified owner credentials and a signed, expiring HTTP-only cookie for the current single-owner workspace. Multi-user identity and role models are not part of the implemented system.
- Treat website intake as an integration boundary
- Accept external website inquiries through a dedicated server-to-server endpoint that requires bearer authorization, a timestamped HMAC signature, payload validation, and a stable inquiry identifier. This bridge feeds the CRM intake subsystem; it is not the CRM application itself.
Tradeoffs
- Single Next.js application versus separate services
- Keeping the UI, internal APIs, authentication, and persistence adapter in one application simplifies deployment and allows direct transaction handling, but couples the workspace and API contracts within one codebase.
- Single-owner authentication versus named users
- A shared owner credential and stateless signed session match the current internal audience and avoid user/session tables, but provide no roles, per-user revocation, or actor-specific audit attribution.
- Incremental persistence migration versus complete rewrite
- Entity-by-entity migrations preserve working features and produce an auditable schema history, but leave legacy mock data and historical documentation that can become inconsistent with current behavior.
- Global client context versus page-specific loading
- Loading the CRM collections into one shared context gives pages a consistent data surface, but every authenticated page fetches all resources and shares a coarse loading and error state.
- Local file storage versus shared durable storage
- Writing authenticated uploads to the application server is straightforward for a single durable host, but it does not provide atomic file-and-metadata writes or support ephemeral and multi-instance deployments without shared storage.
Known Limitations
- The repository has no automated test suite or test script for authentication, persistence, billing, or conversion workflows.
- Most cross-entity links are nullable string identifiers without database foreign keys, and copied display names can become stale.
- Runtime validation is inconsistent across protected APIs; the public intake boundary has stronger schema and payload-size validation than many internal routes.
- Authentication supports one owner credential and does not include login throttling, named users, roles, permissions, or per-user session revocation.
- Uploaded files use local server storage, are not content-allowlisted or malware-scanned, and require durable shared storage for multi-instance operation.
- The global client context fetches all CRM resources for every authenticated page and does not expose resource-specific failure states.
- Production readiness is not demonstrated by automated tests, continuous integration, observability, health checks, restore exercises, or rollback automation.
Development Log
Intake workflow visibility improved
Polished the website-submission intake workflow and added the count of new intake records to the authenticated workspace navigation.
Protected public intake and file persistence added
Added the authenticated server-to-server intake endpoint, synchronized accepted website inquiries into CRM intake, introduced local file uploads, and documented owner authentication and production deployment requirements.
Core persistence conversions strengthened
Moved client workflows onto PostgreSQL-backed APIs and added a transactional, idempotent service-request-to-project conversion guarded by a unique project link.
Lessons Learned
- Database uniqueness and transaction boundaries are necessary for repeat-safe conversions; interface controls alone do not prevent duplicate records under retries or concurrent requests.
- Separating intake, service requests, projects, quotes, and invoices makes lifecycle state explicit and allows each transition to be validated independently.
- Moving persistence and conversion logic behind server APIs keeps database access out of client components and gives business operations a consistent enforcement point.
- Automatically created activity records improve traceability for selected transitions, but they do not yet constitute a complete immutable audit system.
- Incremental persistence migrations preserve working workflows, but intermediate documentation and temporary data sources must be retired or clearly marked as the system evolves.
- A signed server-to-server intake contract protects integration secrets from browser code, while duplicate and replay controls still need enforcement at the receiving API boundary.
Future Improvements
- Add integration tests for authentication, unauthorized API access, public intake validation, and concurrent lifecycle conversions, then make tests part of continuous integration.
- Adopt shared runtime schemas and consistent error mapping for internal create and update routes.
- Apply the transactional, duplicate-aware conversion pattern consistently to intake-to-request and quote-to-invoice workflows.
- Define relationship ownership and add database foreign keys incrementally where orphaned records are not intentional.
- Move billing amounts to fixed-precision storage before invoices become an authoritative financial record.
- Introduce durable shared file storage, cleanup behavior, retention rules, and file-content controls.
- Split workspace data loading by page or domain and provide clear partial-failure states.
- Add login throttling, structured operational logging, health checks, and documented recovery procedures.
- Retain the signed website intake bridge and validate the end-to-end integration without exposing credentials or personal inquiry data.
Future Direction
The next direction is operational hardening rather than feature expansion: improve test and deployment controls, adopt durable shared file storage, refine page-level data loading, and validate the website-to-CRM intake path end to end. Named users or broader integrations should be considered only if a confirmed operating need extends beyond the current single-owner model.