This is the core of my private repo (without app-specific code) with commits squashed. Infra diagram
-
Clone this repo
-
In the project root, run:
scripts/setup.sh
- Set up git-crypt, add team members if needed
- Install:
- Node 22+
- Yarn
- Postgres 16+
- PostGIS 3+
- Docker
- git-crypt
- redis-cli
- sentry-cli
- libvips
- Run:
corepack enable
yarn set version stable
yarn install
sudo npm i -g zx
yarn build:types
- Edit:
- env/env.dev
- app/shared/config/config.js
- app/server/config/serverConfig.ts
- Generate and export GPG key:
gpg2 --expert --full-gen-key
# Prefer ECC, Curve 25519, no expiry
gpg --output ./pub.gpg --armor --export user@example.com
-
Send this public key to someone with the decrypted secrets
-
The person with the decrypted secrets runs:
gpg --import ./pub.gpg
gpg --edit-key user@example.com
# gpg> sign
# gpg> save
git-crypt add-gpg-user --trusted user@example.com
git push
- Run:
git pull
git-crypt unlock
- Add to pg_hba.conf:
host all all 0.0.0.0/0 scram-sha-256
host all all ::/0 scram-sha-256
- Enable SSL:
cd /etc/postgresql/xx/main
openssl genrsa -aes128 2048 > server.key
openssl rsa -in server.key -out server.key
chmod 400 server.key
chown postgres:postgres server.key
openssl req -new -key server.key -days 365 -out server.crt -x509
- Uncomment and edit postgresql.conf:
ssl = on
max_connections = 200
wal_level = logical
wal_writer_delay = 50ms
max_wal_size = 4GB
max_wal_senders = 100
max_replication_slots = 100
For prod:
listen_addresses = '*'
-
Restart Postgres
-
Create 2 Postgres databases: writeable and read-replica. Install PostGIS in RR.
sudo -u postgres psql
> ALTER USER postgres PASSWORD 'pass';
> CREATE DATABASE db;
> CREATE DATABASE "dbRR";
> \c "dbRR"
> CREATE EXTENSION postgis;
-
Edit
env/env.dev
. -
Run
yarn ss recreateInfra
-
Run
yarn docker
. -
Run
yarn serve
. -
Go to
http://localhost:9001
.
-
Run
yarn lint
to run Eslint and Stylelint. -
Run
yarn tsc
to run TypeScript. -
Run
yarn test
to run Cypress.
-
Add domain to config.js
-
Rebuild app
-
Add to Google API Credentials, Apple Services ID, Facebook/Instagram app
- Run
yarn deploy
.
-
Run
npx cap add android
ornpx cap add ios
. -
Continue in Android Studio or XCode.