Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 8 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PostgreSQL connection string
# Local: postgresql://youruser@localhost:5432/website
DATABASE_URL=postgresql://youruser@localhost:5432/website
# Local: postgresql://postgres:postgres@localhost:5432/website
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/website

# Payload CMS
PAYLOAD_SECRET=your-secret-key-change-in-production
Expand All @@ -13,3 +13,9 @@ S3_SECRET_ACCESS_KEY=your-r2-secret-key

# Webflow API (for migration only)
WEBFLOW_API_TOKEN=your-webflow-api-token

# LinkedIn OAuth (Sign In with LinkedIn using OpenID Connect)
# Register an app at https://developer.linkedin.com and add the OIDC product.
LINKEDIN_CLIENT_ID=your-linkedin-client-id
LINKEDIN_CLIENT_SECRET=your-linkedin-client-secret
LINKEDIN_REDIRECT_URI=http://localhost:3000/api/auth/linkedin/callback
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,41 @@ npm run deploy:worker
npm run deploy:all
```

## Database & Migrations

Schema is generated by Payload CMS v3 from the collection configs in `src/collections/*.ts`. See `SCHEMA.md` for the current tables. Use Payload's built-in migration tooling to evolve the schema — it diffs the live database against the config and writes a TypeScript migration file.

### Adding or changing a collection

1. Edit or create `src/collections/<name>.ts`.
2. Register new collections in the `collections` array in `src/payload.config.ts`.
3. Generate a migration from the diff:
```bash
DATABASE_URL=... npx payload migrate:create
```
This writes a new file under `src/migrations/` containing `up` / `down` functions. Commit it.
4. Regenerate TypeScript types:
```bash
npx payload generate:types
```
5. Apply the migration locally to verify:
```bash
DATABASE_URL=... npx payload migrate
```

Useful commands:

| Command | Purpose |
|---------|---------|
| `npx payload migrate:create` | Generate a new migration from config vs. DB diff |
| `npx payload migrate` | Apply all pending migrations |
| `npx payload migrate:status` | Show which migrations have run |
| `npx payload migrate:down` | Revert the most recent migration |

### Deploy

Run `npx payload migrate` against the production database as part of the deploy, before traffic hits the new code. Without this step, Payload's dev-mode auto-sync will not run in production and schema drift will surface as runtime errors.

## Secrets

Required on both workers:
Expand All @@ -56,3 +91,11 @@ npx wrangler secret put DATABASE_URL --config worker/wrangler.jsonc
| Schedule | Job |
|----------|-----|
| `0 * * * *` | Hourly job |

## Tips for Open Source Contributors

- If you use the default docker-compose to bring up a DB, the .env.example has a valid DATABASE_URL
- Navigate to `/admin` to setup the first user. You must use the string 'admin@buildcanada.com', else you won't be able to use all the features and you'll get auth issues.
- You may need to comment out S3_BUCKET from .env, depending on your access and what you're doing.


51 changes: 51 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Roadmap (for Community Member Features)

This roadmap is intentionally focused only on the features related to enabling Community Members to engage and signal Build Canada using data, and maybe one day, money.

## Stage 1 - Add a Single External Identity Provider <- we are here

We've chosen LinkedIn as a credibly neutral and aligned identity provider, as the initial source for Build Canada "Community Members" to link out to. This was chosen for the credibility, cost, brand alignment, ease of integration, and pseudo-sybil resistance properties.

The goal of stage 1 is to incorporate an external identity provider in a way that enables design, architectural experimentation, and user testing, to support the vision and future stages of the roadmap.

We are here, but this stage is not complete.

The features supported by adding the external identity provider are intentionally not prominant on the site, for now.

Instead, they are at the bottom of pages, out of the way, and subtle. The goal of stage one is to help answer questions such as:

1. How should connected accounts be managed, if at all?
2. Are there privacy policy requirements that would impact features?
3. Will users embrace them or reject them?
4. What signals should be available? Should "only upvotes" be supported? Or is there value in some kind of "down-vote"-equivalent?
5. Can a moderation-free solution be built?
6. Are there scaling considerations?
7. What are the trade-offs when considering future identity providers? And can they be deduped?
8. Do we need a "Community Member" page?
9. Does this increase engagement? To people feel more included?

If this works, it could be a 2x to 10x multiplier on distribution.

## Stage 2 - Add a second identity provider

In stage 2, the goal is to expand the network effects of the community members, and validate UX decisions made in Stage 1. The logic is that, if you can successfully add a 2nd, then you can successfully add N-more, as integration-feasibility and data support those decisions.

Every additional integration, widens the addressable user-base of would be community members. Maybe they are a 1.2x, maybe it's 5x. But there are at least a few.

## Stage 3 - Leverage Results

Start using the user-supplied data to expand Build Canada's mission. Add features that analyze the results. Use it when shaping future memos. Find more creative use-cases. Refine Build Canada's memo process to introduce more structured thinking with richer object models, supported by data.

With the data in place, content will now have high social proof, which should help with virality. This should get another 2x to 5x in distribution.

## Stage 4 - Convert Signals from Information to Monetary

This stage is where it all starts to become rational, and focuses on one question:

1. Will people click "I support + Donate"?
2. Will people click "I am against this memo, but generally support Build Canada? Here have a donation to BC."
3. Can contestable forms of governance be used with the above to ideas to allocate capital in order to accelerate BuildCanada's ambitions?

## Stage 5 - Mobilize the Community

With a flywheel of >1 ROAS (return on ad spend), from an engaged community, mobilization can be possible by re-investing in the community with guerilla tactics that are fun, rewarding, and positive NPV for Build Canada and Canada.
Loading