Full-stack C++ implementation brief

CC

CargoCore Logistics Platform

Build a complete, secure, responsive international logistics and shipping platform with a C++ backend, REST API, database integration, administrator dashboard, and customer-facing web interface.

C++17 or newerREST APIPostgreSQLJWT authenticationResponsive frontend

1. Product Goal

Create an original logistics brand and a working website that helps customers learn about freight services, track verified shipments, request quotes, and contact support. Authorized staff must manage shipments, shipment events, quotes, inquiries, and editable website content.

Truthfulness requirement: Never fabricate shipment records, delivery updates, prices, customer identities, testimonials, certifications, offices, partnerships, carrier integrations, or GPS data. If an integration is not connected, label it as unavailable or planned.

2. Recommended Architecture

Backend

  • C++17 or C++20
  • REST framework such as Drogon, Crow, or oat++
  • PostgreSQL database
  • libpqxx or framework database layer
  • JSON serialization with nlohmann/json

Frontend

  • React and TypeScript or server-rendered HTML
  • Tailwind CSS or a maintainable CSS system
  • Responsive customer and admin layouts
  • Accessible semantic HTML
  • Fetch-based API client

Infrastructure

  • HTTPS reverse proxy
  • Environment-based configuration
  • Structured logs and health checks
  • Database migrations
  • CI build, test, and lint pipeline

Application layers

  • Routes/controllers
  • Request validation
  • Services/use cases
  • Repositories/data access
  • Authentication and authorization middleware

Suggested C++ structure

src/
  main.cpp
  config/
  http/
    routes.cpp
    middleware/
  controllers/
  services/
  repositories/
  models/
  validators/
  auth/
  utils/
tests/
migrations/
public/
  index.html
  assets/
CMakeLists.txt
.env.example
README.md

3. Brand and Interface

Use an original premium corporate identity called CargoCore or another editable name. Use navy blue, white, light gray, and orange accents. Use bold headings, readable body text, spacious layouts, professional logistics imagery, subtle transitions, clear CTAs, and mobile-first responsive behavior.

Shared UI elements

Implement a sticky header, mobile menu, logo, buttons, tracking form, service cards, shipment timeline, quote form, contact form, FAQ accordion, support widget, loading states, error states, empty states, success messages, admin layout, protected route, and a consistent footer.

Required pages

  • Home
  • About Us
  • Services overview
  • Air Freight, Ocean Freight, Road Freight, Express Courier detail pages
  • Shipment Tracking
  • Request a Quote
  • Contact Us
  • FAQ
  • Privacy Policy
  • Terms and Conditions
  • Protected Admin Dashboard

4. REST API Contract

Return JSON responses with consistent fields such as success, data, error, and requestId. Validate all request bodies server-side.

GET/api/health
Return service health and dependency status.
GET/api/shipments/track?number=...
Return safe public fields for a verified shipment only.
POST/api/quotes
Validate and save a quote request.
POST/api/contact
Validate and save a contact inquiry.
POST/api/auth/login
Authenticate authorized staff and issue a secure session or short-lived token.
POST/api/admin/shipments
Create a shipment for authorized staff.
PUT/api/admin/shipments/:id/status
Update status and create a tracking event.
GET/api/admin/quotes, /api/admin/inquiries
Return protected operational records for staff.

Example public tracking response

{
  "success": true,
  "data": {
    "trackingNumber": "CC-2026-0001",
    "status": "in_transit",
    "origin": "Chicago, USA",
    "destination": "Toronto, Canada",
    "estimatedDelivery": "2026-10-20",
    "currentLocation": "Detroit Facility",
    "shippingMethod": "Road Freight",
    "events": []
  },
  "requestId": "req_abc123"
}

5. Database Model

Use UUID primary keys, timestamps, foreign keys, indexes, check constraints, and migration files. Never use tracking numbers as the primary key.

TableRequired data
usersAuthentication identity, full name, role, active status, timestamps.
shipmentsUnique tracking number, status, sender/recipient, origin/destination, dates, location, package data, shipping method.
shipment_eventsShipment ID, stage, location, notes, event timestamp, staff author.
quote_requestsCustomer contact, pickup, destination, type, weight, dimensions, package count, method, pickup date, handling flags, status, staff response.
contact_inquiriesContact details, subject, message, status, staff response, assigned user, timestamps.
servicesEditable slug, title, description, benefits, image, active state, sort order.
faqsQuestion, answer, category, active state, sort order.
testimonialsAuthorized quote, consented name/company, approval status, display status.
site_settingsCompany name, logo, description, email, phone, address, hours, social links, mission, vision.

