Skip to content

Commit 99d80c8

Browse files
Merge branch 'dev' into test/import-sessions-speakers-v2
2 parents 7cc7a9d + cfd8c71 commit 99d80c8

File tree

134 files changed

+208790
-167835
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+208790
-167835
lines changed

.agents/context/architecture.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Django Backend Architecture Context
2+
3+
## Core Structure & Philosophy
4+
5+
The Django project lives entirely under `app/`. The project has evolved from a legacy structure to the unified `eventyay` (ENext) application.
6+
7+
- The primary package is `eventyay` (`DJANGO_SETTINGS_MODULE` points here).
8+
- You will see legacy directories (like `src/`, `talk/`, `video/`) in older branches, but they are historical. All active product code lives strictly inside `app/eventyay/`.
9+
10+
## Directory Map (`app/eventyay/`)
11+
12+
```text
13+
app/
14+
├── eventyay/ # Main unifying package
15+
│ ├── config/ # System configuration and settings.py files
16+
│ ├── api/ # DRF viewsets, serializers, routers
17+
│ ├── base/ # Core shared models, managers, forms, and middleware
18+
│ ├── control/ # Organiser back-office (management UI, forms, urls)
19+
│ ├── presale/ # Attendee-facing (ticket purchase, public pages, urls)
20+
│ ├── eventyay_common/ # Modern shared UI components and base templates
21+
│ ├── webapp/ # Modern Vue 3 bundled front-end applications
22+
│ ├── static/ # Legacy/Django-served static assets (CSS, images)
23+
│ ├── celery.py # Celery task application configuration
24+
│ └── plugins/ # Extendible plugin architecture definitions
25+
├── tests/ # Pytest testing suite
26+
└── manage.py
27+
```
28+
29+
> **Crucial Rule on Sub-apps:** Models and forms are distributed *inside* their respective domain sub-apps to guarantee domain-driven design separation.
30+
> - Examples: `base/models/`, `control/forms/`, `presale/forms/`
31+
> - **Do NOT** place models or forms directly in a new root-level standalone directory.
32+
> - By standard convention, most system models inherit from a core database class located within `app/eventyay/base/`.
33+
34+
## System Settings Layer
35+
36+
Configuration is strictly divided between base settings and environment-specific overrides:
37+
38+
- **Base defaults:** Handled dynamically via `app/eventyay/config/settings.py` (review the `BaseSettings` setup class).
39+
- **Environment Overrides:** Configuration is TOML-based (`eventyay.development.toml`, `eventyay.production.toml`) plus an optional `eventyay.local.toml` for strict local machine overrides.
40+
- **Execution Context:** The active mode executes according to the `EVY_RUNNING_ENVIRONMENT` OS environment variable which defaults depending on context (`development`, `production`, etc.).
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: django-add-form
3+
description: Steps for creating or modifying Django forms and adding validation
4+
---
5+
6+
## When to use
7+
8+
Use this skill when building or editing forms handling user input for views like back-office organizers (`control/`) or attendee-facing routes (`presale/`).
9+
10+
## Steps
11+
12+
1. Place the new form class strictly alongside its relevant sub-app (e.g., `app/eventyay/base/forms/`, `app/eventyay/control/forms/`).
13+
2. Add specific, individual field-level validation by implementing `clean_<field>()` methods.
14+
3. Add multi-field or cross-field validation logic by implementing generic `clean()` method overrides.
15+
16+
## Validation
17+
18+
1. Confirm the form has definitively been organized within its intended domain scope (e.g. keeping control constraints strictly out of presale domains).
19+
20+
## Gotchas
21+
22+
- Do not bypass Django's built-in validation mechanisms logic when working with forms.
23+
- Do not mix `control/forms/` configurations into `presale/` logic.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: django-create-api-endpoint
3+
description: Steps for adding a new Django REST Framework API endpoint
4+
---
5+
6+
## When to use
7+
8+
Use this skill when exposing new data or functionality via the DRF API using viewsets and serializers.
9+
10+
## Steps
11+
12+
1. Create or update a serializer in the appropriate location within `app/eventyay/api/`. Prefer using explicit serializer fields covering direct model or nested relation mappings.
13+
2. Create or update a viewset within `app/eventyay/api/`.
14+
3. Register the new viewset's router in the appropriate module router or `app/eventyay/api/urls.py`.
15+
16+
## Validation
17+
18+
1. Verify that the serializer correctly maps exactly to the expected model or relations without unnecessary custom method wrappers.
19+
2. Assert the endpoint resolves effectively.
20+
21+
## Gotchas
22+
23+
- **Computed Data Overuse:** Only use `SerializerMethodField` for genuinely computed or conditional data. Do NOT use it if a direct field assignment natively exists.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: django-create-model
3+
description: Steps for creating or modifying a Django model
4+
---
5+
6+
## When to use
7+
8+
Use this skill when defining a new database model or modifying an existing one.
9+
10+
## Steps
11+
12+
1. Locate the correct sub-app for the model (e.g., `app/eventyay/base/models/` for shared models or a specific sub-app's `models.py`).
13+
2. Define the model class. Ensure it inherits from a base class located in `app/eventyay/base/` if applicable.
14+
3. Define the related model managers.
15+
16+
## Validation
17+
18+
1. Verify the model file is placed correctly inside the sub-app's directory hierarchy.
19+
2. Confirm the model isn't mistakenly placed in a standalone top-level directory.
20+
21+
## Gotchas
22+
23+
- Cross-check standard rules (`agents.md`) when writing model queries, especially regarding event multi-tenancy (`django_scopes.scope(event=event)`).
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: django-run-locally
3+
description: Steps for initiating the Django development server without Docker
4+
---
5+
6+
## When to use
7+
8+
Use this skill to spin up or invoke the local development backend sequence for rapid testing processes.
9+
10+
## Steps
11+
12+
1. Navigate securely into the active architecture directory: `cd app`
13+
2. Synchronously install or update environment dependencies strictly through `uv`: `uv sync --all-extras --all-groups`
14+
3. Activate the standard CLI venv wrapper: `. .venv/bin/activate`
15+
4. Deploy local DB schema synchronization calls: `python manage.py migrate`
16+
5. *(Optional)* Setup initial admin: `python manage.py create_admin_user`
17+
6. Build Frontend Assets:
18+
```bash
19+
make npminstall
20+
python manage.py collectstatic --noinput
21+
python manage.py compress --force
22+
```
23+
7. Initialize the development environment natively: `python manage.py runserver`
24+
25+
## Validation
26+
27+
1. Verify server startup output bindings properly format against standard generic ports (ex. `127.0.0.1:8000`).
28+
2. There should be **no pending/unapplied migration warnings** displayed.
29+
3. Verify `http://127.0.0.1:8000` loads properly without missing CSS/MIME type errors.
30+
31+
## Gotchas
32+
33+
- **Strict Environment Imports**: If context dynamically requires variable settings locally, ALWAYS safely fetch these utilizing `from django.conf import settings`. Never import the isolated system settings configuration natively (e.g. absolutely never execute `from eventyay.config import settings`).
34+
- **CSS not loading / MIME type errors**: Ensure you have successfully run `collectstatic` and `compress --force` steps to properly build the Javascript/CSS chunks.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: django-run-migrations
3+
description: Steps for generating and applying Django migrations
4+
---
5+
6+
## When to use
7+
8+
Use this skill continuously after modifying any `models.py` schema logic to apply the changes to the database.
9+
10+
## Steps
11+
12+
1. Navigate to the app context: `cd app/`
13+
2. Generate the required migration definitions by running: `python manage.py makemigrations`
14+
3. Execute and apply the generated migration file to the DB safely: `python manage.py migrate`
15+
16+
## Validation
17+
18+
1. Verify that the terminal explicitly outputs "Applying..." states and succeeds without tracebacks.
19+
2. Quickly review the auto-generated `.py` migration output to ensure logical alignment with your model edits.
20+
21+
## Gotchas
22+
23+
- **Do not manually edit auto-generated migration files** unless executing an explicitly necessary, advanced requirement (i.e. complex data backfill operations). Never rewrite migrations that have already been applied to a shared or production database; instead, create a new migration for any additional schema changes.
24+
25+
## Tips
26+
If your changes in Django models don't cause a change in the actual database schema, you don't need to create a migration at all.
27+
28+
Typical changes that do **not** affect the DB schema include:
29+
- `choices`
30+
- `verbose_name`
31+
- `help_text`
32+
33+
In these cases:
34+
- Do not run `makemigrations` just to capture these metadata-only changes.
35+
- Do not edit existing migration files that may already have been applied. The only safe exception is in a narrowly scoped, pre-merge situation where a migration has never been applied to any shared or production database and you are cleaning up that pending migration before it lands. Otherwise, always create a new migration to capture real schema changes.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
name: docker-deployment
3+
description: Docker Compose, container services, deployment
4+
---
5+
6+
# Skill: Docker Deployment
7+
8+
## Key Files
9+
10+
| File | Purpose |
11+
|---|---|
12+
| `docker-compose.yml` | Development / local Compose stack |
13+
| `deployment/docker-compose.yml` | Production Compose stack |
14+
| `deployment/env.sample` | Sample production environment variables |
15+
| `deployment/env.dev.sample` | Sample development environment variables |
16+
| `deployment/nginx/` | Nginx reverse-proxy configuration |
17+
| `DEPLOYMENT.md` | Step-by-step production deployment guide |
18+
19+
## Services (Development Stack)
20+
21+
| Service | Image / Build | Role |
22+
|---|---|---|
23+
| `web` | `./app` (Dockerfile) | Django dev server on port 8000 |
24+
| `worker` | `./app` (Dockerfile) | Celery task worker |
25+
| `redis` | `redis:latest` | Message broker and cache |
26+
| `db` | `postgres:15` | PostgreSQL database |
27+
28+
## Building and Running (Development)
29+
30+
```bash
31+
# Copy and edit environment variables
32+
cp deployment/env.dev.sample .env.dev
33+
34+
# Build images and start all services
35+
docker compose up --build
36+
37+
# Run with detached containers
38+
docker compose up -d --build
39+
40+
# View logs
41+
docker compose logs -f web
42+
docker compose logs -f worker
43+
44+
# Stop all services
45+
docker compose down
46+
```
47+
48+
## Running a Management Command Inside a Container
49+
50+
```bash
51+
docker compose exec web python manage.py migrate
52+
docker compose exec web python manage.py createsuperuser
53+
```
54+
55+
## Development vs Production
56+
57+
| Aspect | Development (`docker-compose.yml`) | Production (`deployment/docker-compose.yml`) |
58+
|---|---|---|
59+
| Web server | Django `runserver` | Gunicorn behind Nginx |
60+
| Static files | Served by Django | Pre-built and served by Nginx |
61+
| Env file | `.env.dev` | `.env` |
62+
| Hot reload | Yes (volume mount) | No |
63+
64+
## Environment Variables
65+
66+
Required variables are documented in `deployment/env.sample` and `deployment/env.dev.sample`. At minimum, set:
67+
68+
- `EVY_SECRET_KEY`
69+
- individual `EVY_POSTGRES_*` vars
70+
- `EVY_REDIS_URL`
71+
- `EVY_SITE_URL` (production only)
72+
73+
See `DEPLOYMENT.md` for the full production setup walkthrough, including Nginx, SSL (certbot), and backup configuration.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: documentation
3+
description: How to update project documentation
4+
---
5+
6+
# Skill: Documentation
7+
8+
## Documentation Files
9+
10+
| File | Purpose |
11+
|---|---|
12+
| `README.rst` | Project overview and getting-started guide (reStructuredText) |
13+
| `CONTRIBUTING.md` | Contributor guidelines and development setup |
14+
| `DEPLOYMENT.md` | Production deployment walkthrough |
15+
| `.github/instructions/dockerfile.instructions.md` | Docker Compose usage and container reference |
16+
| `doc/` | Extended project documentation |
17+
18+
## How to Update `README.rst`
19+
20+
- Written in **reStructuredText** (`.rst`).
21+
- Keep the getting-started steps current when CLI commands or workflows change.
22+
- Maintain existing section structure; add new sections at a logical location.
23+
24+
## How to Update `doc/`
25+
26+
- Files may be `.rst` or `.md` depending on the sub-section.
27+
- Follow the existing style of the surrounding files.
28+
- Run a documentation build locally if a build pipeline is configured.
29+
30+
## How to Update `CONTRIBUTING.md`
31+
32+
- Keep the setup instructions in sync with `README.rst`.
33+
- Document any new tooling or workflow changes that affect contributors.
34+
35+
## General Guidelines
36+
37+
- Keep documentation concise and accurate.
38+
- Prefer concrete examples over abstract descriptions.
39+
- When changing a CLI command, update all documentation that references it.
40+
- Documentation changes do not require tests unless there are specific doc-tests.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
name: repo-navigation
3+
description: Repository layout and where to find code
4+
---
5+
6+
# Skill: Repository Navigation
7+
8+
## Top-level Layout
9+
10+
```
11+
.
12+
├── app/ # Main Django application
13+
├── deployment/ # Infrastructure and deployment configs
14+
├── doc/ # Project documentation
15+
├── .github/instructions/ # File-scoped AI coding guidance
16+
├── .agents/skills/ # AI agent skill files (this directory)
17+
├── agents.md # Canonical AI agent policy
18+
├── docker-compose.yml # Docker Compose for local/dev environment
19+
├── DEPLOYMENT.md # Production deployment walkthrough
20+
├── CONTRIBUTING.md # Contributor guidelines
21+
└── README.rst # Project overview
22+
```
23+
24+
## Application Root: `app/`
25+
26+
```
27+
app/
28+
├── eventyay/ # Core Django application package
29+
├── tests/ # Test suite
30+
├── pyproject.toml # Project metadata and dependencies
31+
└── manage.py # Django management entry point
32+
```
33+
34+
## Core Application: `app/eventyay/`
35+
36+
| Directory | Purpose |
37+
|---|---|
38+
| `api/` | REST API endpoints (Django REST Framework) |
39+
| `base/` | Shared models (`base/models/`), utilities, middleware, and forms (`base/forms/`) |
40+
| `control/` | Organiser/back-office views, forms, and URLs |
41+
| `presale/` | Attendee-facing (ticket purchase) views and forms |
42+
| `common/` | Cross-cutting helpers shared across modules |
43+
| `config/` | Application configuration and settings |
44+
| `plugins/` | Plugin infrastructure |
45+
| `static/` | Static assets (CSS, JS, images) |
46+
| `jinja-templates/` | Jinja HTML templates |
47+
| `locale/` | Translation files |
48+
| `mail/` | Email rendering and sending |
49+
| `celery.py` / `celery_app.py` | Celery task configuration |
50+
51+
> **Note:** Models, forms, and templates are distributed inside sub-apps
52+
> (e.g. `base/models/`, `control/forms/`, `presale/templates/`), not in
53+
> standalone top-level directories.
54+
55+
## Deployment: `deployment/`
56+
57+
```
58+
deployment/
59+
├── docker-compose.yml # Production Compose file
60+
├── env.sample # Sample environment variables
61+
├── env.dev.sample # Sample dev environment variables
62+
└── nginx/ # Nginx configuration
63+
```
64+
65+
## Documentation: `doc/`
66+
67+
Contains extended project documentation written in reStructuredText or Markdown.
68+
69+
## Key Lookup Shortcuts
70+
71+
- **Add a model**`app/eventyay/<sub-app>/models.py` or `app/eventyay/base/models/`
72+
- **Add an API endpoint**`app/eventyay/api/`
73+
- **Add a form**`app/eventyay/<sub-app>/forms.py` or `app/eventyay/<sub-app>/forms/`
74+
- **Add a migration** → run `python manage.py makemigrations` from `app/`
75+
- **Add a test**`app/tests/`

0 commit comments

Comments
 (0)