uwblueprint / shoe-project

👠👟 Repo for The Shoe Project @ UWBlueprint
https://map.theshoeproject.online
MIT License
6 stars 0 forks source link

shoe-project

Setup

Requirements:

Development Workflow

The project is dockerized and hence it is recommended to use docker-compose to develop and run services!

Install dependencies and build docker image:

make setup

To run all the services for the app:

make

To seed DB:

make seed

To run backend:

make backend

To run frontend:

make frontend

To run postgres:

make postgres

Now database can be accessed by Pgadmin:

If you install new dependencies, clean the docker images with make clean-docker, then run make setup and make again.

Trouble? Feel free to blow everything up with make clean. Also, you can run docker image ls to list all images, and docker ps to see all running images.

If you see message:

Pulling frontend (shoe_project_image:)...
ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.

Building for Production

See the docker/Dockerfile.prod for more details.

TL;DR, run yarn build-prod, and then just run the server.

Manual setup (frontend)

The frontend uses React and TypeScript, and bundles assets using Parcel.

Navigate into the UI folder.

cd ui

Run yarn to install deps.

yarn

Run yarn watch to start building development assets. This will not run it's own server, you will instead need to run the go server to view the assets.

yarn watch

To run the UI assets on it's own server, run:

yarn start

Backend Code quality and checks

Before pushing code, make sure to format the code and run all tests. This can be done by:

make backend-fmt
make backend-test

You can run a single test file by specifying the package it's in:

make backend-test pkg=<package_name>
# eg. make backend-test pkg=restapi

Before code is merged, series of checks are run on the code to make sure it is formatted correctly. You can check locally to make sure none of these issues show up by:

make backend-check

Running Script

Navigate into the scripts folder.

cd scripts

Set up the virtual environment.

make setup

Run the script by specifying the name of the script file. Make sure the script is included in the scripts folder.

make filename=[filename]

For add_images.py script, images folder with all the images that needs to be uploaded to s3 should be included in the scripts folder