-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from keep-starknet-strange/feat/backend-init
Feat: Initialize backend
- Loading branch information
Showing
45 changed files
with
1,498 additions
and
1,010 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Frontend ignored dirs | ||
./apps/web/dist/ | ||
./apps/web/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,22 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
# Go workspace files | ||
go.work | ||
go.work.sum | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
# env file | ||
.env | ||
|
||
# next.js build output | ||
.next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM golang:1.23.1-alpine | ||
|
||
RUN apk add --no-cache bash curl git jq yq | ||
|
||
# Copy over the configs | ||
WORKDIR /configs | ||
COPY ./apps/backend/configs/docker.config.yaml /configs/config.yaml | ||
|
||
# Copy over the app | ||
WORKDIR /app | ||
COPY ./apps/backend/go.mod ./apps/backend/go.sum ./ | ||
RUN go mod download | ||
COPY ./apps/backend . | ||
|
||
# Build the app & run it | ||
RUN go build -o broly-api ./cmd/broly-api/main.go | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["./broly-api"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM golang:1.23.1-alpine | ||
|
||
RUN apk add --no-cache bash curl git jq yq | ||
|
||
# Copy over the configs | ||
WORKDIR /configs | ||
COPY ./apps/backend/configs/docker.config.yaml /configs/config.yaml | ||
|
||
# Copy over the app | ||
WORKDIR /app | ||
COPY ./apps/backend/go.mod ./apps/backend/go.sum ./ | ||
RUN go mod download | ||
COPY ./apps/backend . | ||
|
||
# Build the app & run it | ||
RUN go build -o consumer ./cmd/consumer/main.go | ||
|
||
EXPOSE 8081 | ||
|
||
CMD ["./consumer"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
|
||
"github.com/keep-starknet-strange/broly/backend/internal/config" | ||
"github.com/keep-starknet-strange/broly/backend/internal/db" | ||
"github.com/keep-starknet-strange/broly/backend/routes" | ||
) | ||
|
||
func main() { | ||
config.InitConfig() | ||
|
||
db.InitDB() | ||
defer db.CloseDB() | ||
|
||
routes.InitRoutes() | ||
fmt.Println("Listening on port:", config.Conf.Api.Port) | ||
http.ListenAndServe(fmt.Sprintf(":%d", config.Conf.Api.Port), nil) | ||
fmt.Println("Server stopped") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
|
||
"github.com/keep-starknet-strange/broly/backend/indexer" | ||
"github.com/keep-starknet-strange/broly/backend/internal/config" | ||
"github.com/keep-starknet-strange/broly/backend/internal/db" | ||
) | ||
|
||
func main() { | ||
config.InitConfig() | ||
|
||
db.InitDB() | ||
defer db.CloseDB() | ||
|
||
indexer.InitIndexerRoutes() | ||
indexer.StartMessageProcessor() | ||
|
||
fmt.Println("Listening on port:", config.Conf.Consumer.Port) | ||
http.ListenAndServe(fmt.Sprintf(":%d", config.Conf.Consumer.Port), nil) | ||
fmt.Println("Server stopped") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Api: | ||
Port: 8080 | ||
AllowOrigins: | ||
- '*' | ||
AllowMethods: | ||
- GET | ||
- POST | ||
- PUT | ||
- DELETE | ||
- OPTIONS | ||
AllowHeaders: | ||
- Content-Type | ||
Production: false | ||
Admin: true | ||
Consumer: | ||
Port: 8081 | ||
Postgres: | ||
Host: localhost | ||
Port: 5432 | ||
User: broly-user | ||
Name: broly-db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Api: | ||
Port: 8080 | ||
AllowOrigins: | ||
- '*' | ||
AllowMethods: | ||
- GET | ||
- POST | ||
- PUT | ||
- DELETE | ||
- OPTIONS | ||
AllowHeaders: | ||
- Content-Type | ||
Production: false | ||
Admin: true | ||
Consumer: | ||
Port: 8081 | ||
Postgres: | ||
Host: broly-postgres-1 | ||
Port: 5432 | ||
User: broly-user | ||
Name: broly-db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Api: | ||
Port: 8080 | ||
AllowOrigins: | ||
- '*' | ||
AllowMethods: | ||
- GET | ||
- POST | ||
- PUT | ||
- DELETE | ||
- OPTIONS | ||
AllowHeaders: | ||
- Content-Type | ||
Production: false | ||
Admin: true | ||
Consumer: | ||
Port: 8081 | ||
Postgres: | ||
Host: localhost | ||
Port: 5432 | ||
User: broly-user | ||
Name: broly-db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module github.com/keep-starknet-strange/broly/backend | ||
|
||
go 1.23.1 | ||
|
||
require ( | ||
github.com/georgysavva/scany/v2 v2.1.3 | ||
github.com/jackc/pgx/v5 v5.7.1 | ||
gopkg.in/yaml.v3 v3.0.1 | ||
) | ||
|
||
require ( | ||
github.com/jackc/pgpassfile v1.0.0 // indirect | ||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect | ||
github.com/jackc/puddle/v2 v2.2.2 // indirect | ||
github.com/kr/text v0.2.0 // indirect | ||
golang.org/x/crypto v0.27.0 // indirect | ||
golang.org/x/sync v0.8.0 // indirect | ||
golang.org/x/text v0.18.0 // indirect | ||
) |
Oops, something went wrong.