# 🌱 Growstuff ![Build status](https://github.com/Growstuff/growstuff/workflows/CI/badge.svg) Welcome to the Growstuff project. You can find our app at https://www.growstuff.org Growstuff is an open source/open data project for food gardeners. We crowdsource information on what our members are growing and harvesting, aggregate it, and make it available as open data via our API. Growstuff was founded in 2012 and has been built by dozens of [contributors](CONTRIBUTORS.md). We are an inclusive, welcoming project, and encourage participation from people of all backgrounds and skill levels. ## Want to contribute? Don't ask to ask, the best way to get started is to fork the project, start a codespace and get hacking. Dive on in and submit your PRs! Vibe Coding is more than okay, just make sure you indicate if you have done so and ensure there are tests. ## Important links * [Issues](https://github.com/orgs/Growstuff/projects/1) (features we're working on, known bugs, etc) * [Wiki](https://github.com/Growstuff/growstuff/wiki) (general documentation, etc.) ## For coders Growstuff is built in Ruby on Rails and also uses JavaScript for frontend features. We welcome contributions -- see [CONTRIBUTING](CONTRIBUTING.md) for details. * To set up your development environment, see [Getting started](https://github.com/Growstuff/growstuff/wiki/New-contributor-guide). * You may also be interested in our [API](https://github.com/Growstuff/growstuff/wiki/API). ### Running Rails natively against Dockerized services If you'd rather run `rails server` directly on your machine (instead of inside the `web` container) while still using Docker for Postgres, here's the full setup: 1. **Get the pinned Ruby and Node versions.** [`mise.toml`](mise.toml) pins both (matching `.ruby-version` and the Node 24 used in CI). If you use [mise](https://mise.jdx.dev/), just run: ```bash mise install ``` rbenv/asdf/nvm users can read the versions from `mise.toml` (or `.ruby-version`) and install them the usual way instead. 2. **Start the backing services** (Postgres, skipping the `web` container): ```bash docker compose up -d db ``` 3. **Make the `db` hostname resolve on your host machine.** `config/database.yml` points at host `db`, which only exists inside the Compose network. Add this line to `/etc/hosts` so both Docker and native runs work against the same config: ```text 127.0.0.1 db ``` 4. **Install gems:** ```bash bundle install ``` 5. **Set up your local config.** The app reads settings like `GROWSTUFF_SITE_NAME` from a git-ignored `.env` file (via `dotenv-rails`). Copy the example to get started: ```bash cp env-example .env ``` 6. **Install Yarn and JS dependencies.** Yarn isn't bundled with Node — enable it via Node's built-in Corepack, then install: ```bash corepack enable yarn install ``` 7. **Create and load the database:** ```bash bundle exec rails db:create db:schema:load ``` 8. **Start the app:** ```bash bin/dev ``` `bin/dev` uses `Procfile.dev` (via Foreman, Overmind, or Hivemind) to run the Rails server together with asset compilation watchers (`yarn build:watch` and `yarn build:css:watch`). Assets are automatically compiled on changes, so manually precompiling assets (`rails assets:precompile`) is not required in development. ### Sign in with Bluesky The "Continue with Bluesky" button only appears once the app has a signing key. Bluesky has no client ID or secret to register: our client ID is the URL of `/oauth/client-metadata.json`, and requests to Bluesky are signed with an ES256 key. 1. Generate a key: ```bash bundle exec rake atproto:generate_key ``` 2. Set the output as `GROWSTUFF_ATPROTO_PRIVATE_KEY` (in `.env` locally, or `heroku config:set` in production). Use a different key for each environment and never commit it. Without the key the button is hidden and the metadata URL returns 404. #### Trying it locally Bluesky refuses `localhost` as a callback address and has to fetch the metadata URL itself, so it only works through a public HTTPS tunnel such as [ngrok](https://ngrok.com/). The free plan is enough. 1. Start a tunnel to the Rails port: ```bash ngrok http 3000 ``` Note the `https://….ngrok-free.dev` address it prints. 2. Rails blocks hosts it doesn't know about, so allow the tunnel's hostname (no `https://`) when you start the server. Put it in `.env` or your shell rather than in `config/environments/development.rb`: ```bash RAILS_DEVELOPMENT_HOSTS=your-name.ngrok-free.dev bin/dev ``` 3. Open the app at the tunnel's address, not `localhost`. The client ID and callback URL are built from the address in your browser. ngrok's free plan shows a "Visit Site" page the first time; click through it. 4. Check `/oauth/client-metadata.json` loads at that address, then use **Sign in with Bluesky** on the home page. If it fails, the generic message hides the reason; look for `(bluesky) Authentication failure!` in the server output. ### Sign in with GitHub 1. Register a GitHub **OAuth App** under Settings → Developer settings → OAuth Apps. 2. Set its authorization callback URL to `https://your-growstuff-host/members/auth/github/callback` (or `http://localhost:3000/members/auth/github/callback` for local development). 3. Set `GROWSTUFF_GITHUB_CLIENT_ID` and `GROWSTUFF_GITHUB_CLIENT_SECRET` in the environment or your local `.env`, then restart the app. Never commit the secret. With Docker Compose, put these settings in the project-root `.env` or export them in your shell, then recreate the web container with `docker compose up -d web`. Compose forwards both settings to the container; `docker compose restart` alone does not apply changed environment settings. GitHub sign-in is hidden unless both settings are present. Use a separate OAuth App for each environment. GitHub provides your public identity for sign-in; we do not store GitHub access tokens or request repository access. After signing up, Growstuff asks you to add an optional email address for notifications and planting reminders, rather than importing an address from GitHub. Existing members should connect GitHub from **Settings → Apps** before using it to sign in; accounts are not automatically matched by public GitHub email. If the option is missing, check configuration inside the running app without printing credentials: ```bash bundle exec rails runner 'puts "GitHub sign-in enabled: #{OmniAuth::Strategies::GrowstuffGithub.enabled?}"' ``` For Docker Compose, prefix that command with `docker compose exec web`. A `false` result means at least one credential is missing or blank in the app's environment. ### For Home Automation enthusiasts https://github.com/Growstuff/homeassistant-growstuff/ ## For designers, writers, researchers, data wranglers, and other contributors There are heaps of ways to get involved and contribute no matter what your skills and interests. You might like to check out: * The [New Contributor Guide](https://github.com/Growstuff/growstuff/wiki/New-contributor-guide) page on our wiki, which has lots of detail for different areas Here on Github, you might find these useful: * [Github Project Board](https://github.com/orgs/Growstuff/projects/1) has stories in "ready" that can be worked on. * [needs: design](https://github.com/Growstuff/growstuff/labels/needs:%20design) - tasks requiring high-level design * [needs: visual design](https://github.com/Growstuff/growstuff/labels/needs:%20visual+design) - tasks requiring visual/graphical design * [needs: documentation](https://github.com/Growstuff/growstuff/labels/needs:%20documentation) * [needs: data](https://github.com/Growstuff/growstuff/labels/needs:%20data) - tasks requiring data entry, data design, data import, or similar * [curated:beginner](https://github.com/Growstuff/growstuff/labels/curated:%20beginner) - tasks that are ideal for beginner programmers or people new to the project Feel free to comment on any of the issues on [Github](https://github.com/Growstuff/growstuff/issues). ## Contact For more information about this project, contact [info@growstuff.org](mailto:info@growstuff.org). Security Issues: If you find an authorization bypass or data breach, please contact our maintainers directly at [maintainers@growstuff.org](mailto:maintainers@growstuff.org).