Skip to content

ReactJS + AdminJS store with a focus on Accessibility (Spanish - Work in progress -> migrating to NextJS))

License

Notifications You must be signed in to change notification settings

quiltyweb/productcatalog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Product Catalog

Test all the things Heroku

Setup

  • Install Docker
  • Install direnv
    • Loads env vars from .env, which is convenient
  • Install cockroachdb
  • Create an env file:
    • cp .env.example .env
    • Set the uncommented env var values
  • docker volume create productcatalog_node_modules
  • docker-compose up --build

Database

  • To set up or restore your local database using the production DB, run ./scripts/set_local_db_to_prod.sh [DUMP FILENAME]
    • The dump filename is an optional arg that will use a local *.sql or *.dump file. Without the dump filename, a backup of the production database will be created, and your local instance will be restored with that backup.
    • WARNING: This will erase any data you currently have on your local DB.

Running the app

  • docker-compose start
  • Open the browser to localhost:3000

GraphQL Playground

  • Navigate to localhost:3333/graphql
  • To make make authorized requests to the GraphQL API, you have to add {"Authorization": "supersecretspicysauce"} to the HTTP Headers section in the bottom left corner of the page.

Deployment

We host the app on Heroku.

We deploy automatically to Heroku with every merged PR that passes CI via a GitHub integration. If you want to deploy manually do the following:

  • While on main, run git push heroku main:master

Testing

  • Run all integration tests: ./scripts/integration_tests.sh
    • Do not use yarn run test:integration, because all integration tests require a test DB, and the bash script takes care of setup and teardown.
  • Run all unit tests: docker-compose run --rm app yarn run test:unit

Troubleshooting

  • To get code editor linters and other functionality working correctly, you have to install linting/testing/type packages locally as well as on your Docker container. This mostly works, but sometimes creates weird conflicts that require a reset per below.
  • Sometimes you'll install packages, then get errors that say your new package is missing 😑. The only thing that seems to fix it is to remove the node_modules volume and rebuild the image:
    • docker container rm <container name>
    • docker volume rm <node_modules volume name>
    • docker volume create <node_modules volume name>
    • docker-compose build --no-cache

NextJS

  • After installing NPM packages, run npx prisma generate.
  • Only run docker-compose start db. The NextJS app doesn't depend on the other services, and client would conflict with the app's use of port 3000.
  • Run npm run dev to start the app.

About

ReactJS + AdminJS store with a focus on Accessibility (Spanish - Work in progress -> migrating to NextJS))

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published