fix: update documentation and configuration files
This commit is contained in:
+84
-105
@@ -4,7 +4,7 @@ A comprehensive tournament management and partnership analytics system for the c
|
||||
|
||||
## Overview
|
||||
|
||||
EuchreCamp is a full-stack Ruby web application built with Hanami 2.1 that provides:
|
||||
EuchreCamp is a full-stack web application built with Next.js 14+ and TypeScript that provides:
|
||||
|
||||
- **Tournament Management**: Create and manage round-robin, single elimination, double elimination, and Swiss-style tournaments
|
||||
- **Partnership Analytics**: Track partnership performance, win rates, and Elo changes between players
|
||||
@@ -16,10 +16,8 @@ EuchreCamp is a full-stack Ruby web application built with Hanami 2.1 that provi
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Ruby 3.3.3 (managed by mise or rbenv)
|
||||
- Node.js 22+ (for asset compilation)
|
||||
- Node.js 20+ (managed by mise or nvm)
|
||||
- SQLite3
|
||||
- Bundler
|
||||
|
||||
### Installation
|
||||
|
||||
@@ -33,26 +31,20 @@ cd euchre_camp
|
||||
2. **Install dependencies:**
|
||||
|
||||
```bash
|
||||
bundle install
|
||||
npm install
|
||||
```
|
||||
|
||||
3. **Set up the database:**
|
||||
|
||||
```bash
|
||||
bundle exec rake db:migrate
|
||||
npx prisma migrate deploy
|
||||
npx prisma generate
|
||||
```
|
||||
|
||||
4. **Compile assets:**
|
||||
4. **Start the development server:**
|
||||
|
||||
```bash
|
||||
./node_modules/.bin/esbuild app/assets/css/app.css --bundle --outfile=public/assets/app-GVDAEYEC.css
|
||||
```
|
||||
|
||||
5. **Start the server:**
|
||||
|
||||
```bash
|
||||
bundle exec puma -p 3000 -e development
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Accessing the Application
|
||||
@@ -60,7 +52,8 @@ bundle exec puma -p 3000 -e development
|
||||
- **Main Page**: http://localhost:3000
|
||||
- **Admin Dashboard**: http://localhost:3000/admin
|
||||
- **Rankings**: http://localhost:3000/rankings
|
||||
- **Login**: http://localhost:3000/login
|
||||
- **Login**: http://localhost:3000/auth/login
|
||||
- **Registration**: http://localhost:3000/auth/register
|
||||
|
||||
## Development
|
||||
|
||||
@@ -68,27 +61,23 @@ bundle exec puma -p 3000 -e development
|
||||
|
||||
```
|
||||
euchre_camp/
|
||||
├── app/
|
||||
│ ├── actions/ # Hanami actions (controllers)
|
||||
│ ├── assets/ # CSS, JavaScript, images
|
||||
│ ├── repositories/ # ROM repositories for data access
|
||||
│ ├── services/ # Business logic (Elo calculator, partnership tracker)
|
||||
│ ├── templates/ # ERB view templates
|
||||
│ ├── views/ # Hanami view objects
|
||||
│ └── action.rb # Base action class with auth helpers
|
||||
├── config/
|
||||
│ ├── routes.rb # Application routes
|
||||
│ ├── app.rb # Hanami app configuration
|
||||
│ └── assets.js # Asset compilation configuration
|
||||
├── db/
|
||||
│ ├── migrate/ # Database migrations
|
||||
│ └── euchre_camp.db # SQLite database
|
||||
├── lib/
|
||||
│ └── euchre_camp/ # Domain models and entities
|
||||
├── spec/
|
||||
│ └── acceptance/ # RSpec acceptance tests
|
||||
└── public/
|
||||
└── assets/ # Compiled assets
|
||||
├── src/
|
||||
│ ├── app/ # Next.js App Router pages and routes
|
||||
│ │ ├── auth/ # Authentication pages (login, register)
|
||||
│ │ ├── admin/ # Admin dashboard and management
|
||||
│ │ ├── players/ # Player profiles and schedules
|
||||
│ │ ├── rankings/ # Player rankings page
|
||||
│ │ └── api/ # API routes
|
||||
│ ├── components/ # React components
|
||||
│ ├── lib/ # Utilities and configurations
|
||||
│ │ ├── auth.ts # Better Auth configuration
|
||||
│ │ ├── prisma.ts # Prisma client
|
||||
│ │ └── auth-client.ts
|
||||
│ └── __tests__/ # Vitest and Playwright tests
|
||||
├── prisma/
|
||||
│ └── schema.prisma # Database schema
|
||||
├── public/ # Static assets
|
||||
└── package.json # Dependencies and scripts
|
||||
```
|
||||
|
||||
### Running the Application
|
||||
@@ -96,13 +85,14 @@ euchre_camp/
|
||||
**Development mode (with auto-reload):**
|
||||
|
||||
```bash
|
||||
bundle exec puma -p 3000 -e development
|
||||
npm run dev
|
||||
```
|
||||
|
||||
**Production mode:**
|
||||
|
||||
```bash
|
||||
bundle exec puma -p 3000 -e production
|
||||
npm run build
|
||||
npm start
|
||||
```
|
||||
|
||||
### Database Management
|
||||
@@ -110,54 +100,56 @@ bundle exec puma -p 3000 -e production
|
||||
**Run migrations:**
|
||||
|
||||
```bash
|
||||
bundle exec rake db:migrate
|
||||
npx prisma migrate deploy
|
||||
```
|
||||
|
||||
**Rollback last migration:**
|
||||
**Generate Prisma client:**
|
||||
|
||||
```bash
|
||||
bundle exec rake db:migrate[<version>]
|
||||
npx prisma generate
|
||||
```
|
||||
|
||||
**Reset database:**
|
||||
|
||||
```bash
|
||||
bundle exec rake db:reset
|
||||
npx prisma migrate reset
|
||||
```
|
||||
|
||||
**Open Prisma Studio:**
|
||||
|
||||
```bash
|
||||
npx prisma studio
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
**Run all acceptance tests:**
|
||||
**Run unit tests:**
|
||||
|
||||
```bash
|
||||
bundle exec rspec spec/acceptance/
|
||||
npm run test
|
||||
```
|
||||
|
||||
**Run specific test:**
|
||||
**Run unit tests in watch mode:**
|
||||
|
||||
```bash
|
||||
bundle exec rspec spec/acceptance/tournament_partnership_spec.rb:280
|
||||
npm run test:run
|
||||
```
|
||||
|
||||
**Run with documentation:**
|
||||
**Run acceptance tests:**
|
||||
|
||||
```bash
|
||||
bundle exec rspec spec/acceptance/ --format documentation
|
||||
npm run test:acceptance
|
||||
```
|
||||
|
||||
**Run Playwright mobile responsiveness tests:**
|
||||
**Run acceptance tests in headed mode:**
|
||||
|
||||
```bash
|
||||
# Start the server
|
||||
bundle exec hanami server --port 2300 &
|
||||
|
||||
# Run Playwright tests
|
||||
bundle exec rspec spec/playwright/mobile_responsiveness_spec.rb
|
||||
npm run test:acceptance:headed
|
||||
```
|
||||
|
||||
**Test with Playwright MCP (browser automation):**
|
||||
|
||||
1. Start the Hanami server: `bundle exec hanami server --port 2300`
|
||||
1. Start the development server: `npm run dev`
|
||||
2. Use opencode with Playwright MCP tools to:
|
||||
- Navigate to pages
|
||||
- Take screenshots
|
||||
@@ -166,17 +158,7 @@ bundle exec rspec spec/playwright/mobile_responsiveness_spec.rb
|
||||
|
||||
### Assets
|
||||
|
||||
**Compile CSS for development:**
|
||||
|
||||
```bash
|
||||
./node_modules/.bin/esbuild app/assets/css/app.css --bundle --outfile=public/assets/app-GVDAEYEC.css
|
||||
```
|
||||
|
||||
**Watch for changes (requires separate process):**
|
||||
|
||||
```bash
|
||||
./node_modules/.bin/esbuild app/assets/css/app.css --bundle --outfile=public/assets/app-GVDAEYEC.css --watch
|
||||
```
|
||||
**CSS is handled by Tailwind CSS** with automatic compilation during development.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -259,12 +241,12 @@ The admin dashboard provides:
|
||||
To create an admin user, use the provided script:
|
||||
|
||||
```bash
|
||||
ruby scripts/create_admin.rb <email> <password>
|
||||
node scripts/create-admin.js <email> <password>
|
||||
```
|
||||
|
||||
**Example:**
|
||||
```bash
|
||||
ruby scripts/create_admin.rb david@dhg.lol admin
|
||||
node scripts/create-admin.js admin@example.com mypassword
|
||||
```
|
||||
|
||||
This will:
|
||||
@@ -272,21 +254,11 @@ This will:
|
||||
2. Create a user account with `club_admin` role
|
||||
3. Mark the account as confirmed
|
||||
|
||||
**Manual SQL Alternative:**
|
||||
**Using Better Auth CLI:**
|
||||
|
||||
If you prefer to create users manually via SQL:
|
||||
|
||||
1. Access the database: `sqlite3 db/euchre_camp.db`
|
||||
2. Generate a BCrypt password hash:
|
||||
```bash
|
||||
ruby -e "require 'bcrypt'; puts BCrypt::Password.create('your_password')"
|
||||
```
|
||||
3. Insert a user record:
|
||||
```sql
|
||||
INSERT INTO players (name, rating) VALUES ('PlayerName', 1000);
|
||||
INSERT INTO users (player_id, email, password_digest, role, confirmed, created_at, updated_at)
|
||||
VALUES (1, 'user@example.com', '$2b$12$...', 'club_admin', 1, datetime('now'), datetime('now'));
|
||||
```
|
||||
```bash
|
||||
npx better-auth cli
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
@@ -434,7 +406,7 @@ sqlite> SELECT * FROM users;
|
||||
|
||||
1. Create a feature branch: `git checkout -b feature/your-feature`
|
||||
2. Make changes to code
|
||||
3. Run tests: `bundle exec rspec spec/acceptance/`
|
||||
3. Run tests: `npm run test` (unit tests) or `npm run test:acceptance` (acceptance tests)
|
||||
4. Commit with conventional commit message
|
||||
5. Push to remote: `git push origin feature/your-feature`
|
||||
6. Create pull request
|
||||
@@ -461,10 +433,10 @@ Types:
|
||||
### Code Style
|
||||
|
||||
- Follow existing code patterns in the project
|
||||
- Use ROM (Ruby Object Mapper) for database access
|
||||
- Keep business logic in services
|
||||
- Use dependency injection in actions
|
||||
- Write acceptance tests for new features
|
||||
- Use Prisma ORM for database access
|
||||
- Keep business logic in lib/ directory
|
||||
- Use React Server Components where appropriate
|
||||
- Write unit tests (Vitest) and acceptance tests (Playwright) for new features
|
||||
|
||||
## Deployment
|
||||
|
||||
@@ -473,27 +445,28 @@ Types:
|
||||
1. **Set production environment variables:**
|
||||
|
||||
```bash
|
||||
export HANAMI_ENV=production
|
||||
export DATABASE_URL=sqlite:///path/to/prod.db
|
||||
export SESSION_SECRET=<secure-random-string>
|
||||
export NODE_ENV=production
|
||||
export DATABASE_URL=file:./dev.db
|
||||
export BETTER_AUTH_SECRET=<secure-random-string>
|
||||
export BETTER_AUTH_URL=http://localhost:3000
|
||||
```
|
||||
|
||||
2. **Compile assets for production:**
|
||||
2. **Build the application:**
|
||||
|
||||
```bash
|
||||
./node_modules/.bin/esbuild app/assets/css/app.css --bundle --outfile=public/assets/app-GVDAEYEC.css
|
||||
npm run build
|
||||
```
|
||||
|
||||
3. **Run migrations:**
|
||||
|
||||
```bash
|
||||
bundle exec rake db:migrate
|
||||
npx prisma migrate deploy
|
||||
```
|
||||
|
||||
4. **Start server:**
|
||||
|
||||
```bash
|
||||
bundle exec puma -p 3000 -e production
|
||||
npm start
|
||||
```
|
||||
|
||||
### Using a Process Manager
|
||||
@@ -509,8 +482,8 @@ After=network.target
|
||||
Type=simple
|
||||
User=deploy
|
||||
WorkingDirectory=/var/www/euchre_camp
|
||||
Environment=HANAMI_ENV=production
|
||||
ExecStart=/usr/local/bin/bundle exec puma -C config/puma.rb
|
||||
Environment=NODE_ENV=production
|
||||
ExecStart=/usr/local/bin/npm start
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
@@ -520,7 +493,7 @@ WantedBy=multi-user.target
|
||||
**Using PM2 (Node.js):**
|
||||
|
||||
```bash
|
||||
pm2 start bundle exec -- puma -C config/puma.rb
|
||||
pm2 start npm --name "euchre-camp" -- start
|
||||
```
|
||||
|
||||
## Contributing
|
||||
@@ -538,15 +511,21 @@ MIT License - see LICENSE file for details
|
||||
## Credits
|
||||
|
||||
Built with:
|
||||
- Hanami 2.1
|
||||
- ROM (Ruby Object Mapper)
|
||||
- SQLite3
|
||||
- RSpec
|
||||
- Puma
|
||||
- Next.js 14+ (App Router)
|
||||
- TypeScript
|
||||
- Tailwind CSS
|
||||
- Prisma ORM
|
||||
- Better Auth
|
||||
- Vitest
|
||||
- Playwright
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Hanami Documentation](https://guides.hanamirb.org/)
|
||||
- [ROM Documentation](https://rom-rb.org/)
|
||||
- [RSpec Documentation](https://rspec.info/)
|
||||
- [Next.js Documentation](https://nextjs.org/docs)
|
||||
- [TypeScript Documentation](https://www.typescriptlang.org/docs/)
|
||||
- [Tailwind CSS Documentation](https://tailwindcss.com/docs)
|
||||
- [Prisma Documentation](https://www.prisma.io/docs)
|
||||
- [Better Auth Documentation](https://better-auth.com/docs)
|
||||
- [Vitest Documentation](https://vitest.dev/)
|
||||
- [Playwright Documentation](https://playwright.dev/)
|
||||
- [Euchre Rules](https://www.pagat.com/euchre/euchre.html)
|
||||
|
||||
Reference in New Issue
Block a user