Add CLAUDE.md for Claude Code guidance#849
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
compwron
marked this pull request as ready for review
July 12, 2026 07:03
There was a problem hiding this comment.
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_IDblank-screen issue).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - `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. |
|
|
||
| ### Tests | ||
|
|
||
| - All backend specs: `make specs` (equivalently `script/backend rspec spec spec`). |
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. |
|
|
||
| ### 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. |
|
|
||
| ### 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. |
| ## 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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
CLAUDE.mdat the repo root to orient Claude Code (and human contributors) to the codebase.Highlights covered:
encrypted_user_idforeign key.makeworkflow,script/backendfor single specs, the three CI-enforced linters, background jobs, and Heroku deploy mechanics.FACEBOOK_APP_IDblank-screen issue).Docs only — no code changes.
🤖 Generated with Claude Code