# New rails projects

Use `rails new` -- do not try to create it manually. **Use rails generators whenever possible**. 

## Key configuration
Always use the following unless explicitly instructed otherwise:
1. postgres for the database
2. rspec for testing
3. sidekiq for jobs
4. kamal for deployment

Make things start using foreman, defining a Procfile.dev, eg:
```
web: rails s -b 0.0.0.0 -p 3000
worker: bundle exec sidekiq
redis: redis-server
vite: bin/vite dev
```

(redis is nice to start inline, rather than as a service)

## Recommended libraries
Apply these if relevant. Not all projects will need these, but most will.
1. [sidekiq-scheduler](https://github.com/sidekiq-scheduler/sidekiq-scheduler): cron-like recurring jobs for Sidekiq, such as nightly cleanup, polling, syncs, and reminders.
2. [sidekiq-unique-jobs](https://github.com/mhenrixon/sidekiq-unique-jobs): prevents duplicate Sidekiq jobs from being enqueued or run at the same time.
3. [colorize](https://github.com/fazibear/colorize): adds colored terminal output, useful for rake tasks, scripts, logs, and dev tooling.
4. [annotaterb](https://github.com/drwl/annotaterb): writes database schema comments into Rails models/specs so column names and types are visible in code.
5. vite-rails: integrates Vite with Rails for modern JS/CSS bundling, fast dev reloads, and frontend asset handling.
