A backend system for managing test documentation, including test plans, test cases, coverage, defect tracking, and report generation. Designed to support QA engineers and software teams in maintaining structured and efficient testing workflows.
- 📋 Manage Test Plans & Test Cases – Create, update, and organize testing artifacts.
- 🧩 Track Test Coverage – Keep track of which requirements are covered by test cases.
- 🐞 Record and View Defects – Log, track, and manage software defects efficiently.
- 📤 Export Reports – Generate summary or detailed reports for testing activities.
- 🔐 Basic User Authentication – Secure access with login and user management.
- Framework: FastAPI
- Database: SQLAlchemy + PostgreSQL/MySQL/SQLite (configurable)
- Authentication: JWT tokens
- Testing & Validation: Pydantic schemas
- Logging: Centralized logging with middleware support
git clone https://github.com/pepperthecar/defectly-backend.git
cd defectly-backendmacOS/Linux
python3 -m venv venv
source venv/bin/activateWindows
python -m venv venv
venv\Scripts\activatepip install -r requirements.txtcp .env.example .envEdit the .env file with your database URL and secret key.
alembic upgrade headuvicorn app.main:app --reloadAPI: http://127.0.0.1:8000
Swagger UI: http://127.0.0.1:8000/docs
app/
├─ api/v1/ # Route definitions
├─ core/ # Config & security utilities
├─ crud/ # Database operations
├─ db/ # Database configuration
├─ models/ # Database models
├─ schemas/ # Pydantic validation schemas
├─ services/ # Business logic
├─ middleware/ # Logging, timing, and error handler middleware
├─ utils/ # Logger, helpers
└─ main.py # Application entry point
migration/ # Alembic migration scripts
tests/ # Unit and integration tests
- LoggingMiddleware: Logs each request with method, path, IP, and processing time.
- TimingMiddleware: Adds
X-Process-Timeheader for each request. - ErrorHandlerMiddleware: Catches unhandled exceptions and returns standardized JSON error responses.
- User-specific logging: Use
log_user_action(user_email, request_path)to log authenticated user actions.
- JWT-based authentication is implemented.
- Use
get_current_userdependency in routes to access the authenticated user. - Only authenticated and active users can access protected endpoints.
Get current user info
@router.get("/me", response_model=UserResponse)
def read_users_me(current_user: User = Depends(get_current_user)):
log_user_action(current_user.email, "/me")
return current_userCreate a new test plan
@router.post("/plans")
def create_plan(plan: PlanCreate, current_user: User = Depends(get_current_user)):
return plan_service.create_plan(plan, current_user)Run tests with:
pytest tests/Includes unit tests for CRUD, services, and routes.
All logs are written to:
logs/app.log
Middleware automatically logs requests, errors, and timing.
Fork the repository. Create a feature branch:
git checkout -b feature/your-feature-nameMake changes, commit, and push:
git push origin feature/your-feature-name
Open a pull request.
MIT License © 2025