Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@
{
"label": "docker:mongo:start",
"type": "shell",
"command": "docker compose -f ${workspaceFolder}/docker-compose.yml up -d mongo",
"command": "/usr/local/bin/docker compose -f ${workspaceFolder}/docker-compose.yml up -d mongo --build",
"problemMatcher": []
},
{
"label": "docker:mongo:stop",
"type": "shell",
"command": "docker compose -f ${workspaceFolder}/docker-compose.yml stop mongo",
"command": "/usr/local/bin/docker compose -f ${workspaceFolder}/docker-compose.yml stop mongo",
"problemMatcher": []
},
{
Expand Down
21 changes: 21 additions & 0 deletions apps/web/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.py]
indent_size = 4

[*.go]
indent_style = tab

[*.cs]
indent_size = 4

[*.swift]
indent_size = 2
11 changes: 11 additions & 0 deletions apps/web/.github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copilot Instructions — Node/JS

- Follow PROJECT_RULES.md.
- Use JSDoc for all exported/public APIs.
- Validate request payloads and environment variables.
- Use async/await.
- Add/update tests for new logic.
- Do not introduce secrets; use env vars and config schema.

- For database writes, enforce ACID-compliant transactions and avoid partial writes.
- Prefer idempotent write operations when retries are possible.
45 changes: 45 additions & 0 deletions apps/web/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"editor.formatOnSave": true,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit"
},
"[swift]": {
"editor.defaultFormatter": "sswg.swift-lang",
"editor.formatOnSave": true
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"[go]": {
"editor.defaultFormatter": "golang.go",
"editor.formatOnSave": true
},
"go.formatTool": "gofmt",
"go.useLanguageServer": true,
"[csharp]": {
"editor.formatOnSave": true
},
"omnisharp.enableEditorConfigSupport": true,
"eslint.validate": [
"javascript",
"javascriptreact"
]
}
18 changes: 18 additions & 0 deletions apps/web/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# DevRules helper Makefile
# Usage in a repo:
# make devrules
# make devrules-force
#
# If DevRules is located elsewhere, override DEVRULES_DIR:
# make devrules DEVRULES_DIR=~/DevRules

DEVRULES_DIR ?= ~/DevRules

devrules:
node $(DEVRULES_DIR)/tools/apply-rules.mjs --repo .

devrules-force:
node $(DEVRULES_DIR)/tools/apply-rules.mjs --repo . --force

devrules-dry:
node $(DEVRULES_DIR)/tools/apply-rules.mjs --repo . --dry-run
44 changes: 44 additions & 0 deletions apps/web/PROJECT_RULES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Project Rules — Node.js / JavaScript

## Goals
- Production-grade JavaScript, predictable runtime behavior.

## Engineering Best Practices
- **Design:** Apply SOLID where applicable; prefer composition over inheritance; keep responsibilities small.
- **Public API documentation (Tooltip-friendly):** All exported/public APIs MUST include JSDoc (`/** ... */`)
so code completion tooltips clearly explain intent.
- Include: 1-line summary, `@param` descriptions, `@returns` / `@throws`, and important edge cases.
- **Data integrity (ACID / DB writes):** If the project performs database writes,
multi-step writes MUST run inside explicit transactions with commit/rollback semantics.

## See also
- JSDoc templates (TS/JS): ../../shared/doc-templates/jsdoc.md
- ACID violation checklist (DB writes): ../../shared/acid-violation-checklist.md
- Copilot self-correction prompt: ../../shared/copilot-self-correction-prompt.md

## Language & Runtime
- Use JavaScript.
- Prefer a single module system consistently (ESM or CJS; match repo).
- Use Node LTS per repo configuration.

## Style
- Prefer `async/await`.
- Use JSDoc for types and complex shapes when helpful.
- No `console.log` in production paths; use a logger abstraction.

## Structure
- Keep layers separated: routes/controllers, services, repositories, domain, utils.
- Controllers must not contain DB logic; call services.

## Validation & Errors
- Validate external inputs (HTTP, queue, env) with a schema library (zod/yup/etc).
- Centralized error handling; consistent error response shape.
- Do not leak internal stack traces.

## Security
- Never commit secrets.
- Avoid `eval` and shell injection risks; sanitize paths and commands.

## Testing
- Add tests (vitest/jest) for non-trivial logic.
- Mock external integrations (DB/HTTP).
18 changes: 18 additions & 0 deletions apps/web/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# DevRules helper justfile
# Usage in a repo:
# just devrules
# just devrules-force
#
# If DevRules is located elsewhere:
# just devrules DEVRULES_DIR=~/DevRules

DEVRULES_DIR := env_var_or_default("DEVRULES_DIR", "~/DevRules")

