|
| 1 | +# Junie Project Guidelines — Node.js Simple Notes App |
| 2 | + |
| 3 | +These guidelines help Junie make minimal, correct changes to this repository and understand how to validate them. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | +A RESTful Notes API built with Node.js (ES Modules) and Express, featuring a database‑agnostic architecture with interchangeable NoSQL backends. The app currently supports CouchDB and MongoDB via repository implementations, includes a lightweight web UI, and provides JSDoc-based documentation and Jest tests. Target runtime is Node.js 22. |
| 7 | + |
| 8 | +Key characteristics: |
| 9 | +- Layered design: Model → Repository (vendor-specific) → API (Express routes) |
| 10 | +- Recycle Bin flow (soft delete + restore, with permanent delete) |
| 11 | +- Environment-driven configuration and Docker Compose setups per database |
| 12 | + |
| 13 | +## Repository Layout (top-level) |
| 14 | +- src/ — application source code (server, routes, repositories, models) |
| 15 | +- __tests__/ — Jest test suite |
| 16 | +- scripts/ — helper scripts for docs and maintenance |
| 17 | +- docs/ — generated JSDoc output (created by scripts) |
| 18 | +- docker-compose.couchdb.yml — CouchDB stack for local dev |
| 19 | +- docker-compose.mongodb.yml — MongoDB stack for local dev |
| 20 | +- couchdb.Dockerfile, mongodb.Dockerfile, notes.Dockerfile — container images |
| 21 | +- env.template — template of required environment variables |
| 22 | +- jest.config.js — Jest configuration |
| 23 | +- jsdoc.config.json — JSDoc configuration |
| 24 | +- README.md — product overview and setup |
| 25 | +- DOCUMENTATION.md — documentation workflow and tips |
| 26 | + |
| 27 | +## Prerequisites |
| 28 | +- Node.js: 22.x (as enforced by package.json engines) |
| 29 | +- npm: 10+ |
| 30 | +- One database backend available locally (CouchDB ≥3.4.3 or MongoDB ≥7.0), or use Docker Compose |
| 31 | + |
| 32 | +## Local Development |
| 33 | +1) Clone and install |
| 34 | +- npm install |
| 35 | + |
| 36 | +2) Configure environment |
| 37 | +- cp env.template .env |
| 38 | +- Choose a DB vendor via DB_VENDOR=couchdb or DB_VENDOR=mongodb |
| 39 | +- For CouchDB: set COUCHDB_URL and COUCHDB_DB_NAME |
| 40 | +- For MongoDB: set MONGODB_URL and MONGODB_DB_NAME |
| 41 | +- Optional server config: HOST, PORT |
| 42 | + |
| 43 | +3) Run the server |
| 44 | +- npm start |
| 45 | +- Server binds to HOST:PORT (defaults in README); open the web UI in your browser |
| 46 | + |
| 47 | +## Using Docker Compose (recommended for full stack) |
| 48 | +- CouchDB: docker-compose -f docker-compose.couchdb.yml up --build |
| 49 | +- MongoDB: docker-compose -f docker-compose.mongodb.yml up --build |
| 50 | +Ensure .env contains the required credentials before starting. |
| 51 | + |
| 52 | +## Tests |
| 53 | +- Run unit/integration tests: npm test |
| 54 | +- Run with coverage: npm run test:coverage |
| 55 | +- Open coverage report: npm run test:coverage:open (Linux requires xdg-open) |
| 56 | +Notes: |
| 57 | +- Jest runs under Node 22 with experimental VM modules flag set by the script |
| 58 | + |
| 59 | +## Documentation |
| 60 | +- Generate docs: npm run docs |
| 61 | +- Watch docs: npm run docs:watch |
| 62 | +- Serve docs locally: npm run docs:serve (http://localhost:8080) |
| 63 | +- Version docs for releases: npm run docs:version |
| 64 | +See DOCUMENTATION.md for details. |
| 65 | + |
| 66 | +## Code Style and Conventions |
| 67 | +- ESM only ("type": "module"); prefer async/await and modern Node 22 APIs |
| 68 | +- Keep repository interface boundaries clean when touching data access code |
| 69 | +- Add or update Jest tests when changing behavior |
| 70 | +- JSDoc for public methods and API routes is encouraged |
| 71 | +- No separate build step is required; server starts with node src/notes-api-server.js |
| 72 | + |
| 73 | +## CI/CD |
| 74 | +- GitHub Actions workflows validate tests and documentation (see .github/workflows) |
| 75 | +- validate-ci.sh and test-docker-setups.sh provide extra checks locally if needed |
| 76 | + |
| 77 | +## Guidance for Junie (this assistant) |
| 78 | +- Make the minimal change required to satisfy the issue |
| 79 | +- When renaming code entities, use the dedicated rename tool so all references update safely |
| 80 | +- Prefer adding tests or adjusting existing ones to validate new behavior when applicable |
| 81 | +- Respect Node 22 engine; avoid adding dependencies unnecessarily |
| 82 | +- If environment-sensitive features are involved, document .env expectations succinctly |
| 83 | + |
| 84 | +## Helpful References |
| 85 | +- Primary setup and usage: README.md |
| 86 | +- Docs workflow: DOCUMENTATION.md |
| 87 | +- Scripts and commands: package.json scripts section |
0 commit comments