Skip to content

david-mohr/cbr-food-coop

Repository files navigation

The Food Co-op - Canberra

The Food Co-op membership app

To get this running, you will need:

  • NodeJS >= 16
  • Docker

Setup

A series of one-time-only steps to get everything ready for development

Install the project dependencies

yarn

Make sure Docker is running

On MacOS this requires running the docker desktop app

On Linux run the command

systemctl status docker

Prepare the test DB

This will launch the database in the background using docker

yarn db

The first time after the database is loaded, there are two important steps:

  • Generate some mock data
  • Manually load the first admin user (see below)
yarn mockdata

Generate Secret

We need a real token secret for production but for development purposes we can use a mock one.

echo TOKEN_SECRET=abcd1234abcd1234 >> .env

Sign up for a mailgun account

Go to https://www.mailgun.com/ and sign up for a free account

Verify your email address (you'll also need to give a mobile phone number so they can authenticate you) and see if you can send a test email using a curl command - this will use the provided sandbox domain, you don't need to set up a domain at this stage.

Set up a template (Sending->Templates) called 'invite' (you can use the 'action' pre-fab template)

Test this with a curl command also if you want

Look at the test curl code and find the key and domain then add these two your .env file

echo MAILGUN_API_KEY=api-key-from-your-mailgun-account >> .env
echo MAILGUN_DOMAIN=sandbox-domain-from-your-mailgun-account >> .env

Generate an admin account

1. Use the script to create a new user

yarn adduser

Make sure you choose 'admin' for the type of user

2. Launch the api

yarn api

3. Start the web app in development mode

quasar dev

This will get a server up and running at http://localhost:8080

4. Have a look at the invites table by running

yarn db:shell
select * from invites;
\q

Copy the token next to the email address you entered into the clipboard

5. Open up a browser tap and put in the following url

http://localhost:8080/#/accept-invite/:78a6618bcbd0b523fa7a64386f31a49c

Where 78a66... is the token you copied from the invites table.

Fill out the name and password in the form and the invite should be accepted.

You're now ready to start development!

Development

Launch the test DB

If you already started the database during setup, you don't need to run it again. This will launch in the background

# make sure docker is running (see above) then...
yarn db

Start the API

This will stay running in your terminal and print HTTP logs

yarn api

Start the web app in development mode

This will stay running in your terminal and continually rebuild the web app each time you save changes

quasar dev

Code!

Changes to the web app (/src) will be auto compiled and hot-reloaded into the browser.

Changes to any API code (/api) will automatically detected and the API will be restarted

Deploy to Heroku (main)

git push heroku main

Deploy to Heroku (branch)

git push heroku bravo-1:main

Roadmap

Stage 1

  • Replicate OpenBravo membership functions
  • Replicate silicon reporting (approval sheets, mailchimp)

Stage 2

  • Member signup using online form
  • Expand reporting features

Stage 3

  • Open platform to member logins
  • Integration with Vend

Stage 4

  • Ambitious new stuff

SQL Helper scripts

Count the number of active members

yarn cloud-sql sql/current-member-count.sql

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages