commit 03010f2fd8027b81b2d46078e0b9270e04b012e8 Author: Joakim Mörling Date: Thu Apr 30 15:26:40 2026 +0200 chore: initial project setup with docs and guidelines diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a5141f0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ +# Dependencies +node_modules/ +frontend/node_modules/ + +# Build output +dist/ +frontend/dist/ +target/ +*.class +*.jar +*.war +!.mvn/wrapper/maven-wrapper.jar + +# Environment +.env +!.env.example + +# IDE +.idea/ +*.iml +.vscode/ +.project +.classpath +.settings/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# Logs +*.log + +# Obsidian (personal vault, not project) +.obsidian/ + +# Docker +docker-compose.override.yml + +# Java +*.hprof + +# Test +coverage/ +frontend/coverage/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..71eb674 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,196 @@ +# AGENTS.md — BilHej / Bilhälsning.se + +Project-specific instructions for OpenCode. Commit this file. + +--- + +## Project Identity + +BilHej is a web platform letting Swedish residents send physical letters to +vehicle owners by entering a registration number. The sender composes a letter, +pays 49 SEK, and BilHej prints+mails it via PostNord. The sender never sees +the recipient's name or address. + +**Phase 0 (current):** Manual workflow. No Transportstyrelsen or PostNord API +integration yet. Owner address is obtained manually by a human and entered into +the admin panel. + +Tech stack: Vue.js 3 (Vite, Pinia) frontend + Java 21 Spring Boot 3 backend + +PostgreSQL 16. Deployed via Docker Compose. + +--- + +## Build, Lint, Test & Run Commands + +Always run these after making changes to verify nothing is broken. + +### Quick start (everything) + +```bash +cp .env.example .env # first time only, then fill in keys +docker compose up -d # starts postgres, backend, frontend +``` + +### Frontend (Vue.js 3 + Vite) + +```bash +cd frontend +npm install # first time only +npm run dev # dev server on :3000 with HMR +npm run build # production build +npm run lint # ESLint +npm run test # vitest +``` + +### Backend (Spring Boot 3 + Java 21) + +```bash +cd backend +./mvnw spring-boot:run # dev server on :8080 +./mvnw test # JUnit 5 + Mockito +./mvnw verify # full verification including integration tests +``` + +### Stripe webhooks (local testing) + +```bash +stripe listen --forward-to localhost:8080/api/webhooks/stripe +``` + +### Database + +Flyway migrations run automatically on Spring Boot startup. Migration files +live in `backend/src/main/resources/db/migration/`. Naming: `V__descriptive_name.sql`. + +To reset: `docker compose down -v && docker compose up -d`. + +--- + +## Project Structure + +``` +bilhej/ +├── frontend/ # Vue.js 3 SPA (Vite) +│ ├── src/ +│ │ ├── pages/ # Route-level page components +│ │ ├── components/ # Reusable UI components +│ │ ├── composables/ # useXxx.js shared logic +│ │ ├── stores/ # Pinia stores +│ │ ├── api/ # API client modules +│ │ ├── router/ # Vue Router config +│ │ └── assets/ # Static files, CSS +│ └── ... +├── backend/ # Spring Boot 3 (Java 21) +│ ├── src/main/java/se/bilhalsning/ +│ │ ├── config/ # @Configuration classes +│ │ ├── controller/ # REST controllers +│ │ ├── dto/ # Request/response DTOs +│ │ ├── entity/ # JPA entities +│ │ ├── repository/ # Spring Data JPA repos +│ │ ├── service/ # Business logic +│ │ ├── security/ # JWT filter, UserDetailsService +│ │ ├── exception/ # Custom exceptions + @ControllerAdvice +│ │ └── mapper/ # Entity ↔ DTO mapping +│ └── src/main/resources/ +│ ├── application.yml +│ └── db/migration/ # Flyway migrations +├── docker/ # Dockerfiles +├── docker-compose.yml +├── docker-compose.prod.yml +├── .env.example +├── AGENTS.md # This file +├── README.md +├── REQUIREMENTS.md +└── CODING_GUIDELINES.md +``` + +--- + +## Conventions (Summary) + +Full details in `@CODING_GUIDELINES.md`. Key rules: + +### Both sides +- Code and comments in English. User-facing strings in Swedish. +- No commented-out code. Delete it. +- Functions stay small (<30 lines). + +### Frontend (Vue.js 3) +- ` + + + + +``` + +### Conventions + +- Use `