From 2981be12df876620803cc3623f07369011748908 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 22 Jul 2025 08:22:31 +0200 Subject: [PATCH] add claude code doc file --- CLAUDE.md | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..d4f6ad4 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,108 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +This is a Django website for servala.com, built with Python 3.13+ using uv for dependency management. The project structure follows Django conventions with a main `hub` application containing multiple services. + +## Development Commands + +### Local Development Setup +```bash +cp .env.example .env +source .env +uv run --extra dev manage.py migrate +uv run --extra dev manage.py runserver +``` + +### Database Operations +```bash +uv run --extra dev manage.py migrate +uv run --extra dev manage.py makemigrations +uv run --extra dev manage.py createsuperuser +``` + +### Testing +```bash +# Run all tests +uv run --extra dev manage.py test + +# Run specific pricing tests (comprehensive suite available) +./run_pricing_tests.sh + +# Run specific test modules +uv run --extra dev manage.py test hub.services.tests.test_pricing --verbosity=2 +uv run --extra dev manage.py test hub.services.tests.test_pricing_edge_cases --verbosity=2 +uv run --extra dev manage.py test hub.services.tests.test_pricing_integration --verbosity=2 +``` + +### Asset Management +```bash +uv run --extra dev manage.py build_assets +uv run --extra dev manage.py collectstatic +``` + +## Architecture Overview + +### Core Django App Structure +- `hub/` - Main Django application + - `services/` - Core business logic with multiple domains: + - `models/` - Database models organized by domain (articles, pricing, providers, services, etc.) + - `views/` - View logic organized by feature + - `forms/` - Form classes for user input + - `admin/` - Django admin customizations + - `tests/` - Comprehensive test suite, especially for pricing logic + - `broker/` - Separate app for broker-related functionality + - `middleware.py` - Custom middleware + - `settings.py` - Django configuration using environs for environment variables + +### Key Features +- **Pricing Engine**: Complex pricing calculations with multiple models (ComputePlan, StoragePlan, etc.) +- **Content Management**: Articles, services, providers with image library support +- **Lead Generation**: Contact forms and lead management +- **Partner System**: Cloud providers and consulting partners +- **Price Calculator**: Interactive frontend calculator with ROI calculations + +### Frontend Assets +- Static files in `hub/services/static/` +- JavaScript organized by feature (price-calculator/, roi-calculator.js) +- CSS using Bootstrap 5 with custom styling +- Chart.js for data visualization + +### Database +- Uses Django ORM with extensive migrations in `hub/services/migrations/` +- SQLite for development and production (`db.sqlite3`) +- Media files stored in `media/` with organized subdirectories + +### Deployment +- Docker specific code is in the folder docker/ +- Kubernetes deployment specific files in deployment/ +- GitLab CI is used as the main CI/CD system +- Forgejo Actions is the secondary CI/CD system + +## Development Notes + +### Environment Configuration +- Uses `environs` library for environment variable management +- Requires `.env` file for local development (copy from `.env.example`) +- Key settings: `SECRET_KEY`, `DEBUG`, `ALLOWED_HOSTS` + +### Testing Strategy +- Extensive pricing test suite with edge cases and integration tests +- Use `--keepdb` flag for faster test runs during development +- Dedicated test runner script for pricing functionality + +### Asset Pipeline +- Django Compressor for CSS/JS optimization +- Static files collection required for production +- Custom management commands for asset building + +### Image Management +- Comprehensive image library system with SVG support +- Organized media directories for different content types +- Custom template tags for image handling + +### Django specifics +- Use function-based views and follow the Django conventions for naming and structuring views +- Templates use the Django template language