Exercism Website is a comprehensive Ruby on Rails application with React/TypeScript frontend that provides the main website for the Exercism platform. It's a complex application with multiple services, databases, and build processes.
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
There is a subdirectory called docs/context which contains detailed information that an LLM might find useful on different areas of the application. When working with specific components, always reference the RELEVANT docs in that directory first:
running-the-app.md- Complete guide for environment setup, dependencies, and running the applicationAPI.md- Detailed API architecture, authentication, and patternsSPI.md- Service Provider Interface for internal AWS servicescommands.md- Complete Command Pattern documentation with Mandate gem usageserializers.md- Data serialization patterns for JSON API responsesassemblers.md- Data assembly patterns for consistent API and SSR responsesview-components.md- Server-side component architecture with encapsulated logicreact-components.md- Client-side React component integration and data passingtesting/- Comprehensive testing patterns for models, commands, controllers, and system tests
These files provide comprehensive context that supplements the workflow guidance in this document.
For comprehensive guidance on environment setup, dependency installation, building assets, running tests, and starting the development server, see docs/context/running-the-app.md.
After making changes, ALWAYS test core functionality:
- Browse to http://localhost:3020
- Test user registration/login flow
- Navigate key sections (tracks, exercises, community)
- Test JavaScript interactions (code editor, modals)
- Verify CSS styling renders correctly
ALWAYS run before committing (for changed files only):
bundle exec rubocop --except Metrics
yarn test
bundle exec rails test:zeitwerk- Bundle install: 15-20 minutes - Native extensions for grpc, skylight, commonmarker take time
- Ruby test suite: 10-15 minutes - Full suite with database operations
- System tests: 15-20 minutes - Browser automation with Capybara/Selenium
- Asset builds: 2-5 minutes each - CSS and JavaScript compilation
- NPM Token required: Private package access needs
NPM_TOKENenvironment variable - AWS LocalStack: Required for S3, DynamoDB, and other AWS service mocking
- Database credentials: Must match config/database.yml settings
- Ruby 3.4.4: Exact version required - Gemfile.lock specifies this
- Node.js 20+: Required for esbuild and modern JS features
- MySQL 5.7: Database schema depends on this version
- Bundler 2.6.9: Locked version in Gemfile.lock
- Ruby version managers (setup-ruby and chruby) recommended for version management
- Some JS packages require private NPM access (will fail in some environments)
- Docker services must be running before Rails server starts
- Database must be properly configured with utf8mb4 collation
- Large codebase - initial setup can take 30+ minutes total
app/controllers/- Rails controllersapp/models/- ActiveRecord models and business logicapp/commands/- Mandate command objects for business logic (see Command Pattern below)app/javascript/- React/TypeScript frontend codeapp/css/- PostCSS stylesheets with Tailwindapp/views/- HAML view templatestest/- All test files (unit, integration, system)test/system/- Capybara system teststest/javascript/- Jest test files
Exercism uses the command pattern for most business logic operations. The /app/commands directory contains command objects that encapsulate business logic using the Mandate gem.
For comprehensive documentation on command structure, patterns, and implementation details, see docs/context/commands.md.
For detailed information about API and SPI architectures, see:
docs/context/API.md- API endpoints, authentication, and patternsdocs/context/SPI.md- Internal service endpoints and AWS integration
Public endpoints for authenticated users (CLI, frontend, third-party integrations)
- Require Bearer token authentication
- Delegate business logic to Mandate commands
- Consistent JSON error responses
- Routes defined in
config/routes/api.rb
Internal endpoints for AWS Lambda functions and microservices
- No application-level authentication (secured at AWS infrastructure level)
- Used by Lambda functions to post results back to main application
- Routes defined in
config/routes/spi.rb
Regular Rails routes for user-facing web pages, authentication flows, webhooks, and admin interfaces.
config/database.yml- Database configurationProcfile.dev- Development server orchestration.dockerimages.json- Docker service versionspackage.json- JavaScript dependencies and scriptsGemfile- Ruby dependencies
app/javascript/esbuild.js- JavaScript build configurationpostcss.config.js- CSS build configurationtailwind.config.js- Tailwind CSS customization
- Reset database:
bundle exec rails db:drop db:create db:migrate db:seed - Check migrations:
bundle exec rails db:migrate:status
- Clear assets:
rm -rf .built-assets/ - Rebuild:
yarn build:css && yarn build
- Check Docker services:
docker ps - Restart LocalStack:
docker restart <localstack-container-id> - Check AnyCable:
bundle exec anycable --version
- "Ruby version mismatch": Install Ruby 3.4.4 exactly
- "NPM authentication failed": Need NPM_TOKEN for private packages
- "Database connection failed": Check MySQL service and credentials
- "Asset compilation failed": Ensure Node.js and Yarn versions are compatible
This setup is complex but necessary for the full Exercism platform. When in doubt, refer to the CI configuration in .github/workflows/tests.yml for authoritative build commands and timing expectations.
There are tests for models, commands, controllers, and system testing - check the docs in docs/context/testing/... for comprehensive details when creating or amending tests.