6. Shipment Tracking Rules

  1. Accept a tracking number and normalize safe whitespace/case.
  2. Query only verified shipment records.
  3. Return a safe not-found response without revealing whether private records exist.
  4. Expose only public fields; mask or omit private addresses, phone numbers, email addresses, and internal notes.
  5. Display the seven stages: Registered, Picked Up, Processing, In Transit, Arrived, Out for Delivery, Delivered.
  6. Show completed, current, and upcoming stages separately.
  7. Do not claim live GPS or real-time updates without a connected carrier/GPS provider.

7. Customer Forms

Quote request

Collect full name, email, phone, optional company, pickup, destination, shipment type, weight, dimensions, package count, shipping method, pickup date, instructions, special handling, and fragile cargo. Validate in the frontend and again in the C++ API. Save the request and tell the customer the team will review the details. Do not show an invented price.

Contact inquiry

Collect full name, email, optional phone, subject, and message. Save securely, return a confirmation, and show editable company contact information. If live chat is not integrated, provide a contact form instead of claiming an agent is available.

8. Administration

Protect the admin dashboard with authentication and role-based permissions. Implement separate permissions for staff and administrators.

Shipment management

  • Create records and unique tracking numbers
  • Edit shipment data
  • Update status
  • Add timestamped location events
  • Set ETA and mark delivered

Content management

  • Edit company information
  • Manage services and FAQs
  • Manage approved testimonials
  • Update contact details and hours

Quote management

  • View and filter requests
  • Update status
  • Record quoted price
  • Respond to customer inquiries

Inquiry management

  • View contact messages
  • Assign and update status
  • Record staff responses
  • Keep audit timestamps

9. Security and Privacy

  • Use HTTPS in production.
  • Store secrets only in environment variables or a secrets manager.
  • Hash passwords with Argon2id or bcrypt; never store plaintext passwords.
  • Use short-lived access tokens and refresh-token rotation, or secure HttpOnly cookies.
  • Validate and length-limit every request field.
  • Use parameterized SQL queries.
  • Apply CORS allowlists, rate limits, request-size limits, and security headers.
  • Log security-relevant events without logging passwords, tokens, or private customer data.
  • Return generic errors to clients and detailed errors only to protected logs.
  • Apply least privilege to database roles and admin actions.
Public data boundary: Prefer a dedicated SQL view or server-side response mapper for public tracking. This prevents private columns from being accidentally serialized into the browser response.

10. Testing and Operations

  • Unit tests for validators and status transitions
  • Repository tests against a test database
  • API tests for success and error cases
  • Authorization tests for every admin route
  • Not-found tracking tests
  • Input-size and malformed-JSON tests
  • Frontend responsive smoke tests
  • Accessibility keyboard and label checks
  • Migration and rollback tests
  • Health endpoint and dependency checks
  • Build requirements

    cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
    cmake --build build --parallel
    ctest --test-dir build --output-on-failure

    11. Acceptance Criteria

    The project is complete when:

    • All required customer and admin routes work.
    • The UI is responsive on mobile, tablet, and desktop.
    • Tracking queries real database records and never fabricates updates.
    • Public tracking responses protect private customer data.
    • Quote and contact forms validate and persist submissions.
    • Authorized staff can create and update shipments.
    • Status changes create timestamped shipment events.
    • Authentication and role-based access are enforced server-side.
    • RLS or equivalent database permissions are configured.
    • Services, FAQs, testimonials, and contact settings are editable.
    • Loading, empty, success, error, and not-found states are implemented.
    • SEO metadata, sitemap, robots.txt, semantic HTML, and accessibility basics are present.
    • The app has no hardcoded credentials or sensitive data in frontend code.
    • README documentation explains setup, environment variables, migrations, seed data, testing, and deployment.
    Recommended implementation order: Set up the C++ project and design system, implement migrations and repositories, add public tracking and forms, add authentication and admin routes, then finish content management, testing, accessibility, and deployment documentation.