This is a Ruby on Rails application. It includes:
- U.S. Web Design System (USWDS) for themeable styling and a set of common components
- Custom USWDS form builder
- Integration with AWS services, including
- Database integration with AWS RDS Postgresql using UUIDs
- Active Storage configuration with AWS S3
- Action Mailer configuration with AWS SES
- Authentication with devise and AWS Cognito
- Internationalization (i18n)
- Authorization using pundit
- Linting and code formatting using rubocop
- Testing using rspec
As a Rails app, much of the directory structure is driven by Rails conventions. We've also included directories for common patterns, such as adapters, form objects and services.
Refer to the Software Architecture doc for more detail.
Below are the primary directories to be aware of when working on the app:
├── app
│ ├── adapters # External services
│ │ └── *_adapter.rb
│ ├── controllers
│ ├── forms # Form objects
│ │ └── *_form.rb
│ ├── mailers
│ ├── models
│ │ └── concerns
│ ├── services # Shared cross-model business logic
│ │ └── *_service.rb
│ └── views
├── db
│ ├── migrate
│ └── schema.rb
├── config
│ ├── locales # i18n
│ └── routes.rb
├── spec # Tests
- A container runtime (e.g. Docker or Finch)
- By default,
dockeris used. To change this, set theCONTAINER_CMDvariable tofinch(or whatever your container runtime is) in the shell.
- By default,
- An AWS account with a Cognito User Pool and App Client configured
- By default, the application configures authentication using AWS Cognito
You can run the app within a container or natively. Each requires slightly different setup steps.
In either case, first generate a .env file:
- Run
make .envto create a.envfile based on shared template. - Variables marked with
<FILL ME IN>need to be manually set, and otherwise edit to your needs.
make init-container
Prerequisites:
- Ruby version matching
.ruby-version - Node LTS
- (Optional but recommended): rbenv
Steps:
make init-native
Once you've completed the setup steps above, you can run the site natively or within a container runtime.
To run within a container:
make start-container- Then visit http://localhost:3100
To run natively:
make start-native- Then visit http://localhost:3100
For local development (without AWS Cognito credentials), you can use local login via Devise. To enable local login:
-
Set Rails environment to development:
RAILS_ENV=development
-
Enable Devise in development by setting the environment variable::
USE_DEVISE=true
-
Set up the database (run migrations)::
rails db:migrate
-
Follow the instructions for starting a container then start it::
make start-container
-
Visit the sign-up page: Go to http://localhost:3100/users/sign_up and register with any email and password.::
Beyond this README, you should also refer to the docs/app-rails directory for more detailed info. Some highlights: