# Project plan — greenfields

Evidence date: 2026-10-13.

Source repository: `git@bitbucket.org:overdrive/greenfields.git`.

Inspected revision: `main` at `3918f17f956e7adb3655d65662eba8ef517ead93` (2024-05-13 14:48:18 +0200, subject `deploy`). The scan-host path `~/projects/sonar_scan/repos/greenfields` was not on this machine. The tree was read from a clone of `https://bitbucket.org/overdrive/greenfields.git`. Secrets under `supabase/.env` and the hardcoded Supabase anon key in client code are named by location and are not reproduced.

This plan describes what the repository contains. It does not decide what the product should become.

There is no prior Silicon Ark directory for this project. The source repository has a short README only.

## Product

**Documented.** README title: `CEI Application V2`. Package name in `pubspec.yaml`: `c_e_i_application_v2`. README says FlutterFlow projects target Flutter stable, and documents `flutter pub get` then `flutter build web`.

**Implemented (UI branding).** Web title and Open Graph title are `Greenfields` (`web/index.html`). Apple web-app title is `Greenfields`. MaterialApp title is `Silicon Overdrive ` (`lib/main.dart`). Wizard assets and success copy reference `greenfields.overdrive.co.za`, `greenfields.medmin.co.za`, and `greenfields@overdrive.co.za`.

**Inferred.** The app is a Silicon Overdrive / AWS partner intake and portal for collecting business leads and startup AWS programme information, then offering a signed-in shell (posts, applications, profile, support).

What "CEI" expands to, and whether Greenfields is the customer-facing product name versus an internal codename, is **Unknown / Requires Confirmation**.

### Related Silicon Ark project

Silicon Ark already documents **`greenfields_web`**. That write-up describes a CodeIgniter Admin Overdrive / Transactflow EDI console. The string "greenfields" does not appear in that application's product behaviour according to its Silicon Ark set. This Flutter repository uses hostnames `greenfields.overdrive.co.za` and `greenfields.medmin.co.za` for images. Whether those hosts are served by the `greenfields_web` repository, by static hosting, or by another system is **Unknown / Requires Confirmation**. This onboarding documents the Flutter `greenfields` repository only. Do not assume a shared database with `greenfields_web` without confirmation.

## Objectives visible in the code

No project plan, milestone list, or backlog lives in the repository.

Objectives that can be read from the implementation:

1. Let an anonymous visitor choose a journey and complete a multi-step business lead form, persisted to Supabase table `lead`.
2. Let a visitor who matches an existing lead (email + contact number) complete a startup AWS information wizard, persisted to table `startup`.
3. Notify operators by email when new lead/startup rows are unsent (`sent = 0`), via Supabase Edge Function `auto_email` and Resend.
4. Let a user create a Supabase Auth account and use a bottom-nav portal (applications, posts, profile, support, notifications, FAQ).
5. Build and FTP-deploy the Flutter web artefact from Bitbucket Pipelines on `main`.

## Branch reality

Default branch is `main`. `origin/HEAD` points at `main`. A shallow clone showed only `main` at `3918f17`.

| Commit | Date | Subject |
|---|---|---|
| `3918f17` | 2024-05-13 | deploy |

Full history depth beyond the shallow clone was not inspected. Issue OVER-141 recorded the same tip commit at discovery (2026-09-28).

## Scope

### In scope of the committed tree

- Flutter / Dart application under `lib/` (FlutterFlow-generated patterns).
- Platform folders: `android/`, `ios/`, `web/`.
- Assets under `assets/`.
- Supabase local project layout under `supabase/supabase/` including Edge Function `auto_email`.
- Bitbucket Pipelines web build and FTP deploy (`bitbucket-pipelines.yml`).
- Minimal widget test (`test/widget_test.dart`).
- Analysis options (`analysis_options.yaml`).

### Reported on a scan host, not in this clone

Issue OVER-141 listed `sonar-project.properties` and `sonarqube_scan.bat` at discovery. Those files are **not** in the clone at `3918f17`. Whether they exist only as untracked files on a scan host is **Unknown / Requires Confirmation**.

### Out of scope / not established here

- Mobile store release pipeline (Android release still uses debug signing).
- Written product requirements, ADRs, or API specification.
- Server-side Supabase RLS / migration SQL for production schema (no migrations folder with table DDL was found; `seed.sql` is empty).

