Welcome to the code for Coordinape! If you're new to the project, check out our docs.
Stack: React, Hasura graphql server & vercel serverless functions
- NodeJS v14
- Yarn
- Docker
- Vercel CLI
yarn install
yarn setup
- init git submodules & hardhat dependencies
cp .env.example .env
- Set
HARDHAT_OWNER_ADDRESS
andLOCAL_SEED_ADDRESS
to your local dev wallet
- Set
yarn docker:start
- Start Hasura and postgres- Clear the data stored in the docker volumes:
yarn docker:clean
- Clear the data stored in the docker volumes:
yarn db-seed-fresh
- Seed the db w/ dummy datayarn start
- Runs React and the serverless functions in
api/
- Runs React and the serverless functions in
- Go to http://localhost:3000 and start giving!
If you want to hack on end-to-end tests, or see why one might be failing, see our cypress README.
More detailed guidelines coming soon.
When writing new frontend components, please use Stitches instead of Material-UI. See:
- Intro video with the author of Stitches
stitches.config.ts
src/ui
, where we have a set of basic components- This folder is for simple HTML tags wrapped with
styled
; components with logic and/or state should still go insrc/components
, or in a subfolder named for the main component they belong to.
- This folder is for simple HTML tags wrapped with
- Create React App
- Stitches
- ethers
- Luxon
- Sentry (error reporting)
- d3-force-3d
- See forked
canvas-color-tracker
for brave compatibility
- See forked
- Recoil - deprecated
- Material UI - deprecated
Hasura
automagically creates a
GraphQL API
atop our postgres db. We use it to apply
migrations
and
manage metadata.
Perhaps, the easiest way to get a feel is start the app and run yarn hasura console
.
yarn hasura console
to modify and explore the databaseyarn generate
after schema changes to codegen zeus & react-query libs- Requires
yarn start
to be running
- Requires
If you pull in any new changes to the schema, your local Hasura instance might start complaining about metadata inconsistency. In order to apply the new migrations / metadata to your local instance, run the following commands:
yarn hasura migrate apply
yarn hasura metadata apply
Alternately, you can just run yarn docker:stop && yarn docker:start
and Hasura will apply the migrations/metadata automatically.
Any changes you make in yarn hasura console
will be reflected in your local hasura
directory as migrations or metadata. In the feature branch a clone of the staging database will be created with the changes.
These will be applied to the production instance once the PR is merged.
Hardhat is used with typechain to generate TypeScript bindings for the smart contracts, which are in this repo as a git submodule at hardhat/contracts
.
- Set
ETHEREUM_RPC_URL
in .env- From Infura project id: Infura & create new project
- Needs to have access to archive data
./scripts/rebuild_hardhat.sh
- Rebuild the generated codeyarn test
- Run tests- make sure
HARDHAT_FORK_BLOCK
is set (13500000 is a good value) andETHEREUM_RPC_URL
points to an archive node
- make sure
For an easy quick start, launch a Gitpod development version of the development environment.
Open Gitpod in "Open in VS Code on Desktop", then verify the ports 3000
, 8080
and 4566
are being forwarded by VS Code in the "Ports" tab of VS Code. You should then be able to load the app at localhost:3000.
If you want to set a custom .env file for your personal settings and address, edit .env
and then save it to your Gitpod profile with
gp env DOTENV="$(base64 .env | tr -d '\n')"
See .gitpod.yml
for details on how Gitpod works.
-
Cannot start service app: error while creating mount source path
Try restarting Docker Desktop -
TypeError: Cannot read properties of undefined (reading 'replace')
You need to configure a local.env
file with some private variables. Ask someone for these.