Template repo for creating a new webapp that walks the golden path.
Usage: create a repository from a template
- Auth
- Web unit/integration tests
- E2E tests
- Versioning strategy for prod deploys - automatic changelog & tags
- Possible solution: version in root package.json and CI-step that checks changelog has matching section
- Add feature flags
- Add better example code for coherent frontend/backend/db
- Expand documentation
| Type | Description |
|---|---|
| web | TS create-next-app with additions |
| backend | C# hexarch template |
| Infrastructure as Code | Nais |
| Local containers | Docker Compose |
| Auth | Entra ID with OAuth |
| Observability | OpenTelemetry & Grafana |
| Name | Trigger | Description |
|---|---|---|
| CI | PR | Build/test/lint pipeline for PRs |
| Lint PR | PR | Adds PR labels and checks PR title |
| Deploy to Nais | Push to main | Continuous deployment to Nais. Only deploys changed apps and runs e2e tests before prod deploy. |
- Look through all files in .nais and update for your team and application.
- Check .github/workflows/deploy.yml and remove/update checks that prevent accidental deploys from other repos.
- Go to GitHub -> repository -> settings -> general. Enable "Allow auto-merge" and "Automatically delete head branches".
"Allow auto-merge" is particularly useful for Renovate, while "Automatically delete head branches" keeps the branch list clean.
- After finishing your first PR, go to GitHub -> repository -> settings -> code and automation: rules -> rulesets and create a new ruleset called "CI".
- Enforcement status: Active
- Target branches -> Add target -> Include default branch
- Check "Require status checks to pass" and add checks. Search for "build-backend", "build-web", and "Check PR title". Enable all 3. They should be shown with "GitHub Actions" indicator next to the name.
- Save
PRs that want to merge to main now have to pass the checks from your CI pipeline.
- Do a global replace all in your IDE for "GoldenPathBackend" to rename the backend application. Consider renaming
backend/GoldenPathBackend.slnas well and make sure the Dockerfile correctly references the solution.
Start Next.js and C# backend in dev/watch modes with hot reload, with docker compose for DB and Grafana:
pnpm install && pnpm devSee each package.json in root, web and backend for additional commands for running combinations of Docker and dev mode.
# use nais cli to validate your manifest and see the result after templating
$: cd .nais
.nais$: nais validate --verbose --vars-file vars-dev.yaml web.yaml
.nais$: nais validate --verbose --vars-file vars-dev.yaml backend.yamlcd backenddotnet new update- Delete all files in backend except package.json
dotnet new hexarch -n "GoldenPathBackend"- Restore customizations:
- Adjust compose files for monorepo structure
- Update compose and appsettings files for CORS and web app compatibility