Update README.md and gitignore

This commit is contained in:
Rob Watson 2021-12-05 11:56:18 +01:00
parent e9bca62098
commit 75e09c05cf
2 changed files with 38 additions and 39 deletions

4
.gitignore vendored
View File

@ -1,6 +1,2 @@
/backend/.env
/backend/debug/
# generated files:
/backend/generated
/frontend/src/generated

View File

@ -11,42 +11,9 @@ It is currently in early development.
## Development
### Code generation
### Dependencies
To generate protobuf code and GRPC stubs, first install [protoc](https://grpc.io/docs/protoc-installation/) and the GRPC dependencies:
```
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
```
Then generate the code with:
```
./protogen.sh
```
To generate the database access layer, first install [sqlc](https://sqlc.dev/).
```
cd backend/
sqlc generate
```
### Migrations
Database migrations require `golang-migrate`.
```
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
```
Migrations then can be run with:
```
cd backend/
migrate -path sql/migrations -database $DATABASE_URL up
```
It is required that an [ffmpeg](https://ffmpeg.org/download.html) binary is available in the current path.
### Running the app
@ -65,3 +32,39 @@ The frontend can be launched on localhost:3000 with:
cd frontend/
yarn start
```
### Code generation
To regenerate protobuf code and GRPC stubs, first install [protoc](https://grpc.io/docs/protoc-installation/) and the GRPC dependencies:
```
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
```
Then generate the code with:
```
./protogen.sh
```
To regenerate the database access layer, first install [sqlc](https://sqlc.dev/). New queries can be added to `backend/sql/queries.sql`, and code regenerated with:
```
cd backend/
sqlc generate
```
### Migrations
Database migrations require [golang-migrate](https://github.com/golang-migrate/migrate).
```
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
```
Migrations then can be run with:
```
cd backend/
migrate -path sql/migrations -database $DATABASE_URL up
```