vegan-barcode/README.md

1.4 KiB

Vegan Barcode

The goal of this project is to be a crowd sourced resource to find out if a product is vegan

Task list

  • figure out how we want to handle database migrations
  • database object models should be separated out from database migration function
  • create main process that runs database migration and then starts api
  • create search api
  • create upload api
  • create workers
    • barnivore lookup
    • alergen ingredient database lookup?
  • create mobile and desktop front ends
  • moderation tooling?

Troubleshooting:

Error: 2025/04/17 16:21:21 ERROR: relation "idx_user_claims_product_id" already exists (SQLSTATE 42P07) Explanation: The database tables already exist and the program was trying to create them again.

Fix: Either don't create the databases again in the code, or run dropdb veganDB to allow it to recreate it.

Error: psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: database "<user>" does not exist Explanation: Postgres automatically tryes to connect to a database with the same name as the user. Specify user and database: psql -U username databaseName

How to start database

  • Run brew services start postgresql
  • Create database
    • Setting environment variables:
      • PGHOST=localhost
      • DB_NAME=veganDB (Can be arbitrary)
    • Run createdb veganDB (To delete in future just run dropdb )