Skip to content

Commit

Permalink
refact: project structure (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
crlssn authored Nov 23, 2024
1 parent 65a10bf commit cc24685
Show file tree
Hide file tree
Showing 136 changed files with 260 additions and 256 deletions.
6 changes: 3 additions & 3 deletions .github/actions/deploy/backend/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ runs:

- name: Build the app
shell: bash
working-directory: ./apps/backend
working-directory: ./server
run: |
go mod download
GOOS=linux go build -o bin/app cmd/main.go
- name: Create env file
working-directory: ./apps/backend/bin
working-directory: ./server/bin
shell: bash
run: |
touch .env
Expand All @@ -92,7 +92,7 @@ runs:
REMOTE_HOST: ${{ inputs.aws_ec2_remote_host }}
REMOTE_USER: 'ec2-user'
SSH_PRIVATE_KEY: ${{ inputs.aws_ec2_private_key }}
SOURCE: 'apps/backend/bin/'
SOURCE: 'server/bin/'

- name: Restart app
uses: appleboy/[email protected]
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/deploy/web/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ runs:
node-version: '22'

- name: Install dependencies
working-directory: ./apps/web
working-directory: ./web
run: npm install
shell: bash

- name: Build the app
working-directory: ./apps/web
working-directory: ./web
run: npm run build
shell: bash

- name: Deploy to S3
working-directory: ./apps/web
working-directory: ./web
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ inputs.aws_access_key_id }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:
- main
pull_request:
paths:
- 'apps/backend/**'
- 'server/**'
- 'go.mod'

jobs:
backend:
server:
runs-on: ubuntu-latest

steps:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
pull_request:
paths:
- 'apps/web/**'
- 'web/**'

jobs:
web:
Expand All @@ -22,12 +22,12 @@ jobs:
node-version: '22'

- name: Install dependencies
working-directory: ./apps/web
working-directory: ./web
run: npm install
shell: bash

- name: Run formatter
working-directory: ./apps/web
working-directory: ./web
run: npm run format
shell: bash

Expand All @@ -42,11 +42,11 @@ jobs:
fi
- name: Run linter
working-directory: ./apps/web
working-directory: ./web
run: npx eslint "src/**/*.{js,ts,vue}"
shell: bash

- name: Build the app
working-directory: ./apps/web
working-directory: ./web
run: npm run build
shell: bash
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
/infrastructure/.terraform/
/infrastructure/.terraform.lock.hcl
/.env
/apps/web/.env
/web/.env
/database/seed/*.sql
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ test:
go test ./...

run_backend:
go run ./apps/backend/cmd/main.go
go run ./server/cmd/main.go

run_web:
cd apps/web && npm run dev
cd web && npm run dev

format:
goimports -w .
cd apps/web && npx sort-package-json
cd apps/web && npm run format
cd web && npx sort-package-json
cd web && npm run format

lint:
golangci-lint run
cd apps/web && npx eslint "src/**/*.{js,ts,vue}"
cd web && npx eslint "src/**/*.{js,ts,vue}"

vet:
go vet ./...
Empty file removed apps/mobile/.gitkeep
Empty file.
Empty file removed apps/watch/.gitkeep
Empty file.
10 changes: 5 additions & 5 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ managed:
enabled: true
override:
- file_option: go_package_prefix
value: github.com/crlssn/getstronger/apps/backend/pkg/pb
value: github.com/crlssn/getstronger/server/pkg/pb
disable:
- module: buf.build/bufbuild/protovalidate
plugins:
- remote: buf.build/protocolbuffers/go
out: apps/backend/pkg/pb
out: server/pkg/pb
opt: paths=source_relative
- remote: buf.build/connectrpc/go
out: apps/backend/pkg/pb
out: server/pkg/pb
opt: paths=source_relative
- local: protoc-gen-es
opt: target=ts
out: apps/web/src/pb
out: web/src/pb
include_imports: true
- local: protoc-gen-connect-es
out: apps/web/src/pb
out: web/src/pb
opt: target=ts
inputs:
- directory: protobufs
2 changes: 1 addition & 1 deletion database/sqlboiler.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
output = "apps/backend/pkg/orm"
output = "server/pkg/orm"
pkgname = "orm"
wipe = true
no-tests = true
Expand Down
4 changes: 2 additions & 2 deletions dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ updates:
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "apps/web"
directory: "web"
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "apps/backend"
directory: "server"
schedule:
interval: "daily"
10 changes: 5 additions & 5 deletions apps/backend/cmd/main.go → server/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"go.uber.org/zap"
"google.golang.org/grpc"

"github.com/crlssn/getstronger/apps/backend/pkg/config"
"github.com/crlssn/getstronger/apps/backend/pkg/db"
"github.com/crlssn/getstronger/apps/backend/pkg/jwt"
"github.com/crlssn/getstronger/apps/backend/pkg/repo"
"github.com/crlssn/getstronger/apps/backend/rpc"
"github.com/crlssn/getstronger/server/pkg/config"
"github.com/crlssn/getstronger/server/pkg/db"
"github.com/crlssn/getstronger/server/pkg/jwt"
"github.com/crlssn/getstronger/server/pkg/repo"
"github.com/crlssn/getstronger/server/rpc"
)

func main() {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/backend/pkg/db/db.go → server/pkg/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

_ "github.com/jackc/pgx/v5/stdlib" // Register pgx driver

"github.com/crlssn/getstronger/apps/backend/pkg/config"
"github.com/crlssn/getstronger/server/pkg/config"
)

func New(c *config.Config) (*sql.DB, error) {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package jwt
import (
"go.uber.org/fx"

"github.com/crlssn/getstronger/apps/backend/pkg/config"
"github.com/crlssn/getstronger/server/pkg/config"
)

func Module() fx.Option {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"fmt"
"time"

"github.com/crlssn/getstronger/apps/backend/pkg/orm"
orm2 "github.com/crlssn/getstronger/server/pkg/orm"
)

type ModelItem interface {
*orm.Workout | *orm.Exercise | *orm.User | *orm.Routine
*orm2.Workout | *orm2.Exercise | *orm2.User | *orm2.Routine
}

type ModelSlice[T any] interface {
Expand Down
Loading

0 comments on commit cc24685

Please sign in to comment.