Skip to content

Refactor: Consolidate documentation into README and enhance production setup#1

Merged
ak4code merged 2 commits into
mainfrom
claude/nifty-euler-my09oj
Jun 12, 2026
Merged

Refactor: Consolidate documentation into README and enhance production setup#1
ak4code merged 2 commits into
mainfrom
claude/nifty-euler-my09oj

Conversation

@ak4code

@ak4code ak4code commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

This PR consolidates scattered styleguide documentation into a comprehensive README, enhances production-readiness with proper security settings and health checks, and improves the overall developer experience with better tooling integration.

Key Changes

Documentation & README

  • Removed separate styleguide files (services_and_selectors.md, api_view.md, docstring.md) that were fragmented and hard to maintain
  • Rewrote README.md as a comprehensive project guide with:
    • Visual header with badges (Python, Django, DRF, PostgreSQL, Redis, Docker, uv)
    • Feature matrix highlighting key capabilities
    • Quick start instructions (Docker and local setup)
    • API versioning explanation with examples
    • Architecture diagram (mermaid flowchart)
    • Project structure overview
    • Development workflow guide

Production & Security

  • Added core/health.py with /health/ endpoint that checks database and Redis connectivity (returns 503 if unhealthy) — ready for Kubernetes probes
  • Enhanced config/settings/prod.py with:
    • HSTS headers (30 days by default)
    • Secure cookies (HTTPS-only, HttpOnly)
    • SSL redirect behind proxy
    • Content security headers (X-Frame-Options, REFERRER-POLICY, etc.)
    • Manifest static files storage with WhiteNoise
  • Updated config/settings/base.py:
    • Made .env optional (graceful fallback if missing)
    • Added CSRF_TRUSTED_ORIGINS support
    • Integrated drf-spectacular for OpenAPI/Swagger
    • Configured AcceptHeaderVersioning (version in Accept header, not URL)
    • Added django-filters and pagination defaults
    • Added WhiteNoise middleware for static file serving
    • Connection pooling and health checks for PostgreSQL

API & Versioning

  • Implemented AcceptHeaderVersioning — clients specify version via Accept: application/json; version=v1 header instead of URL paths
  • Updated test URLs from /api/v1/users/... to /api/users/... (version now in header)
  • Added test case for version header validation and unsupported version handling
  • Enhanced views with @extend_schema decorators for OpenAPI documentation

Docker & Deployment

  • Added PostgreSQL service to docker-compose.yml with health checks and persistent volumes
  • Updated entrypoint.sh to wait for both PostgreSQL and Redis before migrations
  • Improved Dockerfile Python version handling (simplified to 3.13 without patch version)
  • Enhanced Makefile with comprehensive targets: install, migrate, test, lint, format, up, down, logs

CI/CD

  • Added .github/workflows/ci.yml with:
    • Ruff linting and formatting checks
    • Bandit security scanning
    • Pytest test suite execution

Dependencies

  • Updated core packages: Django 6.0.6, DRF 3.17.1, Redis 8.0.0
  • Added production essentials: gunicorn, psycopg[binary,pool], whitenoise, drf-spectacular
  • Updated dev tools: ruff 0.15.17, bandit 1.9.4, pytest-django 4.12.0, added pytest-env

Code Quality

  • Fixed formatting issues across test files (quote consistency, blank lines)
  • Improved migration formatting for readability
  • Added docstrings to admin and app config classes
  • Cleaned up unused imports and reorganized imports per ruff standards

Notable Implementation Details

  1. API Versioning: The AcceptHeaderVersioning approach keeps URLs clean and stable while allowing multiple API versions to coexist. Default version is v1; unsupported versions return 406.

  2. Health Check: The /health/ endpoint is non-authenticated and checks both database and

claude added 2 commits June 12, 2026 08:59
…ioning

- Update all dependencies to latest (Django 6.0.6, DRF 3.17.1, redis 8,
  ruff 0.15, pytest 9.0.3, etc.) and regenerate uv.lock
- Add production packages: gunicorn, psycopg, whitenoise, drf-spectacular
- Switch API versioning to AcceptHeaderVersioning: version is passed via
  Accept header (application/json; version=v1), URLs drop the /v1/ prefix
- Add OpenAPI schema, Swagger UI and ReDoc endpoints (drf-spectacular)
- Add /health/ endpoint checking database and Redis
- Fill in dev/prod settings: security hardening (HSTS, secure cookies,
  SSL redirect), whitenoise static storage, Redis cache, logging,
  DATABASE_URL-based config, DRF pagination/throttling/permissions
- Fix entrypoint.sh: config.wsgi instead of core.wsgi, drop unused
  gevent/celery commands, wait for PostgreSQL
- Add PostgreSQL service to docker-compose with healthcheck and wiring
- Add GitHub Actions CI (lint + tests), expand Makefile targets
- Add header-versioning tests, fix all ruff/bandit findings
- Rewrite README with quickstart, versioning guide and configuration docs

https://claude.ai/code/session_01YZr4TbzTw6EkkFqZz2onTF
- Merge commons/ and externals/ into a single core/ package
  (mixins, redis client, integrations) per HackSoft/cookiecutter-django
  conventions: apps/ = business logic, core/ = reusable infra,
  config/ = configuration only
- Move health-check view from config/views.py to core/health.py
- Remove docs/ directory
- Rewrite README: animated header/footer (capsule-render), typing SVG,
  shields.io badges, emoji sections, mermaid architecture diagram,
  collapsible configuration sections

https://claude.ai/code/session_01YZr4TbzTw6EkkFqZz2onTF
@ak4code ak4code merged commit a467d27 into main Jun 12, 2026
2 checks passed
@ak4code ak4code deleted the claude/nifty-euler-my09oj branch June 12, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants