Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3bf1410
Docker files
dreadwitdastacc-IFA Dec 6, 2025
b6a2bdd
Create webpack.yml
dreadwitdastacc-IFA Dec 7, 2025
1fb179f
Bump the npm_and_yarn group across 1 directory with 11 updates
dependabot[bot] Dec 8, 2025
4561baf
chore(app): retire in-repo express shim (rely on @types/express)
dreadwitdastacc-IFA Dec 9, 2025
6a0e441
chore(app): retire in-repo express-validator shim (rely on @types/exp…
dreadwitdastacc-IFA Dec 9, 2025
cdb900d
chore(app): delete retired shims-express.d.ts
dreadwitdastacc-IFA Dec 9, 2025
7efce3d
chore(app): delete retired shims-express-validator.d.ts
dreadwitdastacc-IFA Dec 9, 2025
63182c0
Merge pull request #2 from dreadwitdastacc-IFA/fix/remove-inrepo-shims
dreadwitdastacc-IFA Dec 9, 2025
6a5cd9f
Merge branch 'main' into dependabot/npm_and_yarn/app/npm_and_yarn-eb6…
dreadwitdastacc-IFA Dec 9, 2025
39257a4
Merge pull request #1 from dreadwitdastacc-IFA/dependabot/npm_and_yar…
dreadwitdastacc-IFA Dec 9, 2025
00f0a45
ci: tighten CI (lint/test/integration); add husky+lint-staged; format…
dreadwitdastacc-IFA Dec 10, 2025
59c1d91
chore: stop tracking mongo-data and ignore husky directory
dreadwitdastacc-IFA Dec 10, 2025
6c28f0d
chore(test): add automerge test file
dreadwitdastacc-IFA Dec 11, 2025
49715d4
chore(rfc): propose web/mobile enhancements and add Dependabot config
dreadwitdastacc-IFA Dec 11, 2025
f9a82f2
Merge branch 'main' into enhance/web-mobile
dreadwitdastacc-IFA Dec 11, 2025
0decdfc
Merge pull request #5 from dreadwitdastacc-IFA/enhance/web-mobile
dreadwitdastacc-IFA Dec 11, 2025
73b60af
chore(deps): bump jake from 10.8.7 to 10.9.4 in /app
dependabot[bot] Dec 11, 2025
aff63f2
chore(deps): bump @types/node from 24.10.2 to 25.0.0 in /app
dependabot[bot] Dec 11, 2025
5bb96b9
chore(deps-dev): bump supertest from 6.3.4 to 7.1.4 in /app
dependabot[bot] Dec 11, 2025
0f4ebe1
chore(deps-dev): bump touch from 3.1.0 to 3.1.1 in /app
dependabot[bot] Dec 11, 2025
4b94ac9
Initial plan
Copilot Dec 12, 2025
230ca91
Fix corrupted CI workflow file - extract clean version
Copilot Dec 12, 2025
e81aea0
Add agent-debug job to capture results-agent.json
Copilot Dec 12, 2025
e8c0cd0
Add permissions block to agent-debug job for security
Copilot Dec 12, 2025
ca81aac
Merge pull request #11 from dreadwitdastacc-IFA/copilot/add-ci-debug-job
dreadwitdastacc-IFA Dec 12, 2025
caa4512
Merge pull request #6 from dreadwitdastacc-IFA/dependabot/npm_and_yar…
dreadwitdastacc-IFA Dec 12, 2025
fd42c1e
Merge pull request #7 from dreadwitdastacc-IFA/dependabot/npm_and_yar…
dreadwitdastacc-IFA Dec 12, 2025
f936d1a
Merge pull request #8 from dreadwitdastacc-IFA/dependabot/npm_and_yar…
dreadwitdastacc-IFA Dec 12, 2025
1d66e3d
Merge pull request #9 from dreadwitdastacc-IFA/dependabot/npm_and_yar…
dreadwitdastacc-IFA Dec 12, 2025
9f02363
Add CodeQL analysis workflow configuration
dreadwitdastacc-IFA Dec 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
app/node_modules
npm-debug.log
Dockerfile
docker-compose*.yml
.dockerignore
.git
.gitignore
.env
.env.local
.idea
.vscode
*.tgz
coverage
dist
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Example environment variables for local development and Compose
# Override these in your environment or provide a .env file (do NOT commit secrets here)

# MongoDB connection string used by app/config/keys.js
MONGO_PROD_URI=mongodb://todo-database:27017/todoapp

# Live reload settings (set to false to disable)
LIVERELOAD=true
LIVERELOAD_PORT=35729

# Application port
PORT=3000
3 changes: 3 additions & 0 deletions .github/AUTOMERGE_TEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Automerge test

This file is used to validate the automerge workflow.
112 changes: 112 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
## Purpose

These instructions are written for AI coding agents (Copilot-style) to be immediately productive in this repository:
- Small example multi-container Node.js + Mongo app using Express + EJS
- App lives under `app/`. Compose file `compose.yaml` defines two services: `todo-app` and `todo-database` (MongoDB).

## Big-picture architecture

- Services:
- `todo-app` (service code in `app/`) — Express server, EJS views, one router at `routes/front.js`.
- `todo-database` — Mongo image (see `compose.yaml`).
- Data flow: HTTP forms -> `routes/front.js` -> Mongoose models (`models/Todo.js`) -> MongoDB service `todo-database`.
- Why structure: repository is intentionally minimal to demonstrate multi-container local development with a separate DB service. `config/keys.js` centralizes the connection string and prefers the environment variable `MONGO_PROD_URI`.

## Key files (quick map)

- `app/server.js` — app entry point (sets EJS, livereload, connects DB via `config/keys.js`, mounts `routes/front.js`). Note: `package.json` scripts start `server.js`.
- `app/package.json` — scripts: `start` (production) and `dev` (nodemon + ejs). Dev tools are in `devDependencies`.
- `app/Dockerfile` — builds the image, installs dependencies (uses cache/bind mounts), installs `nodemon` globally and runs `npm run dev` by default.
- `compose.yaml` — defines services, port mappings (3000 and livereload 35729), and a `develop.watch` block used by some Docker dev workflows.
- `app/config/keys.js` — exports `mongoProdURI` and defaults to `mongodb://todo-database:27017/todoapp` when `MONGO_PROD_URI` not set.
- `app/models/Todo.js` — Mongoose schema (validation rules, enums, default values, indexes). Exports model named `todos`.
- `app/routes/front.js` — All HTTP endpoints: list GET `/`, POST `/` (create), and POST subroutes for destroy, edit, toggle.
- `app/views/todos.ejs` — front-end template (EJS) that renders `tasks` and uses `app.locals.moment` for date formatting.

## Project-specific conventions & patterns

- Single-router, thin controllers: `routes/front.js` performs model calls directly (no service layer).
- Model naming: `module.exports = Todo = mongoose.model('todos', TodoSchema);` — collection name is `'todos'` (lowercase). Use that pattern when adding models.
- Validation is implemented in the schema (see `task` field regex preventing `<` and `>`), so prefer schema-level validation over manual checks.
- Template variables: server sets `app.locals.moment = moment` so templates call `moment(...)` directly.
- Live reload: server uses `livereload` + `connect-livereload` and Compose maps port `35729` for the livereload client. Dev workflow expects nodemon + livereload rather than a manual rebuild loop.

## Dev / build / run workflows (explicit commands)

- Run with Docker Compose (recommended local flow):

docker compose up -d

Then open http://localhost:3000

- Run the Node app locally (inside `app/`) without Docker:

cd app
npm ci
npm run dev # uses nodemon and livereload

- Run production locally (without hot reload):

cd app
npm ci --production
npm start

- Notes about Dockerfile & compose:
- `app/Dockerfile` sets `CMD npm run dev` — the image is set up for the dev hot-reload flow by default.
- `compose.yaml` exposes port 3000 (app) and 35729 (livereload). The mongo service is `todo-database:27017` — matches `config/keys.js` default URI.

## Integration points & environment

- MongoDB connection: override with env var `MONGO_PROD_URI` (see `app/config/keys.js`). When running under Compose, the default host is `todo-database`.
- Ports: 3000 (app), 35729 (livereload), 27017 (mongo).

- Host-mounted DB for extra storage: Compose supports an optional host bind for MongoDB data via the `HOST_DB_PATH` environment variable. If `HOST_DB_PATH` is set when running Compose, the service will bind that host directory into the container at `/data/db` (otherwise a named volume `database` is used). Example:

HOST_DB_PATH=/mnt/big-disk/docker-mongo-data docker compose up -d

## Env files and local secrets

- A `.env.example` is provided at the repo root. Copy it to `.env` for local development and update values (do NOT commit `.env`). Key variables:
- `MONGO_PROD_URI` — Mongo connection string
- `LIVERELOAD` / `LIVERELOAD_PORT` — control livereload behavior
- `PORT` — application port

## CI

- A GitHub Actions workflow is included at `.github/workflows/ci.yml`. It builds the production image (BuildKit), runs the container, waits for the root endpoint to respond, and performs a smoke test. Use this as a template if you add tests or integrate with CD pipelines.

## Code change patterns & examples

- Add a new route: create `app/routes/<name>.js`, export an Express router and mount it in `app/server.js` via `app.use('/prefix', require('./routes/<name>'))`.

- Add a model: create `app/models/Name.js` using Mongoose Schema. Follow `models/Todo.js` style: include field-level validation, enums where applicable and export with a lowercase collection name.

- Example: toggle completion (existing pattern)

// in `routes/front.js`
const todo = await Todo.findById(taskKey);
todo.completed = !todo.completed;
await todo.save();

This code style prefers small atomic DB operations and redirecting to `/` after POSTs.

## Things an agent should watch for

- `package.json` `main` field is `app.js` but the runtime uses `server.js` — rely on the `scripts` section for commands.
- Mongoose options in `server.js` include `useNewUrlParser: true` which is a no-op in latest Mongoose versions; avoid changing unless you run tests.
- There are no automated tests or CI in the repo — changes should be validated manually by running the app and exercising endpoints.

## Quick search hints (useful file queries)

- Routes: `app/routes/**/*.js`
- Models: `app/models/**/*.js`
- Views: `app/views/**/*.ejs`
- Docker-compose: `compose.yaml`

## If you modify the container/dev flow

- If you change the Dockerfile CMD to `npm start`, update `compose.yaml` or document how to run the container for dev vs prod.
- If you add a new service that other services must reach by DNS, update `compose.yaml` service name and any defaults in `config/keys.js`.

---
If anything here is unclear or you'd like additional examples (e.g., adding REST JSON endpoints instead of POST+redirect, or a short migration to a service layer), tell me which area to expand and I will iterate.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/app"
schedule:
interval: "weekly"
open-pull-requests-limit: 5
allow:
- dependency-type: "all"
Loading