## System architecture

```text
Browser / Flutter client (web primary deploy path; android/ios present)
        |
        | supabase_flutter (Auth + PostgREST)
        v
Supabase project ref zbocxsdglolhcijqyyuy
  - tables: lead, startup, user, company, post, cities, countries, states, subregions
  - Edge Function: auto_email  --no-verify-jwt
        |
        | Resend HTTP API
        v
Operator mailbox (cei.silicon@gmail.com in function code)

External JSON: jsonkeeper.com (AWS services list)
Static images: greenfields.overdrive.co.za / greenfields.medmin.co.za

CI: Bitbucket Pipelines -> flutter build web -> ncftpput to FTP host
```

## Major components

| Component | Role | Evidence | Provenance |
|---|---|---|---|
| Public journey chooser | Entry for anonymous users | `lib/pages/wizzard/step_start/` | Implemented |
| Business lead wizard | Steps collecting company/contact/AWS intro data into `FFAppState`, insert `lead` | `lib/pages/wizzard/step1`–`step6`, `success` | Implemented |
| Startup wizard | Soft login against `lead`, then AWS detail steps, insert `startup` | `lib/pages/wizzard_startup/` | Implemented |
| Auth + portal | Supabase email auth; posts, applications, profile, support | `lib/auth/`, `lib/pages/login/`, `lib/pages/posts/`, etc. | Implemented |
| Supabase client | URL + anon key, table row classes | `lib/backend/supabase/` | Implemented |
| Edge Function `auto_email` | Batch email of unsent leads/startups | `supabase/supabase/functions/auto_email/index.ts` | Implemented |
| FlutterFlow utilities | Theme, nav, widgets | `lib/flutter_flow/` | Implemented |
| Web CI/CD | Build web + FTP | `bitbucket-pipelines.yml` | Implemented |

## Milestones

None are documented in the repository. The only commit message observed on the inspected tip is `deploy`.

## Implementation plan (as implied by tooling)

**Documented** in README and `supabase/readme.txt`:

1. `flutter pub get` / `flutter build web`.
2. Local Supabase: install Deno/Supabase CLI, `npx supabase functions serve --no-verify-jwt`, deploy with `npx supabase functions deploy auto_email --no-verify-jwt`, secrets via `npx supabase secrets set --env-file .env`.

No further sequenced delivery plan exists in-repo.

## Dependencies (high level)

| Area | Evidence |
|---|---|
| Flutter SDK constraint | `pubspec.yaml` `sdk: ">=3.0.0 <4.0.0"` |
| Backend | `supabase_flutter: 1.10.24` and related clients |
| Routing / state | `go_router: 12.1.3`, `provider: 6.0.5` |
| Email (server) | Resend from Edge Function; `RESEND_API_KEY` from environment / committed `.env` |
| Deploy | Bitbucket env vars `FTP_USERNAME`, `FTP_PASSWORD`, `FTP_HOST`, `FTP_SITE_ROOT` |

Full package list: `pubspec.yaml` / `pubspec.lock`.

## Current project status

| Observation | Provenance |
|---|---|
| Tip commit is May 2024 `deploy` | Implemented (Git) |
| Web pipeline builds and FTP-deploys on `main` | Implemented (`bitbucket-pipelines.yml`) |
| Product still mixed CEI / Greenfields / Silicon Overdrive naming | Implemented |
| Portal routes do not set `requireAuth: true` | Implemented (`lib/flutter_flow/nav/nav.dart`) |
| Notifications and dashboard show placeholder / static content | Implemented |
| Sonar files from discovery listing not in clone | Unknown |
| Whether production FTP site and Supabase project are still live | Unknown / Requires Confirmation |

## Items requiring human confirmation

1. Official product name for customers (Greenfields vs CEI Application V2 vs Silicon Overdrive).
2. Relationship between this repo, hosts `greenfields.overdrive.co.za` / `greenfields.medmin.co.za`, and Silicon Ark project `greenfields_web`.
3. Production ownership of Supabase project `zbocxsdglolhcijqyyuy` and whether RLS is enabled.
4. Whether `cei.silicon@gmail.com` and Resend sandbox sender `onboarding@resend.dev` are still the intended notification path.
5. Whether mobile (Android/iOS) is a supported delivery channel or web-only.
6. Disposition of committed secrets in `supabase/.env` (rotation / removal from history).
