Skip to content

Commit 6d60a0f

Browse files
authored
Merge pull request #600 from mj24-blip/Add-a-CONTRIBUTING-section-specific-to-the-analytics-module
docs: add contributing guidelines for analytics module and create REA…
2 parents cb0a44f + 2750ada commit 6d60a0f

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

backend/contributing.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,25 @@ http://localhost:3000/api
6464
3. Commit your changes (`git commit -m 'Add feature X'`)
6565
4. Push to the branch (`git push origin feature-name`)
6666
5. Open a Pull Request
67+
68+
---
69+
70+
## 📈 Analytics Module Contributions
71+
When working on the analytics module, keep all new code inside `backend/src/analytics/` and follow the existing module/controller/service/provider pattern used by modules such as `progress`, `streak`, and `quests`.
72+
73+
### Checklist for a new metric provider
74+
1. **Add an entity if the metric needs persistence**
75+
- Place new database entities under `backend/src/analytics/entities/`.
76+
- Keep the model aligned with the current analytics schema and naming conventions.
77+
2. **Add a provider**
78+
- Implement the provider under `backend/src/analytics/providers/`.
79+
- Register it in the analytics module so it is available to the service layer.
80+
3. **Add an endpoint**
81+
- Expose the metric through the analytics controller under `backend/src/analytics/controllers/`.
82+
- Use the existing DTOs and validation patterns so the request contract stays consistent.
83+
4. **Add tests before opening a PR**
84+
- Include unit tests for the provider/service logic.
85+
- Add endpoint or integration coverage when the change affects API behavior.
86+
- For event-based or listener-driven work, cover the related listener or job behavior as well.
87+
88+
Before a PR is merged, contributors should confirm that the change is documented in [backend/src/analytics/README.md](src/analytics/README.md) and that any new event names or payloads follow the taxonomy defined in [backend/src/analytics/EVENT_TAXONOMY.md](src/analytics/EVENT_TAXONOMY.md).

backend/src/analytics/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Analytics Module
2+
3+
This module contains the analytics entities, providers, controllers, jobs, and listeners used to track player and game activity.
4+
5+
## Reference docs
6+
- [EVENT_TAXONOMY.md](./EVENT_TAXONOMY.md)
7+
- [DATA_DICTIONARY.md](./DATA_DICTIONARY.md)

0 commit comments

Comments
 (0)