Skip to content

Commit

Permalink
Merge pull request #15 from GenerateNU/feature/db-testing
Browse files Browse the repository at this point in the history
Feature/db testing
  • Loading branch information
wyattchris authored Sep 19, 2024
2 parents 121ad8f + 30cbbe6 commit c8ee7b9
Show file tree
Hide file tree
Showing 14 changed files with 470 additions and 367 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:

- name: Run backend tests
working-directory: ./backend
run: go test ./...
run: go test -tags=skiptest ./...

122 changes: 64 additions & 58 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,58 +1,64 @@
include ../.env

# Installing frontend dependencies
.PHONY: frontend-dep
frontend-dep:
cd frontend && npm install

# running the frontend
.PHONY: frontend-run
frontend-run:
cd frontend && npm start

# Lint the frontend source code
.PHONY: frontend-lint
frontend-lint:
cd frontend && npx eslint

# Installing backend dependencies
.PHONY: backend-dep
backend-dep:
cd backend/cmd/server && go get .

# Lint backend source code
.PHONY: backend-lint
backend-lint:
cd backend && golangci-lint run

# Format backend source code
.PHONY: backend-format
backend-format:
cd backend && go fmt ./...

# Run backend tests
.PHONY: backend-test
backend-test:
cd backend && go test ./...

# Build the db
.PHONY: db-run
db-run:
cd backend && npx supabase start

# Rebuild the database
.PHONY: db-rebuild
db-rebuild:
cd backend && npx supabase start && npx supabase db reset

# Run backend
.PHONY: backend-run
backend-run:
cd backend/cmd/server && go run main.go

.PHONY: ngrok-run
ngrok-run:
@echo ${EXPO_PUBLIC_API_DOMAIN}
cd backend && ngrok http --domain=${EXPO_PUBLIC_API_DOMAIN} 8080


# Installing frontend dependencies
.PHONY: frontend-dep
frontend-dep:
cd frontend && npm install

# running the frontend
.PHONY: frontend-run
frontend-run:
cd frontend && npm start

# Lint the frontend source code
.PHONY: frontend-lint
frontend-lint:
cd frontend && npx eslint

# Installing backend dependencies
.PHONY: backend-dep
backend-dep:
cd backend/cmd/server && go get .

# Lint backend source code
.PHONY: backend-lint
backend-lint:
cd backend && golangci-lint run

# Format backend source code
.PHONY: backend-format
backend-format:
cd backend && go fmt ./...

# Run backend tests
.PHONY: backend-test
backend-test:
cd backend && go test ./...

# Build the db
.PHONY: db-run
db-run:
cd backend && npx supabase start

# Stop the db
.PHONY: db-stop
db-stop:
cd backend && npx supabase stop

# Dump the db
.PHONY: db-dump
db-dump:
cd backend && npx supabase db dump --data-only

# Rebuild the database
.PHONY: db-rebuild
db-rebuild:
cd backend && npx supabase start && npx supabase db reset

# Run backend
.PHONY: backend-run
backend-run:
cd backend/cmd/server && go run main.go

# convert the backend link to an ngrok link
.PHONY: ngrok-run
backend-ngrok:
./scripts/ngrok.sh
214 changes: 141 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,141 @@
<div align="center">
<h1>Nightlife 🌃</h1>
<div>
A fullstack application for the Nightlife project
</div>
</div>

## Stack

[![Nix](https://img.shields.io/badge/nix-devshell-blue?logo=NixOS&labelColor=ccc)](https://nixos.org/)
[![Go](https://img.shields.io/badge/go-%2300ADD8.svg?style=for-the-badge&logo=go&logoColor=white)](https://go.dev/doc/)
[![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge&logo=postgresql&logoColor=white)](https://www.postgresql.org/)
[![Supabase](https://img.shields.io/badge/supabase-black?logo=supabase&style=for-the-badge)](https://supabase.com/)
[![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![React Native](https://img.shields.io/badge/react_native-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB)](https://reactnative.dev/)

## Tools

[![Expo](https://img.shields.io/badge/expo-1C1E24?style=for-the-badge&logo=expo&logoColor=#D04A37)](https://docs.expo.dev/)
[![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white)](https://www.docker.com/)

## Development Enviroment Setup

Before compiling and running our application, we need to install/setup several
languages, package managers, and various tools. The installation process can
vary, so follow the instructions for each item below!

[Nix](https://nixos.org/download/) our devshell, standarizing the development environment for all engineers.

[Go](https://go.dev/doc/install) our primary backend language.

[Node Package Manager](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
our package manager in the frontend.

[Docker](https://www.docker.com/get-started/) and
[Docker Desktop](https://www.docker.com/products/docker-desktop/) our Postgres
Database will be containerized in Docker.

[Ngrok](https://ngrok.com/docs/getting-started/) Allows us to easily connect the
frontend to backend code.

## Before Running

Create an .env file in the root directory:

```
SUPABASE_URL=<your-supabase-url-here>
SUPABASE_ANON_KEY=<your-supabase-anon-key-here>
DATABASE_URL<your-supabase-db-url-here>
SUPABASE_PROJECT_ID=<your_supabase_project_id_here>
SUPABASE_JWT_SECRET=<your_supabase_jwt_secret_here>
EXPO_PUBLIC_DOMAIN=<your_expo_public_domain>
```

Create a supabase account [here](https://supabase.com/) and Cam and I will add you to the Generate org!

## Before Contributing

Before contributing to the project, we need to install/setup several various
tools. The installation process can vary, so follow the instructions for each
item below!

[Pre-commit](https://pre-commit.com) standardizing code style and commits

## Running The Project

1. In the base of the repo: run `nix develop --impure`
2. Launch Docker Desktop
3. In the base of the repo: run `make db-run`
4. Then, open a new tab to run commands in: run `make backend-run` or
- You can now view swagger: http://localhost:8080/swagger/index.html
5. Next, in a new tab run `make ngrok-run`
6. Finally, open one last new tab: run `make frontend-run`
<<<<<<< feature/db-testing
<div align="center">
<h1>Nightlife 🌃</h1>
<div>
A fullstack application for the Nightlife project
</div>
</div>

## Stack

[![Nix](https://img.shields.io/badge/nix-devshell-blue?logo=NixOS&labelColor=ccc)](https://nixos.org/)
[![Go](https://img.shields.io/badge/go-%2300ADD8.svg?style=for-the-badge&logo=go&logoColor=white)](https://go.dev/doc/)
[![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge&logo=postgresql&logoColor=white)](https://www.postgresql.org/)
[![Supabase](https://img.shields.io/badge/supabase-black?logo=supabase&style=for-the-badge)](https://supabase.com/)
[![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![React Native](https://img.shields.io/badge/react_native-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB)](https://reactnative.dev/)

## Tools

[![Expo](https://img.shields.io/badge/expo-1C1E24?style=for-the-badge&logo=expo&logoColor=#D04A37)](https://docs.expo.dev/)
[![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white)](https://www.docker.com/)

## Development Enviroment Setup

Before compiling and running our application, we need to install/setup several
languages, package managers, and various tools. The installation process can
vary, so follow the instructions for each item below!

[Nix](https://nixos.org/download/) our devshell, standarizing the development environment for all engineers.

[Go](https://go.dev/doc/install) our primary backend language.

[Node Package Manager](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
our package manager in the frontend.

[Docker](https://www.docker.com/get-started/) and
[Docker Desktop](https://www.docker.com/products/docker-desktop/) our Postgres
Database will be containerized in Docker.

[Ngrok](https://ngrok.com/docs/getting-started/) Allows us to easily connect the
frontend to backend code.

## Before Running

Create an .env file in the root directory:

```
SUPABASE_URL=<your-supabase-url-here>
SUPABASE_ANON_KEY=<your-supabase-anon-key-here>
DATABASE_URL<your-supabase-db-url-here>
SUPABASE_PROJECT_ID=<your_supabase_project_id_here>
SUPABASE_JWT_SECRET=<your_supabase_jwt_secret_here>
EXPO_PUBLIC_DOMAIN=<your_expo_public_domain>
```

Create a supabase account [here](https://supabase.com/) and Cam and I will add you to the Generate org!

## Running The Project

1. In the base of the repo: run `nix develop --impure`
2. Launch Docker Desktop
3. In the base of the repo: run `make db-run`
4. Then, open a new tab to run commands in: run `make backend-run` or
- You can now view swagger: http://localhost:8080/swagger/index.html
5. Next, in a new tab run `make ngrok-run`
6. Finally, open one last new tab: run `make frontend-run`
=======
<div align="center">
<h1>Nightlife 🌃</h1>
<div>
A fullstack application for the Nightlife project
</div>
</div>

## Stack

[![Nix](https://img.shields.io/badge/nix-devshell-blue?logo=NixOS&labelColor=ccc)](https://nixos.org/)
[![Go](https://img.shields.io/badge/go-%2300ADD8.svg?style=for-the-badge&logo=go&logoColor=white)](https://go.dev/doc/)
[![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge&logo=postgresql&logoColor=white)](https://www.postgresql.org/)
[![Supabase](https://img.shields.io/badge/supabase-black?logo=supabase&style=for-the-badge)](https://supabase.com/)
[![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![React Native](https://img.shields.io/badge/react_native-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB)](https://reactnative.dev/)

## Tools

[![Expo](https://img.shields.io/badge/expo-1C1E24?style=for-the-badge&logo=expo&logoColor=#D04A37)](https://docs.expo.dev/)
[![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white)](https://www.docker.com/)

## Development Enviroment Setup

Before compiling and running our application, we need to install/setup several
languages, package managers, and various tools. The installation process can
vary, so follow the instructions for each item below!

[Nix](https://nixos.org/download/) our devshell, standarizing the development environment for all engineers.

[Go](https://go.dev/doc/install) our primary backend language.

[Node Package Manager](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
our package manager in the frontend.

[Docker](https://www.docker.com/get-started/) and
[Docker Desktop](https://www.docker.com/products/docker-desktop/) our Postgres
Database will be containerized in Docker.

[Ngrok](https://ngrok.com/docs/getting-started/) Allows us to easily connect the
frontend to backend code.

## Before Running

Create an .env file in the root directory:

```
SUPABASE_URL=<your-supabase-url-here>
SUPABASE_ANON_KEY=<your-supabase-anon-key-here>
DATABASE_URL<your-supabase-db-url-here>
SUPABASE_PROJECT_ID=<your_supabase_project_id_here>
SUPABASE_JWT_SECRET=<your_supabase_jwt_secret_here>
EXPO_PUBLIC_DOMAIN=<your_expo_public_domain>
```

Create a supabase account [here](https://supabase.com/) and Cam and I will add you to the Generate org!

## Before Contributing

Before contributing to the project, we need to install/setup several various
tools. The installation process can vary, so follow the instructions for each
item below!

[Pre-commit](https://pre-commit.com) standardizing code style and commits

## Running The Project

1. In the base of the repo: run `nix develop --impure`
2. Launch Docker Desktop
3. In the base of the repo: run `make db-run`
4. Then, open a new tab to run commands in: run `make backend-run` or
- You can now view swagger: http://localhost:8080/swagger/index.html
5. Next, in a new tab run `make ngrok-run`
6. Finally, open one last new tab: run `make frontend-run`
>>>>>>> main
Loading

0 comments on commit c8ee7b9

Please sign in to comment.