Skip to content
Merged
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
8 changes: 8 additions & 0 deletions apps/api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ STUDENT_PROFILE_URL=http://localhost:3000
# GOOGLE_CLIENT_ID=
# GOOGLE_CLIENT_SECRET=
# GOOGLE_MAPS_API_KEY=
# Slack (internal/staff workspace) — Bot User OAuth Token must be xoxb-
# INTERNAL_SLACK_BOT_TOKEN=
# INTERNAL_SLACK_NOTIFICATIONS_CHANNEL_ID=
# LINKEDIN_CLIENT_ID=
Expand All @@ -41,13 +42,20 @@ STUDENT_PROFILE_URL=http://localhost:3000
# R2_PUBLIC_BUCKET_URL=
# R2_SECRET_ACCESS_KEY=
# SENTRY_DSN=
# Slack — token type matters (see docs/how-to-enable-integrations.md#slack).
# SLACK_ADMIN_TOKEN = User OAuth Token (xoxp-), workspace admin, NOT the bot token
# SLACK_BOT_TOKEN = Bot User OAuth Token (xoxb-)
# SLACK_SIGNING_SECRET = Basic Information → Signing Secret (no xox prefix)
# Channel IDs look like C… / team ID like T… / profile fields like Xf…
# SLACK_ADMIN_TOKEN=
# SLACK_BIRTHDATE_FIELD_ID=
# SLACK_BIRTHDAYS_CHANNEL_ID=
# SLACK_BOT_TOKEN=
# SLACK_CLIENT_ID=
# SLACK_CLIENT_SECRET=
# SLACK_EMOJI_CHANNEL_ID=
# SLACK_FEED_CHANNEL_ID=
# SLACK_MEMBER_DIRECTORY_FIELD_ID=
# SLACK_SIGNING_SECRET=
# SMTP_HOST=
# SMTP_PASSWORD=
Expand Down
4 changes: 4 additions & 0 deletions apps/member-profile/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ STUDENT_PROFILE_URL=http://localhost:3000
# R2_PUBLIC_BUCKET_URL=
# R2_SECRET_ACCESS_KEY=
# SENTRY_DSN=
# Slack — token type matters (see docs/how-to-enable-integrations.md#slack).
# SLACK_BOT_TOKEN = Bot User OAuth Token (xoxb-), same value as apps/api
# SLACK_TEAM_ID = workspace ID (T…)
# Channel IDs look like C…
# SLACK_ANNOUNCEMENTS_CHANNEL_ID=
# SLACK_BOT_TOKEN=
# SLACK_CLIENT_ID=
Expand Down
96 changes: 96 additions & 0 deletions docs/architecture-and-environments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Architecture, Environments & Maintenance

This document covers what each app does, how local development differs from
production, and the day-to-day maintenance workflows (migrations, queue
inspection). For integration details, see
[`integrations-overview.md`](./integrations-overview.md). For feature flags,
see [`feature-flags.md`](./feature-flags.md). For known risks, see
[`handoff-known-considerations.md`](./handoff-known-considerations.md).

## Core services

Oyster is a Turborepo monorepo with three deployable apps sharing a
`packages/core` business-logic layer.

### `apps/member-profile`

The member-facing app. This is where ColorStack members manage their
profile, browse/apply to opportunities, use the "Ask AI" Slack chatbot
integration, do resume reviews, track gamification points, and go through
onboarding. Runs 2 replicas in production.

### `apps/admin-dashboard`

The internal ops tool used by the ColorStack team — reviewing member
applications, managing companies/schools, running events, editing gamification
activities, managing feature flags, and inspecting/managing BullMQ queues
directly (`/bull` route, owner-role only). This is the main place an
engineer would go to operate the system without touching the database or
Redis directly.

### `apps/api`

No user-facing UI. Runs all background job processing (BullMQ workers) and
handles webhook callbacks from external services (e.g. the LinkedIn/Google
OAuth callback, Slack events). Runs 3 replicas in production — this is the
service most directly implicated in the BullMQ outage documented in
`handoff-known-considerations.md`, since more replicas means more workers
pulling from the same queues.

### `packages/core`

Shared business logic used by all three apps — this is where most feature
code actually lives (modules like `slack/`, `apify.ts`, `location/`,
`notifications/`, etc., referenced throughout `integrations-overview.md`).

## Environments

| | Local development | Production |
|---|---|---|
| Postgres | Docker container (`docker-compose.yml`), port 5433, throwaway data | Railway-managed Postgres |
| Redis | Docker container, port 6380 | Railway-managed Redis (`roundhouse.proxy.rlwy.net` per last incident review) |
| Apps | Run directly via `bun dev` on your machine | Deployed to Railway, 1 service per app |
| Auth | OTP login is bypassed — any 6-digit code works | Real OTP delivery via Postmark/SMTP |
| Integrations | Mostly unconfigured by default (see `.env.example` files); only enable what a feature you're working on needs | Fully configured (assuming credentials are valid — some are unverified, see `integrations-overview.md`) |

