No description
Find a file
hermes 9383e261f8
Some checks failed
CI/CD Pipeline / Code Quality (push) Successful in 1m56s
CI/CD Pipeline / Security Scan (push) Has been skipped
E2E Tests / E2E Tests (push) Failing after 35s
Quick Test Run / Quick Test Suite (push) Failing after 16s
Quick Test Run / Smoke Tests (push) Failing after 16s
CI/CD Pipeline / Backend Tests (push) Successful in 4m38s
CI/CD Pipeline / Frontend Tests (push) Successful in 42s
CI/CD Pipeline / Integration Tests (push) Successful in 1m51s
CI/CD Pipeline / Test Summary (push) Successful in 10s
ci: re-run via runner pickup verification
2026-09-26 20:06:55 -07:00
.forgejo/workflows fix(ci): point DATABASE_URL to localhost instead of 'postgres' hostname 2026-09-14 13:33:14 -07:00
.github/workflows fix: use full action URLs for Forgejo compatibility 2026-06-03 20:27:02 -07:00
.hermes fix #25: No payload generation or staging 2026-05-27 01:49:16 -07:00
.sisyphus Initial commit after repository reset 2026-04-12 18:46:45 -07:00
backend fix(db): use postgresql.ENUM(create_type=False) for sla_notifications.breach_type 2026-09-14 13:14:33 -07:00
docs fix #44: wire webhook delivery engine end-to-end (task, test_emit, tests, docs) 2026-08-13 01:22:15 -07:00
frontend fix(frontend): resolve JSX parse error and lint warnings 2026-09-14 12:41:56 -07:00
generated_prompts Initial commit after repository reset 2026-04-12 18:46:45 -07:00
nginx fix #6: [Production Readiness] SSL/TLS Configuration Not Started 2026-05-27 19:57:50 -07:00
ops Initial commit after repository reset 2026-04-12 18:46:45 -07:00
project_state Initial commit after repository reset 2026-04-12 18:46:45 -07:00
scripts fix #47: remove all ruff lint errors so 'ruff check .' exits 0 2026-08-13 00:34:04 -07:00
.checkov.yaml fix #31: add HEALTHCHECK to 5 Dockerfiles, restrict CI permissions, add checkov config 2026-05-18 14:19:40 -07:00
.dockerignore chore: update CI workflows, docker configs, backend/frontend, add dockerignore 2026-05-10 07:08:34 -07:00
.env.development fix #37: [Phase 1] SLA Management UI and Configuration — Phase 6: SLA Breach Notifications 2026-06-07 18:14:21 -07:00
.env.example fix #37: [Phase 1] SLA Management UI and Configuration — Phase 6: SLA Breach Notifications 2026-06-07 18:14:21 -07:00
.gitignore chore: gitignore .kilo/ working notes (Mark/msp_c2#48) 2026-09-09 08:37:34 -07:00
.pre-commit-config.yaml chore: add basic pre-commit hooks (trailing-whitespace, eof-fixer, ruff) 2026-06-03 17:28:45 -07:00
AGENT_QUICKSTART.md Initial commit after repository reset 2026-04-12 18:46:45 -07:00
app.yml Fix #14: Add app.yml manifest for deployment 2026-05-11 12:57:24 -07:00
CHANGELOG.md docs: changelog entries for bughunt fixes (DetachedInstanceError, rate limiter, test suite 86->206) 2026-08-10 19:50:51 -07:00
CONTRIBUTING.md Initial commit after repository reset 2026-04-12 18:46:45 -07:00
docker-compose.prod.yml fix #37: [Phase 1] SLA Management UI and Configuration — Phase 6: SLA Breach Notifications 2026-06-07 18:14:21 -07:00
docker-compose.release.yml fix #37: [Phase 1] SLA Management UI and Configuration — Phase 6: SLA Breach Notifications 2026-06-07 18:14:21 -07:00
docker-compose.test.yml Initial commit after repository reset 2026-04-12 18:46:45 -07:00
docker-compose.yml fix #37: [Phase 1] SLA Management UI and Configuration — Phase 6: SLA Breach Notifications 2026-06-07 18:14:21 -07:00
filter_large_objects.sh Initial commit after repository reset 2026-04-12 18:46:45 -07:00
PLAN_SLA_UI.md fix #32: [Phase 1] SLA Management UI and Configuration — Phase 1: Overview 2026-06-07 22:47:35 -07:00
PRODUCTION_READINESS_ROADMAP.md fix #6: [Production Readiness] SSL/TLS Configuration Not Started 2026-05-27 19:57:50 -07:00
pyrightconfig.json Initial commit after repository reset 2026-04-12 18:46:45 -07:00
pytest.ini Initial commit after repository reset 2026-04-12 18:46:45 -07:00
README.md Fix #19: Document network topology module in README 2026-05-09 11:44:53 -07:00
RELEASE.md Initial commit after repository reset 2026-04-12 18:46:45 -07:00
ROADMAP.md fix #37: [Phase 1] SLA Management UI and Configuration — Phase 6: SLA Breach Notifications 2026-06-07 18:14:21 -07:00
test_harness.py fix #47: remove all ruff lint errors so 'ruff check .' exits 0 2026-08-13 00:34:04 -07:00
TEST_HARNESS_README.md Initial commit after repository reset 2026-04-12 18:46:45 -07:00
validate_mvp.py fix #47: remove all ruff lint errors so 'ruff check .' exits 0 2026-08-13 00:34:04 -07:00
validate_tests.py fix #47: remove all ruff lint errors so 'ruff check .' exits 0 2026-08-13 00:34:04 -07:00

MSP C2 - Ticketing and Billing System MVP

An end-to-end solution for managing tickets, time tracking, inventory, invoicing, and user management.

Features

  • Ticket Management: Create, assign, and track tickets through resolution
  • Time Tracking: Log time spent on tickets with detailed notes
  • Inventory Management: Track parts, licenses, and services with stock levels
  • Invoicing: Generate invoices from tickets with time and parts usage
  • User Management: Admin-only user creation, modification, and role assignment
  • Dashboard: Overview with key metrics (open tickets, overdue SLA, unpaid invoices)
  • RBAC System: Role-based access control (admin, tech, billing, read_only)
  • Audit Logging: Track all changes made to entities
  • Webhook Integration: Send automation events on entity changes

Prerequisites

  • Docker and Docker Compose
  • Node.js (for development)

Setup Instructions

Quick Start with Docker (Development)

# Copy environment variables
cp .env.example .env

# Start the full stack
docker compose up --build

The application will be available at:

Production Release Deployment

For production or self-contained deployment (no bind mounts):

# Use the release configuration
./scripts/release.sh

This creates a self-contained deployment with:

  • Production-optimized Docker images (multi-stage builds)
  • No bind mounts (all code baked into images)
  • Named volumes for persistent data only
  • Environment-driven configuration

See RELEASE.md for detailed deployment guide.

Development Setup

For development, you can run individual services:

# Terminal 1: Start database
docker compose up db

# Terminal 2: Start backend (from backend directory)
cd backend
pip install -r requirements.txt

# Install dev dependencies for linting, type checking, and testing
pip install -r requirements-dev.txt

# Or install both at once:
pip install -r requirements.txt -r requirements-dev.txt

# Run database migrations (required on first setup and after schema changes)
alembic upgrade head
# Or use the helper script:
# ./scripts/migrate.sh

uvicorn main:app --reload

# Terminal 3: Start frontend (from frontend directory)
cd frontend
npm install
npm run dev

Database Migrations

This project uses Alembic for database migrations. Migrations track schema changes and ensure consistency across environments.

Running Migrations

cd backend

# Apply all pending migrations
alembic upgrade head

# Or use the helper script
./scripts/migrate.sh

# Check migration status
./scripts/migrate.sh status

Creating New Migrations

When you modify SQLAlchemy models, create a migration:

cd backend

# Auto-generate migration from model changes
alembic revision --autogenerate -m "Add phone column to users"

# Or use the helper script
./scripts/migrate.sh create "Add phone column to users"

# Review the generated migration in alembic/versions/
# Then apply it
alembic upgrade head

Migration Commands

# View all commands
./scripts/migrate.sh help

# Common commands
./scripts/migrate.sh upgrade     # Apply migrations (default)
./scripts/migrate.sh downgrade   # Rollback one migration
./scripts/migrate.sh reset       # Reset database (careful!)
./scripts/migrate.sh status      # Check current status

Seeding Demo Data

To create demo data and an initial admin user:

# After starting the services and running migrations
docker compose exec backend python scripts/seed_demo_data.py

Automated Testing

The project includes comprehensive automated testing infrastructure:

Run Tests Locally

# Run all tests
./scripts/run-tests.sh

# Or use Python version (cross-platform)
python scripts/run_tests.py

# Run specific test types
./scripts/run-tests.sh backend        # Backend tests only
./scripts/run-tests.sh frontend       # Frontend tests only
./scripts/run-tests.sh integration    # Integration tests
./scripts/run-tests.sh security       # Security tests
./scripts/run-tests.sh performance    # Performance tests

Run Tests in Docker

# Full test suite in isolated environment
docker compose -f docker-compose.test.yml up --abort-on-container-exit

# View test reports
docker compose -f docker-compose.test.yml --profile reports up
# Open http://localhost:8080

Test Coverage

  • Backend: 135+ tests with coverage reporting
  • Frontend: Full test suite with coverage
  • Integration: End-to-end workflow tests
  • Security: Automated security scanning
  • Performance: Load and benchmark tests

View detailed testing documentation: docs/AUTOMATED_TESTING.md

CI/CD Pipeline

This project uses Forgejo (self-hosted Git service) for CI/CD:

Workflows

Workflow File Trigger Purpose
Full CI .forgejo/workflows/ci.yml Push, PR Lint, test, security scan, build
Quick Test .forgejo/workflows/quick-test.yml Push, PR Fast test validation

Pipeline Stages

  1. Lint & Format - Black, flake8, ESLint
  2. Test - Backend pytest, frontend tests
  3. Security - Bandit security scan
  4. Build - Docker image build
  5. Deploy - Production deployment (manual)

Local Linting

Run the same checks locally before pushing:

# Backend linting
cd backend
black --check .
flake8 . --exclude=alembic,tests

# Frontend linting
cd frontend
npm run lint

CI Status

Check pipeline status in your Forgejo instance under Actions.

Default Demo Credentials

Email: admin@example.com Password: admin123

MVP Walkthrough Steps

Basic Workflow

  1. Login: Access the system with demo credentials
  2. Dashboard: View key metrics and recent activity
  3. Create Customer: Add a new customer organization
  4. Create Contacts: Add contacts for the customer
  5. Add Inventory: Add parts, licenses, or services to inventory
  6. Create Ticket: Open a new ticket for a customer
  7. Log Time & Parts: Add time entries and part usage to the ticket
  8. Generate Invoice: Create an invoice from the ticket
  9. Mark Paid: Update invoice status to paid

Admin Workflow

  1. Access Dashboard: View system-wide metrics at a glance
  2. Manage Users: Create, edit, and delete users (Admin only)
    • Navigate to Users page from sidebar
    • Create new users with appropriate roles
    • Reset passwords when needed
  3. Logout: Securely log out when finished

API Overview

The backend provides a REST API with the following endpoints:

Core Endpoints (Implemented)

  • /api/v1/auth/ - Authentication routes (login, logout, me)
  • /api/v1/users/ - User management (admin-only CRUD operations)
  • /api/v1/customers/ - Customer organizations and contacts
  • /api/v1/catalog/ - Inventory and stock management
  • /api/v1/tickets/ - Ticket management
  • /api/v1/invoices/ - Invoice creation and management
  • /api/v1/hooks/ - Webhook configurations and testing
  • /api/v1/dashboard/ - Dashboard statistics and metrics
  • /api/v1/health - Health check

All endpoints respect the role-based access controls configured in the system.

Network Topology Module

The network topology module models customer network infrastructure through three entity types:

NetworkNode — devices or endpoints in the network:

Field Type Description
id int Primary key
customer_id int FK to customer organization
asset_id int? FK to customer asset (optional)
label str Node display name
node_type str? core, distribution, access, endpoint
x_pos, y_pos float? Visualization coordinates

NetworkLink — connections between nodes:

Field Type Description
id int Primary key
source_node_id int FK to source NetworkNode
target_node_id int FK to target NetworkNode
link_type str? ethernet, wifi, fiber, vpn
bandwidth_mbps int? Link bandwidth
vlan_id int? Associated VLAN

Subnet — IP subnets assigned to a customer:

Field Type Description
id int Primary key
customer_id int FK to customer organization
network_address str e.g. 192.168.1.0
cidr int e.g. 24
vlan_id int? Associated VLAN
description str? Human-readable description
notes text? Free-form notes

CRUD Operations (backend/crud/network.py):

  • Nodes: get_nodes(customer_id), create_node(db, node), update_node(db, node_id, node), delete_node(db, node_id)
  • Links: get_links(db, customer_id), create_link(db, link), delete_link(db, link_id)
  • Subnets: get_subnets(db, customer_id), create_subnet(db, subnet), update_subnet(db, subnet_id, subnet), delete_subnet(db, subnet_id)

API Routers:

  • GET/POST /api/v1/network/{customer_id}/nodes — list / create nodes
  • GET/POST /api/v1/network/{customer_id}/links — list / create links
  • GET/POST /api/v1/subnets/{customer_id} — list / create subnets

All network endpoints require ADMIN, TECH, or READ_ONLY roles for reads, and ADMIN or TECH for writes.

Docs

API & Architecture

  • docs/api_contract.md - Canonical API contract
  • docs/api_overview.md - Detailed API endpoints documentation
  • docs/api_quick_reference.md - Quick API reference guide
  • docs/architecture.md - System architecture overview
  • docs/data_model.md - Database schema documentation

Operations

  • docs/DEPLOYMENT.md - Production deployment guide
  • docs/DATABASE_MIGRATIONS.md - Alembic migration guide
  • docs/OPERATIONS_RUNBOOK.md - Operations procedures
  • docs/OBSERVABILITY.md - Monitoring and logging
  • docs/DISASTER_RECOVERY.md - Disaster recovery procedures
  • docs/backup_restore.md - Backup/restore drill

Development

  • docs/IMPLEMENTATION_STATUS.md - Feature implementation status
  • docs/AUTOMATED_TESTING.md - Testing documentation
  • docs/error_handling.md - Error envelope + middleware behavior
  • docs/performance.md - Baseline performance measurements
  • ROADMAP.md - Product roadmap and future plans
  • CONTRIBUTING.md - Contribution guidelines
  • CHANGELOG.md - Version history

Archived

  • docs/archive/ - Historical documentation snapshots

For AI Assistants

  • AGENT_QUICKSTART.md - Quick reference guide for agentic assistants working on this project

Project Structure

/
├── docker-compose.yml        # Container orchestration
├── .env.example             # Environment variables template
├── README.md               # This file
├── test_harness.py         # Comprehensive test suite runner
├── validate_mvp.py         # MVP validation script
├── TEST_HARNESS_*.md       # Test documentation
├── backend/                # FastAPI backend application
│   ├── main.py             # Application entry point
│   ├── models/             # SQLAlchemy models
│   ├── schemas/            # Pydantic schemas
│   ├── api/                # API routes
│   ├── crud/               # Database CRUD operations
│   ├── services/           # Business logic services
│   ├── core/               # Core utilities (config, database)
│   ├── utils/              # Helper utilities
│   ├── tests/              # Test suite (17 test files)
│   └── requirements.txt    # Python dependencies
├── frontend/               # React frontend application
│   ├── src/                # Source code
│   │   ├── pages/          # Page components
│   │   ├── components/     # Reusable components
│   │   ├── hooks/          # Custom React hooks
│   │   └── services/       # API service layer
│   ├── package.json        # Node dependencies
│   └── vite.config.js      # Vite configuration
└── docs/                   # Documentation
    ├── architecture.md     # System architecture overview
    ├── data_model.md       # Database schema documentation
    ├── api_overview.md     # API endpoints documentation
    ├── api_contract.md     # API contract specification
    ├── error_handling.md   # Error handling documentation
    ├── monitoring.md       # Health checks and monitoring
    ├── performance.md      # Performance baseline
    └── threat_notes.md     # Security considerations