devrules:
node {{DEVRULES_DIR}}/tools/apply-rules.mjs --repo .

devrules-force:
node {{DEVRULES_DIR}}/tools/apply-rules.mjs --repo . --force

devrules-dry:
node {{DEVRULES_DIR}}/tools/apply-rules.mjs --repo . --dry-run
7 changes: 5 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"scripts": {
"dev": "webpack serve --env development",
"build": "webpack --env production",
"preview": "npx serve dist"
"preview": "npx serve dist",
"devrules": "node /private/var/folders/jb/5r_f1tv12yg07gd51_7fw53w0000gn/T/devrules-9Kyxxq/DevRules-main/tools/apply-rules.mjs --repo .",
"devrules:force": "node /private/var/folders/jb/5r_f1tv12yg07gd51_7fw53w0000gn/T/devrules-9Kyxxq/DevRules-main/tools/apply-rules.mjs --repo . --force",
"devrules:dry": "node /private/var/folders/jb/5r_f1tv12yg07gd51_7fw53w0000gn/T/devrules-9Kyxxq/DevRules-main/tools/apply-rules.mjs --repo . --dry-run"
},
"dependencies": {
"dotenv": "^17.2.3",
Expand All @@ -24,6 +27,6 @@
"style-loader": "^4.0.0",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
"webpack-dev-server": "^5.2.2"
}
}
21 changes: 21 additions & 0 deletions backend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.py]
indent_size = 4

[*.go]
indent_style = tab

[*.cs]
indent_size = 4

[*.swift]
indent_size = 2
11 changes: 11 additions & 0 deletions backend/.github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copilot Instructions — Python/FastAPI

- Follow PROJECT_RULES.md.
- Use Pydantic models for all request/response bodies.
- Keep routers thin; put logic into services.
- Use Depends() for db/auth/config.
- Add type hints.
- Add pytest tests for new endpoints and service logic.

- Ensure public functions/classes/modules include clear docstrings visible in code completion tooltips.
- For database writes, enforce ACID-friendly transaction boundaries and avoid partial writes.
40 changes: 40 additions & 0 deletions backend/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"editor.formatOnSave": true,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"[swift]": {
"editor.defaultFormatter": "sswg.swift-lang",
"editor.formatOnSave": true
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"[go]": {
"editor.defaultFormatter": "golang.go",
"editor.formatOnSave": true
},
"go.formatTool": "gofmt",
"go.useLanguageServer": true,
"[csharp]": {
"editor.formatOnSave": true
},
"omnisharp.enableEditorConfigSupport": true
}
18 changes: 18 additions & 0 deletions backend/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# DevRules helper Makefile
# Usage in a repo:
# make devrules
# make devrules-force
#
# If DevRules is located elsewhere, override DEVRULES_DIR:
# make devrules DEVRULES_DIR=~/DevRules

DEVRULES_DIR ?= ~/DevRules

devrules:
node $(DEVRULES_DIR)/tools/apply-rules.mjs --repo .

devrules-force:
node $(DEVRULES_DIR)/tools/apply-rules.mjs --repo . --force

devrules-dry:
node $(DEVRULES_DIR)/tools/apply-rules.mjs --repo . --dry-run
40 changes: 40 additions & 0 deletions backend/PROJECT_RULES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Project Rules — Python / FastAPI

## Goals
- Clean, typed Python; predictable APIs; safe dependency management.

## Engineering Best Practices
- **Design:** Apply SOLID where applicable; prefer composition over inheritance; keep responsibilities small.
- **Public API documentation (Tooltip-friendly):** Public modules, classes, and functions MUST include
docstrings that work well in IDE tooltips.
- Include: 1-line summary, Args/Returns/Raises (as applicable), and important edge cases.
- **Data integrity (ACID / DB writes):** If the project performs database writes,
multi-step writes MUST use explicit transactions with clear commit/rollback boundaries.

## See also
- Python docstring templates: ../../shared/doc-templates/python-docstrings.md
- ACID violation checklist (DB writes): ../../shared/acid-violation-checklist.md
- Copilot self-correction prompt: ../../shared/copilot-self-correction-prompt.md

## Style & Tooling
- Use type hints broadly; keep code mypy/pyright-friendly.
- Lint with ruff; format with black (or ruff-format if the repo uses it).
- Avoid mutable default args.

## FastAPI Practices
- Use Pydantic models for request/response.
- Keep routers thin; business logic in services.
- Use `Depends()` for auth/db/config injection.
- Consistent error schema; no leaking internal exceptions.

## Structure
- routers/, schemas/, services/, repositories/, core/

## Security
- Secrets via env/secret manager only.
- Strict CORS.
- Enforce authz per route.

## Testing
- pytest.
- Test routers with TestClient; mock external deps.
Loading
Loading