# Features — intersect_backend

Evidence date: 2026-10-12. Revision: `main` `86347d4` (2024-09-26).

There is no feature list in the source repository. Status below is from the tracked files and the six commits on `main`. Secret values are omitted.

## Current features

| Feature | Status | Where |
|---|---|---|
| Drain `send_que` where `status` is 0 | Current entry point | `supabase/functions/sent_que/index.ts` |
| Send via SES SMTP `email-smtp.eu-west-1.amazonaws.com:587` | Current | Same file. `secure: false` |
| From address `no-reply@simpleflowhub.app` | Current literal | `index.ts`, and also `index_old.ts` and `send-aws-ses-email/index.ts` |
| SMTP credentials from env `SES_SMTP_USERNAME` and `SES_SMTP_PASSWORD` | Current in `index.ts` | Not read from the nested `.env` files, which use different names |
| Supabase client with service-role env vars | Current | `SUPABASE_URL`, `SUPABASE_SERVICE_ROLE_KEY` |
| One optional attachment from `attachment` | Current | Filename is the last `/` segment. `path` is the stored string |
| Text and HTML parts both set to `body` | Current | `sendEmail(to, subject, text, text, attachments)` |
| Write `status` 1 and a fixed success `result` | Current | Update by `id` |
| Write `status` 2 and a fixed failure `result` | Current | When `sendMail` throws |
| HTTP body `OK` after the loop | Current | `Content-Type` is `application/json`. Body is not JSON |
| Direct HTML send on POST | Current file, nested tree | `supabase/supabase/functions/send-aws-ses-email/index.ts` |
| Reject non-POST on that function with 405 | Current | Same file |
| SES `SendEmailCommand`, HTML only, one `to` | Current | Same file. Logs `to` |
| Greeting `Hello ${name}!` | Current | `hello-world/index.ts` and `send-email/index.ts` |
| Local CLI project id `intersect_backend` | Current | `supabase/config.toml` |
| Second CLI project id `supabase` | Current file, nested | `supabase/supabase/config.toml` |
| Committed CLI link metadata | Current | `supabase/supabase/.temp/` including project ref `bjlmgdkcktvfshewkfgc` |
| npm dependency `nodemailer` 6.9.15 | Current lock | `package.json`, `package-lock.json`. The Deno import is unpinned `npm:nodemailer` |
| SonarQube scan on `main` | Current YAML | `bitbucket-pipelines.yml`, `sonar-project.properties` |
| Deno editor settings | Current | Root `.vscode` enables `supabase/functions`. Nested `.vscode` enables `supabase/functions` relative to the `supabase/` folder |

## Superseded, still in the tree

`index_old.ts` is not deleted. Supabase loads `index.ts`, so this file does not run unless something imports it. Nothing in the repo imports it.

| Feature | Status | Where |
|---|---|---|
| Queue drain with `SmtpClient` from `deno.land/x/smtp@v0.7.0` | Retained, not the entry point | `index_old.ts` |
| Hardcoded SMTP username and password | Retained in source | Same file. Values omitted. Treat as exposed |
| Text-only send, no attachment | Retained | `client.send` `content: body` |
| Status 1 / 2 without writing `result` | Retained | `updateEmailStatus` |
| 200 `Email queue processed successfully` or 500 `Error processing email queue` | Retained | `Deno.serve` in that file |
| Commented SES SDK (`AWS_SES_KEY_ID2`, `AWS_SES_SECRET_KEY2`) | Comments only | Not executed |

## Not features of the running entry point

| Item | Why it is not a current behaviour |
|---|---|
| `send-email` sends mail | `send-email/index.ts` is the greeting template. The `.env` beside it is unused by that file |
| `hello-world` sends mail | Same template |
| Root `package.json` is the function manifest | The function imports `npm:nodemailer` and `esm.sh`. `package.json` has no `scripts`, no `name`, and no `engines`. The lockfile `name` is `intersect_backend` |
| Local `config.toml` auth settings are product rules | They match the CLI template. See `business-rules.md` |
| Pipeline deploys functions | The only step is SonarQube |

## Planned

No planned-feature document, TODO list, or ticket export is in the repository.

Comments that describe intent without a second implementation:

| Comment | File | Label |
|---|---|---|
| `status` is "the field marking unsent emails" | `index.ts` and `index_old.ts` | Comment. The code selects `0` and writes `1` or `2` |
| Attachment is a "URL or local path" | `index.ts` | Comment. The code passes the string as nodemailer `path` |
| "Edge function that will run every time it's triggered" | `index_old.ts` | Comment. No trigger definition is in git |

## Removed

Git history does not delete a feature after it was added. `index_old.ts` was added in the same commit as `index.ts` (`86347d4`), so the old implementation was never the only file at a published revision. It is superseded inside that commit, not removed.

`send-email` was added in `33d1524` already as the greeting template. There is no earlier revision of that file that sends mail.

## Not in this repository

| Capability | Evidence |
|---|---|
| Insert into `send_que` | No insert. Select and update only |
| Schema, RLS, seed data | Both `seed.sql` files are empty blobs. No `migrations/` |
| Schedule or cron | No function schedule in either `config.toml` |
| Tests | No test directory, no pipeline test step |
| `sonarqube_scan.bat` | Named by the onboarding filesystem scan. Absent from `git log --all` |
| Deploy of Edge Functions | No `supabase functions deploy` in the pipeline |
| The Lambda mailer | Separate repository. Silicon Ark: `intersect_lambda/` |

## Recently changed

The whole application history is 2024-09-11 to 2024-09-26. The last change, `86347d4`, added `sent_que`, the outer `config.toml`, `nodemailer`, and the root Deno editor settings. Nothing on `main` is newer.