Full local setup steps are in [`CONTRIBUTING.md`](../CONTRIBUTING.md)
("Getting Started") — `bun install` → `bun env:setup` → `bun dx:up` →
`bun db:migrate` → `bun db:seed` → `bun dev`. There's also a `postgres-test`
container (port 5434) used for the test suite, separate from the dev
database.

## Deployment

All three apps deploy to **Railway**, auto-triggered on push to `main` — there
is no separate staging environment visible in the repo's config
(`apps/*/railway.json`). Each app's `railway.json` defines its build command
(which includes running `bun db:migrate` against `DATABASE_PUBLIC_URL` as
part of the build step) and start command. Since migrations run as part of
every app's build, **a migration only needs to exist in one deploy** — it'll
run whichever app happens to build/deploy first after being merged.

## Maintenance workflows

- **Running a migration:** `bun db:migrate` locally; in production this
happens automatically as part of the Railway build step above. See
[`how-to-implement-a-database-migration.md`](./how-to-implement-a-database-migration.md)
for how to write one.
- **Inspecting/managing BullMQ queues:** the admin dashboard has a built-in
UI for this at `/bull` (owner role required) — lists queues, lets you view
individual jobs, manually add jobs, and manage repeatable jobs
(`apps/admin-dashboard/app/routes/_dashboard.bull.*`). This is the
first place to check when investigating the job backlog described in
`handoff-known-considerations.md`, rather than needing direct Redis
access.
- **Inspecting the database directly:** `bun prisma:studio` opens Prisma
Studio against your local database for browsing/editing rows.
- **Feature flags:** stored in Postgres, toggled at `/feature-flags` (owner
role). See [`feature-flags.md`](./feature-flags.md) for what each name
actually gates.
## Cross-references

