# sketch## Synopsis```### install dependencies$ make deps### build applications$ make build### run applications$ make run### test your github-actions$ make test-github-actions### and show helps about all tasks$ make help```## Applications Port| app | port | local url || ---------- | ---- | ---------------------- || client | 4000 | http://localhost:4000/ || server | 4001 | http://localhost:4001/ || public_api | 4002 | http://localhost:4002/ || worker | --- | --- |## GitHub Actions### TestingWe use [`nektos/act`](https://github.com/nektos/act/blob/master/README.md) for testing GitHub Actions workflows.## Database BranchingWe should create a detabase branch when develop on localhost.It is a step-by-step recture of database branching in below.### 1. Login to your PlanetScale account with `make auth-pscale`.If you are never touched to this project, you should to login to the PlanetScale with below command before begin your development.
```$ make auth-pscale```You will then see the following announcement, which you can follow to log in.```Failed to open a browser: exec: "xdg-open": executable file not found in $PATHConfirmation Code: XXXXXXXXIf something goes wrong, copy and paste this URL into your browser: https://auth.planetscale.com/oauth/device?user_code=XXXXXXXX
```### 2. Create a git branch.You should create a new git branch before create a database branch.```$ git branch feature/yourname-feature-name```### 3. Create a database branch with `make create-db-branch`.```$ make create-db-branch```As example, a database branch name is `feature-yourname-featurename` when your git branch name is `feature/yourname-featurename`.
### 4. Run apps and database with `make run`Now, `make run` boots apps, and database.```$ make run```Then, you can see logs as lile below.```./scripts/shoreman05:56:57 azurite | 'azurite --silent --location /tmp --debug /tmp/debug.log' started with pid 3148105:56:57 server | bash: denon: command not found05:56:57 server | 'cd apps/server && denon run --allow-net --allow-read --allow-env ./src/index.ts' started with pid 31491
05:56:57 db | 'make run-db-branch' started with pid 3149905:56:57 db | make[1]: Entering directory '/workspaces/toggle_sketch'05:56:57 db | run database branch feature-sazuma-planetscale-branch05:56:57 azurite | Azurite Blob service is starting at http://127.0.0.1:1000005:56:57 azurite | Azurite Blob service is successfully listening at http://127.0.0.1:1000005:56:57 azurite | Azurite Queue service is starting at http://127.0.0.1:1000105:56:57 azurite | Azurite Queue service is successfully listening at http://127.0.0.1:1000105:56:57 azurite | Azurite Table service is starting at http://127.0.0.1:1000205:56:57 azurite | Azurite Table service is successfully listening at http://127.0.0.1:1000205:56:59 db | Secure connection to database toggle_sketch and branch feature-sazuma-planetscale-branch is established!.
05:56:59 db |05:56:59 db | Local address to connect your application: 127.0.0.1:3306 (press ctrl-c to quit)```And you can access to database-branch with `mysql -h 127.0.0.1 -uroot`### 5. Make some changes on database branch.Yay! You can begin your development!### 6. Create a deploy-request with `make deploy-request-db-branch`You can create a deploy-request if you want to deploy your changes in database with below command.```$ make deploy-request-db-branch```## Schema Deploy Flow1. Create a new branch on your git repository2. Create a new DB branch with `make create-db-branch`3. Make changes to `packages/prisma/schema.prisma`4. Deploy your changes in schema to your DB branch with `make push-schema`5. Create a pull-request on GitHub6. Create a deploy-request on PlanetScale