max / makenotwork
1 file changed,
+4 insertions,
-59 deletions
| @@ -72,68 +72,13 @@ MNW/ # Monorepo root | |||
| 72 | 72 | tauri-updater-ui/ # OTA update UI components | |
| 73 | 73 | ``` | |
| 74 | 74 | ||
| 75 | - | ## Code Patterns (server/) | |
| 75 | + | ## Coding Patterns | |
| 76 | 76 | ||
| 77 | - | ``` | |
| 78 | - | server/src/ | |
| 79 | - | ├── main.rs Entry point | |
| 80 | - | ├── lib.rs Library root | |
| 81 | - | ├── config.rs Configuration | |
| 82 | - | ├── constants.rs Shared constants | |
| 83 | - | ├── error.rs Error handling | |
| 84 | - | ├── auth.rs Authentication | |
| 85 | - | ├── csrf.rs CSRF protection | |
| 86 | - | ├── db/ Database queries (directory module) | |
| 87 | - | ├── docs.rs Documentation rendering | |
| 88 | - | ├── email/ Email handling (directory module) | |
| 89 | - | ├── git/ Git source browser logic (directory module) | |
| 90 | - | ├── helpers.rs Shared helper functions | |
| 91 | - | ├── markdown.rs Markdown rendering | |
| 92 | - | ├── monitor.rs Health monitoring | |
| 93 | - | ├── payments/ Stripe integration (directory module) | |
| 94 | - | ├── rss.rs RSS feed generation | |
| 95 | - | ├── scanning/ File scanning (ClamAV, YARA, hash lookup) | |
| 96 | - | ├── scheduler.rs Background task scheduler | |
| 97 | - | ├── sentry_layer.rs Sentry error tracking integration | |
| 98 | - | ├── storage.rs S3 storage | |
| 99 | - | ├── synckit_auth.rs SyncKit JWT auth | |
| 100 | - | ├── templates/ Askama templates (directory module) | |
| 101 | - | ├── types/ Shared types (directory module) | |
| 102 | - | ├── validation/ Input validation (directory module) | |
| 103 | - | ├── wordlist.rs Wordlist for invite codes | |
| 104 | - | └── routes/ | |
| 105 | - | ├── mod.rs | |
| 106 | - | ├── admin.rs Admin panel | |
| 107 | - | ├── auth.rs Login, signup, logout | |
| 108 | - | ├── api/ JSON API endpoints (directory module) | |
| 109 | - | ├── git/ Git source browser routes (directory module) | |
| 110 | - | ├── git_issues/ Git issue tracker routes (directory module) | |
| 111 | - | ├── pages/ HTML page routes (directory module) | |
| 112 | - | │ ├── mod.rs Route composer | |
| 113 | - | │ ├── public/ Public-facing pages (directory module) | |
| 114 | - | │ ├── dashboard/ Creator dashboard + HTMX tabs (directory module) | |
| 115 | - | │ ├── email_actions/ Email link handlers (directory module) | |
| 116 | - | │ ├── feeds.rs RSS feeds | |
| 117 | - | │ └── blog.rs Blog pages | |
| 118 | - | ├── oauth.rs OAuth provider routes | |
| 119 | - | ├── postmark/ Postmark webhook handler (directory module) | |
| 120 | - | ├── storage/ File upload/download (directory module) | |
| 121 | - | ├── stripe/ Stripe webhooks + connect (directory module) | |
| 122 | - | └── synckit/ SyncKit API endpoints (directory module) | |
| 123 | - | ``` | |
| 124 | - | ||
| 125 | - | Route files should stay under 500 lines. When a route module grows beyond that, split it into a directory module grouped by domain. | |
| 77 | + | See `server/CONTRIBUTING.md` for route handler patterns, error handling, macros (`impl_str_enum!`, `define_pg_uuid_id!`), DB query style, HTMX response patterns, template conventions, migration rules, and CSRF details. | |
| 126 | 78 | ||
| 127 | - | ## Key Patterns | |
| 79 | + | See `multithreaded/CONTRIBUTING.md` for MT-specific patterns (MNW OAuth, shared dep sync, internal HMAC API). | |
| 128 | 80 | ||
| 129 | - | - `impl_str_enum!` macro for enum <-> string (Display, FromStr, sqlx Type/Encode/Decode) | |
| 130 | - | - `define_pg_uuid_id!` macro for newtype UUID ID wrappers | |
| 131 | - | - `EnvironmentFile=/opt/makenotwork/.env` for all secrets | |
| 132 | - | - SQLx compile-time checked queries; migrations auto-run on boot | |
| 133 | - | - HTMX responses return HTML fragments; JSON fallback for non-HTMX requests | |
| 134 | - | - Tests: each integration test creates/drops its own PostgreSQL database | |
| 135 | - | - **Rust 2024 edition** (Rust 1.85+) | |
| 136 | - | - `server/site-docs/` = DocEngine content (public/ and unpublished/). Server docs are in `server/docs/`. | |
| 81 | + | **Rust 2024 edition** (Rust 1.85+). `server/site-docs/` = DocEngine content. Server docs are in `server/docs/`. | |
| 137 | 82 | ||
| 138 | 83 | ## Versioning | |
| 139 | 84 |