This guide will walk you through setting up the application for development.
Make sure you have the following installed on your system:
- Ruby: Version
3.4.7(as specified in theDockerfile). We recommend using a version manager likerbenvorrvm. Project owner, @jsp, uses and recommendsmise. - Bundler:
gem install bundler - PostgreSQL: Version 15 is recommended.
- Redis: A running Redis server.
Alternative: Use Dev Containers (Recommended for quick setup)
If you have VS Code and Docker Desktop installed, you can use the included Dev Container configuration:
- Install VS Code and Docker Desktop
- Install the Dev Containers extension
- Open this project in VS Code
- Click "Reopen in Container" when prompted (or use Command Palette:
Dev Containers: Reopen in Container) - The container will automatically set up Ruby, PostgreSQL, Redis, and all dependencies
See .devcontainer/README.md for more details about the Dev Container setup.
-
Clone the repository:
git clone https://github.com/WITCodingClub/calendar-backend.git cd calendar-backend -
Install dependencies:
bundle install
-
Set up environment variables:
This project uses a
.env.examplefile to define required environment variables. Copy it to.envand fill in the values for your local setup.cp .env.example .env
Then, edit the
.envfile with your local configuration. -
Set up Rails credentials:
This project uses Rails encrypted credentials for storing sensitive configuration like Google OAuth credentials and Active Record encryption keys.
- Uses
config/credentials/development.yml.enc - Request
config/credentials/development.keyfrom @jsp
The credentials file should include:
- Google OAuth client ID and secret (for admin authentication)
- Active Record encryption keys (for encrypting OAuth tokens)
- Rate My Professor API credentials
- Any other third-party service credentials
Ask @jsp for the master key file to decrypt the credentials.
- Uses
-
Create and seed the database:
rails db:create rails db:migrate rails db:seed
-
Run the application:
bin/dev
This will start the web server, the background job worker, and the CSS watcher. You can access the application at
http://127.0.0.1:3000.Note: Make sure you have the credentials master key file at
config/credentials/development.keyto access encrypted credentials for Google OAuth and other services.