Add initial ThrillWiki context configuration with project overview, technology stack, domain architecture, and development standards

This commit is contained in:
pacnpal
2025-09-23 19:40:16 -04:00
parent 33f5486000
commit fd42ee1161

View File

@@ -0,0 +1,212 @@
<thrillwiki_context>
<!-- Core Project Information -->
<project_overview>
<name>ThrillWiki</name>
<description>Comprehensive theme park database platform with user-generated content, expert moderation, and rich media support</description>
<framework>Django REST Framework</framework>
<api_endpoints>120+</api_endpoints>
<primary_entities>
<entity>Parks</entity>
<entity>Rides</entity>
<entity>Companies</entity>
<entity>Users</entity>
</primary_entities>
</project_overview>
<!-- Technology Stack -->
<tech_stack>
<backend>
<framework>Django 5.0+</framework>
<api>Django REST Framework</api>
<database>PostgreSQL with PostGIS</database>
<caching>Redis</caching>
<task_queue>Celery</task_queue>
</backend>
<frontend>
<constraint>NO React/Vue/Angular allowed</constraint>
<technologies>
<tech name="HTMX" purpose="Dynamic updates"/>
<tech name="AlpineJS" purpose="Client-side state management"/>
<tech name="Tailwind CSS" purpose="Styling"/>
<tech name="Django-Cotton" purpose="Component system"/>
</technologies>
</frontend>
<media>
<service>Cloudflare Images</service>
<method>Direct Upload with variants and transformations</method>
</media>
<tracking>
<system>pghistory for all model changes</system>
<base_class>TrackedModel</base_class>
</tracking>
</tech_stack>
<!-- Domain Architecture -->
<domain_structure>
<domain name="parks">
<path>parks/</path>
<companies>
<allowed_roles>
<role>OPERATOR</role>
<role>PROPERTY_OWNER</role>
</allowed_roles>
</companies>
</domain>
<domain name="rides">
<path>rides/</path>
<companies>
<allowed_roles>
<role>MANUFACTURER</role>
<role>DESIGNER</role>
</allowed_roles>
</companies>
</domain>
<core_apps>
<app>accounts/</app>
<app>media/</app>
<app>moderation/</app>
<app>core/</app>
</core_apps>
<critical_rules>
<rule>NEVER mix park/ride company roles - fundamental business rule</rule>
</critical_rules>
</domain_structure>
<!-- Development Patterns -->
<development_patterns>
<models>
<base_class>TrackedModel (all models inherit)</base_class>
<slug_handling>SluggedModel for slugs with history</slug_handling>
</models>
<api_design>
<url_structure>Nested URLs (/parks/{slug}/rides/{slug}/)</url_structure>
<trailing_slash>Mandatory trailing slashes</trailing_slash>
</api_design>
<choices>
<system>RichChoiceField with metadata</system>
<metadata>color, icon, description, css_class</metadata>
<forbidden>NEVER use Django tuple choices</forbidden>
</choices>
<media_handling>
<field_type>CloudflareImagesField</field_type>
<features>photo types and attribution</features>
</media_handling>
<location>
<system>PostGIS for geographic data</system>
<structure>separate location models</structure>
</location>
</development_patterns>
<!-- Development Commands -->
<commands>
<server>
<command>uv run manage.py runserver_plus</command>
<forbidden>python manage.py</forbidden>
</server>
<migrations>
<make>uv run manage.py makemigrations</make>
<apply>uv run manage.py migrate</apply>
</migrations>
<packages>
<install>uv add &lt;package&gt;</install>
<forbidden>pip install</forbidden>
</packages>
<management>
<pattern>Always use `uv run manage.py &lt;command&gt;`</pattern>
</management>
</commands>
<!-- API Rules and Standards -->
<api_standards>
<authentication>
<type>Token-based</type>
<role_hierarchy>
<role level="1">USER</role>
<role level="2">MODERATOR</role>
<role level="3">ADMIN</role>
<role level="4">SUPERUSER</role>
</role_hierarchy>
</authentication>
<filtering>
<rides>25+ parameters</rides>
<parks>15+ parameters</parks>
</filtering>
<responses>
<pagination>Standard DRF pagination</pagination>
<errors>Rich error responses with details</errors>
</responses>
<caching>
<levels>Multi-level (Redis, CDN, browser)</levels>
<invalidation>Signal-based invalidation</invalidation>
</caching>
<data_policy>
<rule>NEVER MOCK DATA - All responses must use real database queries</rule>
</data_policy>
</api_standards>
<!-- Rich Choice Objects System (MANDATORY) -->
<rich_choices>
<implementation>
<field_usage>RichChoiceField(choice_group="group_name", domain="domain_name")</field_usage>
<definition_location>domain-specific choices.py using RichChoice dataclass</definition_location>
<registration>register_choices() function in domain __init__.py</registration>
</implementation>
<required_metadata>
<metadata>color</metadata>
<metadata>icon</metadata>
<metadata>description</metadata>
<metadata>css_class</metadata>
</required_metadata>
<forbidden>
<rule>NO tuple-based choices allowed anywhere in codebase</rule>
</forbidden>
</rich_choices>
<!-- Frontend Constraints -->
<frontend_constraints>
<architecture>
<htmx>Dynamic updates</htmx>
<alpinejs>Client state management</alpinejs>
<tailwind>Styling framework</tailwind>
</architecture>
<approach>Progressive enhancement required</approach>
<browser_support>Latest 2 versions of major browsers</browser_support>
<performance_targets>
<fcp>First Contentful Paint &lt; 1.5s</fcp>
<tti>Time to Interactive &lt; 2s</tti>
<compliance>Core Web Vitals compliance</compliance>
</performance_targets>
</frontend_constraints>
<!-- Code Quality Standards -->
<code_standards>
<model_inheritance>All models must inherit from TrackedModel</model_inheritance>
<slug_management>Use SluggedModel for entities with slugs and history tracking</slug_management>
<choice_fields>Always use RichChoiceField instead of Django choices</choice_fields>
<api_urls>Must include trailing slashes and follow nested pattern</api_urls>
<media_fields>Use CloudflareImagesField for all image handling</media_fields>
<geographic_data>Use PostGIS fields and separate location models</geographic_data>
</code_standards>
<!-- Business Rules -->
<business_rules>
<company_roles>
<rule>Parks domain: Only OPERATOR and PROPERTY_OWNER roles</rule>
<rule>Rides domain: Only MANUFACTURER and DESIGNER roles</rule>
<rule>CRITICAL: Never allow cross-domain company roles</rule>
</company_roles>
<data_integrity>
<rule>All model changes must be tracked via pghistory</rule>
<rule>All API responses must use real database data</rule>
<rule>Geographic data must use PostGIS for accuracy</rule>
</data_integrity>
</business_rules>
<!-- Development Workflow -->
<workflow>
<package_management>Use uv for all Python package operations</package_management>
<server_management>Use runserver_plus for enhanced development server</server_management>
<database_management>Always use uv run for Django management commands</database_management>
<testing>All functionality must work with progressive enhancement</testing>
</workflow>
</thrillwiki_context>