Skip to content

Add CLAUDE.md for Claude Code guidance#849

Merged
compwron merged 1 commit into
masterfrom
add-claude-md
Jul 12, 2026
Merged

Add CLAUDE.md for Claude Code guidance#849
compwron merged 1 commit into
masterfrom
add-claude-md

Conversation

@compwron

Copy link
Copy Markdown
Collaborator

Summary

Adds a CLAUDE.md at the repo root to orient Claude Code (and human contributors) to the codebase.

Highlights covered:

  • The three deployable apps (Rails API, Ember web, Expo/React Native) and how to run/test/lint each.
  • The dual-database architecture: relational/reference data in PostgreSQL/ActiveRecord vs. user-generated data in MongoDB/Mongoid, linked by an encrypted encrypted_user_id foreign key.
  • Docker/make workflow, script/backend for single specs, the three CI-enforced linters, background jobs, and Heroku deploy mechanics.
  • Gotchas (Node 12 pin for Ember, FACEBOOK_APP_ID blank-screen issue).

Docs only — no code changes.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@compwron
compwron marked this pull request as ready for review July 12, 2026 07:03
Copilot AI review requested due to automatic review settings July 12, 2026 07:03
@compwron
compwron merged commit 0539810 into master Jul 12, 2026
13 checks passed
@compwron
compwron deleted the add-claude-md branch July 12, 2026 07:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new root-level CLAUDE.md intended to orient Claude Code (and contributors) to Flaredown’s monorepo layout, development workflow, and backend architecture.

Changes:

  • Document the three deployable apps (Rails backend, Ember frontend, Expo/React Native app) and common local commands (run/test/lint).
  • Summarize key backend architecture concepts (dual Postgres/MongoDB persistence, encrypted user linkage, API layer, background jobs).
  • Capture deployment and local-development gotchas (Node pinning, FACEBOOK_APP_ID blank-screen issue).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CLAUDE.md
- `frontend/` — Ember.js 2.18 web app (the production web client at app.flaredown.com), proxies API calls to the backend.
- `native/` — Expo / React Native + TypeScript app (newer, in-progress replacement for the Ember client).

The root `app/` directory is a stray remnant (single `g-recaptcha.js`), not a fourth app.
Comment thread CLAUDE.md

### Tests

- All backend specs: `make specs` (equivalently `script/backend rspec spec spec`).
Comment thread CLAUDE.md
Comment on lines +46 to +49
- **PostgreSQL (ActiveRecord)** — relational/reference data: `User` (Devise auth), `Condition`, `Symptom`, `Treatment`, `Food`, `Tag`, `Profile`, `Weather`, and the `user_*` join tables. These models subclass `ActiveRecord::Base` and carry a `# == Schema Information` header. Schema lives in `db/schema.rb` + `db/structure.sql`; migrations in `db/migrate/`.
- **MongoDB (Mongoid 8)** — high-volume, user-generated, schemaless data: `Checkin` (the core daily symptom/treatment/tag log), `Comment`, `Reaction`, `Pattern`, `Notification`, `HarveyBradshawIndex`, `Feedback`, `PromotionRate`, `OracleRequest`. These `include Mongoid::Document`. Config in `config/mongoid.yml`.

The two stores are linked by an **encrypted foreign key**: Mongo documents store `encrypted_user_id` (symmetric-encryption gem, see `config/symmetric-encryption.yml`) rather than a plain `user_id`, and dereference it back to the Postgres `User`. When querying check-in data by user, filter on `encrypted_user_id`, not `user_id`. `Checkin` embeds condition/symptom/treatment sub-documents inline.
Comment thread CLAUDE.md

### API layer

Versioned JSON API under `app/controllers/api/v1/`, routed via `namespace :api { scope module: :v1 }` in `config/routes.rb`. Serialization uses `active_model_serializers` 0.9 (`app/serializers/`). Auth is Devise + `devise_invitable` + Facebook OmniAuth; authorization is CanCanCan with a Mongoid adapter (`app/models/ability.rb`). Business logic lives in `app/services/` (e.g. `weather_retriever`, `pattern_creator`, `chart_list_service`) — controllers should stay thin.
Comment thread CLAUDE.md

### Background work

Sidekiq (`config/sidekiq.yml`, `worker` process in `Procfile`) backed by Redis, with jobs in `app/jobs/` (check-in reminders, data exports, notification dispatch, top-posts mailers). Recurring schedules are defined in `config/cronotab.rb` (Crono) and rake tasks under `lib/tasks/` invoked by Heroku Scheduler.
Comment thread CLAUDE.md
## Gotchas

- Node is pinned to **12.22.6** for the Ember frontend (`.tool-versions`); the native app uses a modern toolchain independently. Don't assume one Node version across the repo.
- Env files: `cp backend/env-example backend/.env` and `cp backend/env-example frontend/.env`. A `FACEBOOK_APP_ID` is needed in `frontend/.env` or the app renders a blank beige screen on first load (see README "Common Problems" for the workaround).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants