Skip to content

Latest commit

 

History

History
231 lines (162 loc) · 8.16 KB

CONTRIBUTING.md

File metadata and controls

231 lines (162 loc) · 8.16 KB

Contribution Guide

Preface

Send Stack uses bleeding-edge web development technology to deliver great DX to our contributors, quick iteration cycles, and clean code.

  • Typescript (strict mode)
  • Bun Package Manager
  • Yarn workspaces w/ Yarn berry
  • Turborepo Build System
  • Foundry Toolkit
  • React Native w/ Expo
  • Next.js
  • Tamagui for cross-platform styles
  • Solito for cross-platform routing
  • Supabase a OSS firebase alternative for DB and auth

Send Stack

Here is a quick peek at the send stack. Quickly jump to any of the submodules by clicking the links below.


.
├── apps
│   ├── distributor
│   ├── expo
│   ├── next
├── docs
├── packages
│   ├── api
│   ├── app
│   ├── contracts
│   ├── daimo-expo-passkeys
│   ├── eslint-config-customs
│   ├── playwright
│   ├── ui
│   ├── wagmi
│   └── webauthn-authenticator
└── supabase

Thinking in Send

Here are some things to keep in mind about thee SEND philosophy when contributing

  • Simplicity over complexity (K.I.S.S)
  • Don't repeat yourself (DRY)
  • Write a test. Don't click the same button over and over
  • Write once, Run everywhere

Prerequisites

When cloning the repo, you will need to initialize the submodules:

git clone --recurse-submodules https://github.com/0xsend/sendapp.git && cd sendapp

If you missed the --recurse-submodules flag, you can initialize them manually:

git submodule deinit --force .
git submodule update --init --recursive

Tools

You'll need a basic understanding of JS tooling

Required JS Runtime: Node >= 20.9.0

See yarn package manager. We are using Yarn 4 with workspaces.

corepack enable

Issues

If you are running a M1, M2 or M3 Mac this may cause some issues.

Failing to install better-sqlite3

If you get the following error:

error: libtool: file: Release/obj.target/sqlite3/gen/sqlite3/sqlite3.0 is not an object file (not allowed in a library)

See the following issue for instructions on how to solve it, essentially setting the following values solves the issue:

export LDFLAGS="-L/opt/homebrew/opt/sqlite/lib"
export CPPFLAGS="-I/opt/homebrew/opt/sqlite/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/sqlite/lib/pkgconfig"

Ensure these are added to .env.local in the following way, so they work in tilt:

LDFLAGS=-L/opt/homebrew/opt/sqlite/lib
CPPFLAGS=-I/opt/homebrew/opt/sqlite/include
PKG_CONFIG_PATH=/opt/homebrew/opt/sqlite/lib/pkgconfig
npm install turbo --global

Installation is easiest with foundryup

curl -L https://foundry.paradigm.xyz | bash

then in a new terminal run

foundryup
curl -fsSL https://bun.sh/install | bash

Brew Bundle

Many other dependencies are installed via Homebrew. To install all dependencies, run from the project root:

brew bundle

Your First Build

Build Steps

To streamline the project setup and build process, we recommend using Tilt. Tilt automates and optimizes the development cycle, making it faster and more efficient. Tilt is also used for CI, so using it locally ensures that your code will build and deploy correctly in the CI environment.

Getting Started with Tilt

First, install Tilt by following the instructions on their installation page. Once installed, you can proceed with the following steps:

1. Initialize Project with Tilt

In the project root directory, run:

tilt up

This command will start all the services defined in the Tiltfile, building and deploying your application in a local development environment.

Efficient Tilt Usage

tilt up will start a local Postgres database, Supabase, local Ethereum node, and local Base node. It also starts the unit tests for the application.

To save some resources on your local machine, you can limit the amount of resources used by Tilt by specifying them on the command line or disabling them in the Tilt UI.

This command for example will only start the Next.js web app and it's dependencies:

tilt up next:web

You can always re-enable the disabled resources by re-running the tilt up command or manually enabling them in the Tilt UI.

2. Monitoring and Logs

You can monitor the build process and access logs directly through the Tilt UI. Simply navigate to http://localhost:10350 in your web browser to view the status of your services.

3. Making Changes

With Tilt, you can make changes to your codebase, and Tilt will automatically detect these changes, rebuild, and redeploy the affected services. This live update feature ensures that you always test against the latest version of your code.

4. Shutting Down

Once you're done developing, you can shut down all services by pressing Ctrl+C in the terminal where you ran tilt up.

It will leave somethings running in the background. To stop all services, run tilt down.

tilt down
Loading Tiltfile at: /Users/bigboss/src/0xsend/sendapp/Tiltfile
Loading environment from .env
Loading environment from .env.local
local: sh -c "yarn supabase stop --no-backup\n    # can be removed once supabase stop --no-backup is fixed\n    docker volume ls --filter label=com.supabase.cli.project=send | awk 'NR>1 {print $2}' | xargs -I {} docker volume rm {}"
 → Stopping containers...
 → Stopped supabase local development setup.
 → Local data are backed up to docker volume. Use docker to show them: docker volume ls --filter label=com.supabase.cli.project=send
 → supabase_storage_send
local: yarn clean
 → Done in 0s 663ms
Successfully loaded Tiltfile (3.632166166s)

By leveraging Tilt, you can focus more on coding and less on the setup, significantly improving your development experience with the Send Stack.