- Local dev setup (already documented): [`CONTRIBUTING.md`](../CONTRIBUTING.md)
- Integration details: [`integrations-overview.md`](./integrations-overview.md)
- Feature flags: [`feature-flags.md`](./feature-flags.md)
- Slack setup (tokens, events, Redis session): [`how-to-enable-integrations.md`](./how-to-enable-integrations.md#slack)
- Known risks/escalation areas: [`handoff-known-considerations.md`](./handoff-known-considerations.md)
60 changes: 60 additions & 0 deletions docs/feature-flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Feature Flags

Feature flags live in Postgres (`feature_flags`), not in env vars or a
third-party service. Toggle them in the **Admin Dashboard → Feature Flags**
(`/feature-flags`, owner role).

The **Name** field must match the snake_case string in the tables below
exactly (`send_slack_messages`, not `Send Slack Messages`). Display name and
description are UI-only.

Seed data does **not** insert these rows. A fresh local DB has none, so every
flag is off until you create it and enable it.

`isFeatureFlagEnabled`
(`packages/core/src/modules/feature-flags/queries/is-feature-flag-enabled.ts`)
returns `false` if the row is missing or `enabled` is false.

The allowed names live in
`packages/core/src/modules/feature-flags/feature-flags.types.ts`
(`FeatureFlagName`).

## Flags the code actually checks

| Name | When **on** | When **off** | Code |
|---|---|---|---|
| `send_slack_messages` | `chat.postMessage` and `chat.postEphemeral` actually send (community + internal workspaces) | Those helpers return immediately — **silent no-op**. Slack tokens can be valid and nothing posts | `packages/core/src/modules/notifications/use-cases/send-slack-notification.ts`, `send-ephemeral-slack-notification.ts` |
| `slack_emoji_updates` | New custom emoji events post to `SLACK_EMOJI_CHANNEL_ID` | Emoji-added jobs do nothing | `packages/core/src/modules/slack/use-cases/send-emoji-update.ts` |
| `family_application` | Public ColorStack application (`/apply`) is open | Applicants see "application is temporarily closed" | `apps/member-profile/app/routes/_public.apply.tsx` |
| `points_page` | "Points" appears in the member-profile sidebar | Nav link is hidden. `/points` is **not** blocked if someone hits the URL | `apps/member-profile/app/routes/_profile.tsx` |

For local Slack work, you almost always need `send_slack_messages` created and
enabled. Without it, bot replies, feed alerts, birthday posts, and internal
ops notifications will not send.

## Names in the type union that are not checked

These exist on `FeatureFlagName` but **no** `isFeatureFlagEnabled(...)` call
uses them. Creating/enabling them in the admin UI does nothing today:

| Name | Likely original intent | What actually happens |
|---|---|---|
| `chatbot` | Gate Ask AI / Slack DM chatbot | `/ask-ai` and Slack chatbot jobs always run (Slack answers still need `send_slack_messages` to post) |
| `compensation` | Gate the Offers page | Offers nav and `/offers` are always available |
| `peer_help` | Gate Peer Help | Peer Help nav and `/peer-help` are always available |

Do not assume toggling these three will hide a feature.

## How to create one locally

1. Log into the admin dashboard as an **owner**.
2. Open `/feature-flags` → **Create Flag**.
3. Set **Name** to one of the snake_case values above.
4. Leave it enabled if you want the feature on.

## Cross-references

- Slack tokens, events, and Redis session:
[`how-to-enable-integrations.md`](./how-to-enable-integrations.md#slack)
- Architecture and admin tooling:
[`architecture-and-environments.md`](./architecture-and-environments.md)
89 changes: 89 additions & 0 deletions docs/handoff-known-considerations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Key Dependencies, Known Technical Considerations & Escalation Areas

This document is intended for the incoming team taking over Oyster
development. It covers what the codebase depends on, what has caused problems
in the past, and what to be careful with as usage grows (particularly with
the planned student-contribution feature).

## Key Dependencies

### Runtime & data layer

- **Node.js / Bun** — Bun is used for scripts and package management; apps run
on Node.
- **TypeScript** across the whole monorepo (Turborepo-managed workspaces).
- **PostgreSQL** — primary datastore, queried via **Kysely** (type-safe SQL
builder, not a full ORM). Migrations live in `packages/db`.
- **Redis** — backs **BullMQ**, which handles all background/async job
processing (emails, Slack sync, onboarding, gamification, etc.).

### Hosting

- **Railway** hosts all three apps (`api`, `admin-dashboard`, `member-profile`)
plus the Postgres and Redis instances. Deploys are automatic on push to
`main` — there is no separate staging gate visible in the repo config
(`apps/*/railway.json`). `api` runs 3 replicas, `member-profile` runs 2.

### External integrations

| Service | Purpose | Status |
|---|---|---|
| Airmeet | Virtual events | Documented, active |
| Airtable | CRM (event registrations, family/members) | Documented, active |
| Cloudflare R2 | Object storage | Documented, active |
| Google OAuth | Authentication | Documented, active |
| Mailchimp | Email marketing | Documented, active |
| Pinecone | Vector database | Documented, active |
| Slack | Community home + auth + internal notifications | Documented, active — setup is credential-type-sensitive (see below) |
| Sentry | Error monitoring | Documented, optional |
| Anthropic / OpenAI / Cohere | AI features (e.g. resume review) | Env vars present, not in the integrations doc — confirm which are live in prod |
| Apify, Google Maps, LinkedIn, Mixpanel, Postmark, SMTP, Twilio | Various | Env vars present in `apps/api/.env.example` but undocumented — likely partial/legacy; **confirm which are actually load-bearing in production before assuming any are safe to ignore** |

The last group above is the biggest documentation gap: they have config
surface but no write-up in `docs/how-to-enable-integrations.md`, so their
current production status needs to be confirmed directly with the outgoing
team rather than assumed from the code alone.

## Known Technical Considerations

- **Slack credentials are not one key.** Production needs a bot token
(`xoxb-` → `SLACK_BOT_TOKEN`), a workspace-admin *user* token (`xoxp-` →
`SLACK_ADMIN_TOKEN`), a signing secret, and OpenID client id/secret. Putting
the bot token in `SLACK_ADMIN_TOKEN` (or using an `xapp-` Socket Mode token)
is the usual failure mode. See
[`how-to-enable-integrations.md`](./how-to-enable-integrations.md#slack).
- **Slack invite / deactivate depends on a browser session, not the Slack
app.** `users.admin.invite` / `setInactive` / `setRegular` read
`slack:legacy_token` (`xoxc-`) and `slack:legacy_cookie` from Redis. Nothing
in the codebase writes those keys, and they die when the admin's Slack web
session expires — invites can stop working with no env-var change. Confirm
with the outgoing team how those Redis keys are currently populated and
rotated.

## Known Issues / Candidate Follow-Up Work
as of September 29, 2026
These are not outage-level, but they make day-to-day use annoying. Flag them
during handoff so the new team can decide what to fix first.

- **Admin dashboard error handling** — some failures surface as an
unhandled 500 / crash rather than a friendly error state. A common case
is missing env vars: in development those keys are optional so the app
still boots, but hitting a screen that needs them (resume books →
Airtable / Google Drive, GitHub contributors → `GITHUB_TOKEN`, student
Airtable links, etc.) throws instead of saying the integration isn't
configured. Worth an audit of error boundaries across
`apps/admin-dashboard` routes.
- **Stale UI state after mutations** — some admin actions don't reflect
their result until the page is manually reloaded, suggesting a loader/data
revalidation isn't being triggered after certain form submissions or
actions.
- **"Ask AI" feature reliability** — the member-profile Ask AI feature
(`apps/member-profile/app/routes/_profile.ask-ai.tsx`, live at
`/ask-ai`) works correctly roughly 90% of the time; the remaining failure
cases haven't been root-caused yet.

## Areas That May Require Escalation

- **Worker health monitoring** — currently absent; needs design input before
scaling job volume.

Loading
Loading