|
| 1 | +# DevHolm Developer Guide |
| 2 | + |
| 3 | +This guide explains how to work inside DevHolm without breaking the upgrade model. |
| 4 | + |
| 5 | +## The core rule |
| 6 | + |
| 7 | +DevHolm is designed so framework updates land in the framework layer, while your site continues to live in site-owned paths. |
| 8 | + |
| 9 | +Use this split: |
| 10 | + |
| 11 | +- `src/core/` is framework-owned. |
| 12 | +- `src/user/` is site-owned. |
| 13 | +- `src/app/` should stay thin and routing-focused. |
| 14 | +- `devholm.config.ts` is the contract between framework and site. |
| 15 | + |
| 16 | +If you need a new capability for a site, the first question should be: should DevHolm expose a new seam for this? |
| 17 | + |
| 18 | +## Working model |
| 19 | + |
| 20 | +### Framework-owned code |
| 21 | + |
| 22 | +These are the files DevHolm can safely evolve upstream: |
| 23 | + |
| 24 | +- `src/core/**` |
| 25 | +- most of `src/app/**` |
| 26 | +- framework scripts such as `scripts/devholm-cli.ts` |
| 27 | +- shared database and seed wiring such as `knexfile.js` |
| 28 | + |
| 29 | +Avoid editing these directly for site-specific behavior. |
| 30 | + |
| 31 | +### Site-owned code |
| 32 | + |
| 33 | +These are the places a downstream site should customize: |
| 34 | + |
| 35 | +- `devholm.config.ts` |
| 36 | +- `src/user/content/**` |
| 37 | +- `src/user/extensions/**` |
| 38 | +- `src/user/views/**` |
| 39 | +- `src/user/extensions/db/migrations/**` |
| 40 | +- `src/user/extensions/db/seeds/**` |
| 41 | + |
| 42 | +If a site feature requires custom admin UI, custom API endpoints, custom migrations, or custom seeds, it should land here. |
| 43 | + |
| 44 | +## Local development workflow |
| 45 | + |
| 46 | +Typical daily loop: |
| 47 | + |
| 48 | +```bash |
| 49 | +pnpm install |
| 50 | +pnpm db:setup |
| 51 | +pnpm seed:admin |
| 52 | +pnpm dev |
| 53 | +``` |
| 54 | + |
| 55 | +Useful validation commands: |
| 56 | + |
| 57 | +```bash |
| 58 | +pnpm typecheck |
| 59 | +pnpm test |
| 60 | +pnpm build |
| 61 | +``` |
| 62 | + |
| 63 | +## Database model |
| 64 | + |
| 65 | +DevHolm separates seeds into explicit buckets: |
| 66 | + |
| 67 | +- `bootstrap` seeds: framework-required baseline records |
| 68 | +- `demo` seeds: optional sample content |
| 69 | +- `user` seeds: site-owned content or operational data |
| 70 | + |
| 71 | +Relevant commands: |
| 72 | + |
| 73 | +```bash |
| 74 | +pnpm db:migrate |
| 75 | +pnpm db:seed |
| 76 | +pnpm db:seed:bootstrap |
| 77 | +pnpm db:seed:demo |
| 78 | +pnpm db:seed:user |
| 79 | +pnpm db:setup |
| 80 | +``` |
| 81 | + |
| 82 | +Guidance: |
| 83 | + |
| 84 | +- Put framework-required records in `src/core/db/seeds/bootstrap/`. |
| 85 | +- Put generic sample content in `src/core/db/seeds/demo/`. |
| 86 | +- Put real site data or operational site seeds in `src/user/extensions/db/seeds/`. |
| 87 | + |
| 88 | +## Extension model |
| 89 | + |
| 90 | +DevHolm supports several safe extension surfaces. |
| 91 | + |
| 92 | +### Content changes |
| 93 | + |
| 94 | +Use `src/user/content/` for About, Home, Now, and similar typed content. |
| 95 | + |
| 96 | +### Slots |
| 97 | + |
| 98 | +Use slots when you need to inject small UI pieces into core views without taking over the full page. |
| 99 | + |
| 100 | +Start by finding available slots: |
| 101 | + |
| 102 | +```bash |
| 103 | +pnpm devholm list:slots |
| 104 | +``` |
| 105 | + |
| 106 | +### View overrides |
| 107 | + |
| 108 | +Use ejected views only when a slot is not enough. |
| 109 | + |
| 110 | +```bash |
| 111 | +pnpm devholm eject about |
| 112 | +``` |
| 113 | + |
| 114 | +Once ejected, the view becomes site-owned and no longer auto-tracks upstream changes. |
| 115 | + |
| 116 | +### Admin extensions |
| 117 | + |
| 118 | +Put custom admin navigation and pages under `src/user/extensions/admin/`. |
| 119 | + |
| 120 | +### API extensions |
| 121 | + |
| 122 | +Put custom API handlers under `src/user/extensions/api/` and register them through the extension registry. |
| 123 | + |
| 124 | +### Database extensions |
| 125 | + |
| 126 | +Put site migrations and seeds under `src/user/extensions/db/`. |
| 127 | + |
| 128 | +## CLI workflow |
| 129 | + |
| 130 | +DevHolm ships with a CLI for common site tasks: |
| 131 | + |
| 132 | +```bash |
| 133 | +pnpm devholm status |
| 134 | +pnpm devholm list:slots |
| 135 | +pnpm devholm eject <view> |
| 136 | +pnpm devholm new:extension <name> |
| 137 | +pnpm devholm new:migration <name> |
| 138 | +pnpm devholm new:seed <name> |
| 139 | +``` |
| 140 | + |
| 141 | +Use the CLI to stay inside the framework conventions instead of inventing custom file shapes. |
| 142 | + |
| 143 | +## How to decide where code belongs |
| 144 | + |
| 145 | +Use this test: |
| 146 | + |
| 147 | +- If the behavior should exist for every DevHolm site, it belongs in DevHolm. |
| 148 | +- If the behavior is specific to one site, it belongs in `src/user/`. |
| 149 | +- If a site-specific feature currently requires patching framework files, DevHolm probably needs a new extension seam. |
| 150 | + |
| 151 | +## Upgrade-safe rules |
| 152 | + |
| 153 | +To keep downstream upgrades boring: |
| 154 | + |
| 155 | +- do not put site business logic in `src/core/` |
| 156 | +- do not put site routing mechanics directly into `src/app/` when an extension seam should exist |
| 157 | +- do not store real site data in core demo seeds |
| 158 | +- prefer `src/user/` registrations over framework patches |
| 159 | +- keep `devholm.config.ts` as the place where site wiring happens |
| 160 | + |
| 161 | +## Deployment model |
| 162 | + |
| 163 | +The production workflow is GitHub Actions driven. |
| 164 | + |
| 165 | +- GitHub Actions builds and publishes the Docker image. |
| 166 | +- The deploy job generates `docker-compose.override.yml` from repository secrets. |
| 167 | +- The server runs the app container and points it at the host PostgreSQL instance. |
| 168 | + |
| 169 | +Read these before first deployment: |
| 170 | + |
| 171 | +- [Quick Start](./getting-started.md) |
| 172 | +- [GitHub Secrets](../GITHUB_SECRETS.md) |
| 173 | +- [Deployment](../DEPLOYMENT.md) |
| 174 | + |
| 175 | +## GitHub Actions secrets |
| 176 | + |
| 177 | +The deploy workflow expects these repository secrets: |
| 178 | + |
| 179 | +- `PROJECT_NAME` |
| 180 | +- `SITE_URL` |
| 181 | +- `SITE_NAME` |
| 182 | +- `DEPLOY_HOST` |
| 183 | +- `DEPLOY_USER` |
| 184 | +- `DEPLOY_KEY` |
| 185 | +- `DEPLOY_PATH` |
| 186 | +- `POSTGRES_USER` |
| 187 | +- `POSTGRES_PASSWORD` |
| 188 | +- `POSTGRES_DB` |
| 189 | +- `NEXTAUTH_SECRET` |
| 190 | +- `ADMIN_EMAIL` |
| 191 | +- `ADMIN_PASSWORD` |
| 192 | + |
| 193 | +Optional: |
| 194 | + |
| 195 | +- `APP_PORT` |
| 196 | +- `CSRF_SECRET` |
| 197 | + |
| 198 | +Important note: |
| 199 | + |
| 200 | +- The workflow uses `NEXTAUTH_SECRET` and also maps it into `AUTH_SECRET` inside the generated production compose override. |
| 201 | + |
| 202 | +## Recommended onboarding order for contributors |
| 203 | + |
| 204 | +1. Read [Quick Start](./getting-started.md). |
| 205 | +2. Read [Architecture](./architecture.md). |
| 206 | +3. Read [Configuration](./configuration.md). |
| 207 | +4. Read [Extensions](./extensions.md). |
| 208 | +5. Read [GitHub Secrets](../GITHUB_SECRETS.md) and [Deployment](../DEPLOYMENT.md) if you are touching CI/CD. |
0 commit comments