Skip to content

keesey/phylopic

Repository files navigation

PhyloPic

PhyloPic is an open database of freely reusable silhouettes of life forms. Code for PhyloPic resides in this monorepo.

Most of the code for PhyloPic is TypeScript.

Projects

Apps

Project Path Description
api Serverless API for accessing PhyloPic data
api-docs Documentation for the PhyloPic API
contribute Public webapp for contributing silhouette images
edit Private webapp (run locally) for managing PhyloPic, including contribution review and data editing
publish Code for administrating PhyloPic, including publishing releases and managing source files
www Public webapp for searching for and viewing silhouette images

Packages

Project Path Description
api-models Type declarations and utility files for data models used by the API
eslint-config-phylopic ESLint configurations used throughout the project
source-client Client object for reading and writing source models and files
source-models Type declarations and utility files for data models used in the source bucket
styles Stylesheet values and mixins
tsconfig Typescript configurations used throughout the project
ui Commonly-used React components for user interfaces
utils Common code
utils-api Common code related to using the API in a webapp
utils-aws Common code related to Amazon Web Services

Database scripts

The scripts for creating the project's Postgres databases are in sql.

Getting started

Yarn (v1.22 or higher) is required for this monorepo project. Node.js (v20 or higher) is also required for most apps.

Run yarn from the project root to install dependencies.

Prerequisites

Running the scripts in the publish project requires additional prerequisites. See the documentation for details.

Formatting and linting

To clean up formatting for all source files in all projects, run:

yarn format

To lint all source files and automatically fix certain issues:

yarn lint

Testing

To run unit tests in all projects that have them:

yarn test

Running locally

If you are running against your own databases, you will need to set those up. PhyloPic uses Postgres databases. Scripts for creating them are listed in the sql documentation.

Certain apps require environment variables to be set before they can be run locally. See each app's documentation for details:

It may be easiest to focus on setting up a particular app and running it on its own. But, if you have them all set up, you can run them all locally at the same time with this command:

yarn dev

Apps will run on the following ports:

App Project Port
api 3003
contribute 3002
edit 3001
www 3000

Releasing versions

The semantic versioning of the monorepo is only updated when root dependencies are updated (for example, turborepo), or potentially when major changes are made. To create a new version:

  • Update version in package.json.
  • Update CHANGELOG.md, moving all [Unreleased] items into a new entry for the new version.
  • Commit the changes.
  • Tag the commit with @phylopic/v[M].[m].[p], where [M], [m], and [p] are integers denoting the major version, minor version, and patch version, respectively. Example: @phylopic/v2.0.9. Push the tag to origin.

Apps and packages

Each subproject (app or package) has its own semantic versioning. To release a new version:

  • Update version in the subproject's package.json.
  • Update the subproject's CHANGELOG.md, moving all [Unreleased] items into a new entry for the new version.
  • Commit the changes.
  • Tag the commit with @phylopic/[subproject]/v[M].[m].[p], where [subproject] is the name of the project (for example, www) and [M], [m], and [p] are integers denoting the major version, minor version, and patch version, respectively. Example: @phylopic/www/v2.6.12. Push the tag to origin.
  • For apps, publish the new version:
    • For api or api-docs, run yarn deploy.
    • For contribute, reset the @phylopic/contribute/prod branch to the release's commit and push to origin. Deployment can be monitored in Vercel.
    • For www, reset the @phylopic/www/prod branch to the release's commit and push to origin. Deployment can be monitored in Vercel.
    • No action is necessary for edit or publish, which are only run locally.

Contributing

To contribute to the development of PhyloPic, please read the guidelines in CONTRIBUTING.md and contact Mike Keesey ([email protected]). The repository is open and may be forked, with pull requests made back into the original repository.

Further documentation