Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Latest commit

 

History

History
82 lines (69 loc) · 3.33 KB

Development.md

File metadata and controls

82 lines (69 loc) · 3.33 KB

Development

Puggies is developed with Go, React and Docker. If you want to contribute to Puggies you will need the following tools installed on your computer:

Once you have set up your dependencies you can fork the repository and begin developing:

git clone https://github.com/YOUR-GITHUB-USERNAME/puggies.git
cd puggies/frontend
yarn install
yarn start

# in another terminal window
cd puggies/backend
# edit the example .env file to suit your needs
cp .env.development.example .env
source .env
go run src/* serve

Submitting your changes

To have your changes merged, please submit a pull request on GitHub. Describe your changes in detail and ensure you have followed the pull request checklist.

Tips

Frontend

  • Use only Chakra Components (<Box> / <Flex> / <Text> as opposed to plain React components like <div> or <p>). The Chakra Documentation is your best friend!
  • Use setState where possible for component-local state. Use zustand for global state by updating one of the stores in src/stores or by creating a new one.
  • Maintain type safety as much as possible. Avoid the use of any or object types

Documentation

Backend

  • Use the http package for status codes (http.StatusOK instead of 200)
  • The response type for API routes should always be JSON. For a successful response, place the data in the message field. For error responses, place the error string in the error field.

Performing database schema upgrades

Database migrations are managed through golang-migrate. If you need to make an update to the database schema you must do so by generating a new migration. Use the following command inside the backend directory:

migrate create -ext sql -dir migrations -seq descriptive_migration_name_here

Use a descriptive yet concise name for the migration so developers know what it does. See the migration best practices documentation for more info.

Demo Parser Versioning

When making updates to the demo parser it is important to increment the ParserVersion. This will signal to the backend that existing matches in the database were parsed with an out-of-date parser and need to be re-analyzed.

Documentation