updates to CLAUDE.md

This commit is contained in:
Nuwan 2026-01-09 22:00:49 +05:30
parent c2a6e0f4d3
commit e86726c4fc
1 changed files with 11 additions and 62 deletions

View File

@ -6,8 +6,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
JamKazam is a real-time music collaboration platform with a service-oriented architecture:
**Historically the front end of this app was made using Ruby On Rails and React/Javascript. The React/Javascript front is rendered on the Rails views. The controllers basically serves the API end points which extracts data from the Model layer. The websocket gateway acts as a realtime data bridge between the front end and the backend. jam-ui is a newer version of the front end with more recent version of reactjs in which the Rails app operates as the backend API layer. Audio interface capabilities and audio data been sent to the front end by a native C++ client (a separate project) and the front end commiunicates with this native layer using a socket connection proxied by jamClient.* calls**
**Core Services:**
- **jam-ui**: React 16.x frontend SPA (port 4000)
- **jam-ui**: React 14.21.3 frontend SPA (port 4000)
- **web**: Rails 4.2.8 backend API (port 3000)
- **admin**: Rails 4.2.8 admin portal with ActiveAdmin
- **websocket-gateway**: EventMachine-based WebSocket server for real-time communication
@ -23,9 +25,9 @@ JamKazam is a real-time music collaboration platform with a service-oriented arc
- Background jobs: Resque with Redis
**Technology Stack:**
- Ruby 2.3.1 (pinned, with noted upgrade path to 2.5+)
- Ruby 2.4.1 (pinned, with noted upgrade path to 2.5+)
- Rails 4.2.8
- React 16.13.1
- React 14.21.3
- PostgreSQL
- Redis (Resque job queue)
- RabbitMQ (AMQP messaging)
@ -38,25 +40,10 @@ JamKazam is a real-time music collaboration platform with a service-oriented arc
**Local hosts configuration:**
```
127.0.0.1 www.jamkazam.local # Rails web app
127.0.0.1 beta.jamkazam.local # React app
```
**Database setup:**
```bash
createdb jam_ruby
cd ruby
bundle exec jam_db up --connopts=dbname:jam host:localhost user:postgres password:postgres
```
### Environment Configuration
Copy jam-ui environment example:
```bash
cd jam-ui
cp .env.development.example .env.development.local
# Edit .env.development.local with your local settings
127.0.0.1 www.jamkazam.local # Rails web app (web)
127.0.0.1 beta.jamkazam.local # React app (jam-ui)
```
**When executing Rails commands on MacOS Sillicon chip (m1, m2, ...) computers, use Gemfile.alt with bundler version 1.17.3. For exmaple to run the web server, use following command with the flags. BUNDLE_GEMFILE=Gemfile.alt MODERN_OS=1 JAM_RUBY_VERSION=2.4.1 bundle _1.17.3_ exec rails s -p 3000**
### Installing Dependencies
@ -104,6 +91,7 @@ npm install
**React frontend:**
```bash
cd jam-ui
nvm use #this set the node version specified in the .nvmrc
npm run start
# Runs on http://beta.jamkazam.local:4000
```
@ -170,6 +158,7 @@ cd websocket-gateway
# React frontend
cd jam-ui
nvm use
npm run build
```
@ -200,31 +189,10 @@ bundle exec rspec
# React tests
cd jam-ui
npx cypress run #Runs cypress tests
npm test # Runs Playwright tests
```
**JavaScript unit tests (legacy):**
```bash
# Start web server, then visit:
# http://localhost:3000/teaspoon
```
### Database Migrations
**Run migrations:**
```bash
cd ruby
./migrate.sh
```
**Create migration:**
Migrations use `pg_migrate` (not Rails migrations). Add new `.sql` files to `db/up/` directory.
**Reset database:**
```bash
./resetdb.sh
```
### Code Style
**SCSS compilation:**
@ -273,22 +241,3 @@ React app uses session-based authentication from Rails:
- Redirects to Rails sign-in if unauthenticated
## Important Notes
### Ruby Version Constraints
Many gems are pinned to support Ruby 2.3.1. Comments indicate "pinned until we are on ruby 2.5; then remove". When upgrading Ruby version, check Gemfiles for pinned versions to update.
### Memory Leak Prevention
The codebase has had memory leak issues. When working with:
- WebSocket listeners: Ensure proper cleanup in component unmount
- Global window objects: Avoid polluting global scope
- Event handlers: Always remove listeners on cleanup
### Build System
The project uses custom build scripts (`./build`, `./jenkins`) rather than standard Rails/npm conventions. These orchestrate builds across all services and handle packaging for deployment.
### Test Database
Uses PostgreSQL with `pg_migrate` for schema management. Database name is `jam` for development.