Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ BLUEPRINT_DB_SCHEMA=public
BLUEPRINT_DB_SSLMODE=disable
REDIS_URL=
RATE_LIMIT_RPS=100 # requests/sec per IP (omit or 0 = disabled)
RATE_LIMIT_BURST=500 # burst capacity (defaults to RPS×5)
RATE_LIMIT_BURST=500 # burst capacity (defaults to RPS×5)
FIREBASE_PROJECT_ID=# Firebase project ID — e.g. my-app-12345 (omit to disable auth)
FIREBASE_SERVICE_ACCOUNT_JSON=# Service account key as a single-line JSON string. Get from: Firebase Console → Project Settings → Service Accounts → Generate new private key
5 changes: 5 additions & 0 deletions backend/cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ func gracefulShutdown(apiServer *http.Server, done chan bool) {
//
// @host localhost:8080
// @BasePath /
//
// @securityDefinitions.apikey BearerAuth
// @in header
// @name Authorization
// @description Firebase ID token — prefix with "Bearer "
func main() {
// Signal-aware context so SIGINT/SIGTERM cancels bootstrap probes immediately.
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
Expand Down
65 changes: 65 additions & 0 deletions backend/docs/swagger/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,42 @@ const docTemplate = `{
}
}
},
"/api/v1/me": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns the authenticated Firebase user's decoded claims. Requires Authorization: Bearer \u003cfirebase-id-token\u003e.",
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Get current user",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FirebaseToken"
}
},
"401": {
"description": "Missing or invalid token",
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}
}
}
}
},
"/health": {
"get": {
"produces": [
Expand Down Expand Up @@ -64,6 +100,27 @@ const docTemplate = `{
}
},
"definitions": {
"handlers.FirebaseToken": {
"type": "object",
"properties": {
"claims": {
"type": "object",
"additionalProperties": {}
},
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"photoUrl": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"handlers.HealthStats": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -99,6 +156,14 @@ const docTemplate = `{
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"description": "Firebase ID token — prefix with \"Bearer \"",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}`

Expand Down
65 changes: 65 additions & 0 deletions backend/docs/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,42 @@
}
}
},
"/api/v1/me": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Returns the authenticated Firebase user's decoded claims. Requires Authorization: Bearer \u003cfirebase-id-token\u003e.",
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Get current user",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.FirebaseToken"
}
},
"401": {
"description": "Missing or invalid token",
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}
}
}
}
},
"/health": {
"get": {
"produces": [
Expand Down Expand Up @@ -58,6 +94,27 @@
}
},
"definitions": {
"handlers.FirebaseToken": {
"type": "object",
"properties": {
"claims": {
"type": "object",
"additionalProperties": {}
},
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"photoUrl": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"handlers.HealthStats": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -93,5 +150,13 @@
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"description": "Firebase ID token — prefix with \"Bearer \"",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}
43 changes: 43 additions & 0 deletions backend/docs/swagger/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
basePath: /
definitions:
handlers.FirebaseToken:
properties:
claims:
additionalProperties: {}
type: object
email:
type: string
name:
type: string
photoUrl:
type: string
uid:
type: string
type: object
handlers.HealthStats:
properties:
error:
Expand Down Expand Up @@ -44,6 +58,29 @@ paths:
summary: Hello World
tags:
- general
/api/v1/me:
get:
description: 'Returns the authenticated Firebase user''s decoded claims. Requires
Authorization: Bearer <firebase-id-token>.'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.FirebaseToken'
"401":
description: Missing or invalid token
schema:
properties:
error:
type: string
type: object
security:
- BearerAuth: []
summary: Get current user
tags:
- auth
/health:
get:
produces:
Expand All @@ -60,4 +97,10 @@ paths:
summary: Health check
tags:
- ops
securityDefinitions:
BearerAuth:
description: Firebase ID token — prefix with "Bearer "
in: header
name: Authorization
type: apiKey
swagger: "2.0"
61 changes: 58 additions & 3 deletions backend/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
module backend

go 1.25.7
go 1.25.8

require (
firebase.google.com/go/v4 v4.20.0
github.com/aws/aws-sdk-go-v2 v1.42.0
github.com/aws/aws-sdk-go-v2/config v1.32.25
github.com/aws/aws-sdk-go-v2/credentials v1.19.24
github.com/aws/aws-sdk-go-v2/service/s3 v1.103.3
github.com/gin-contrib/cors v1.7.7
github.com/gin-gonic/gin v1.12.0
github.com/jackc/pgx/v5 v5.10.0
Expand All @@ -15,34 +20,67 @@ require (
github.com/testcontainers/testcontainers-go v0.42.0
github.com/testcontainers/testcontainers-go/modules/postgres v0.42.0
golang.org/x/time v0.15.0
google.golang.org/api v0.284.0
)

require (
cel.dev/expr v0.25.2 // indirect
cloud.google.com/go v0.123.0 // indirect
cloud.google.com/go/auth v0.20.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
cloud.google.com/go/compute/metadata v0.9.0 // indirect
cloud.google.com/go/firestore v1.22.0 // indirect
cloud.google.com/go/iam v1.11.0 // indirect
cloud.google.com/go/longrunning v1.0.0 // indirect
cloud.google.com/go/monitoring v1.29.0 // indirect
cloud.google.com/go/storage v1.62.1 // indirect
dario.cat/mergo v1.0.2 // indirect
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.32.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.56.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.56.0 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/MicahParks/keyfunc v1.9.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.13 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.29 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.29 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.29 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.30 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.12 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.22 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.29 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.29 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.2.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.31.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.43.3 // indirect
github.com/aws/smithy-go v1.27.1 // indirect
github.com/bytedance/gopkg v0.1.4 // indirect
github.com/bytedance/sonic v1.15.2 // indirect
github.com/bytedance/sonic/loader v0.5.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudwego/base64x v0.1.7 // indirect
github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-connections v0.7.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/ebitengine/purego v0.10.0 // indirect
github.com/envoyproxy/go-control-plane/envoy v1.37.0 // indirect
github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/gabriel-vasile/mimetype v1.4.13 // indirect
github.com/gin-contrib/sse v1.1.1 // indirect
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
Expand All @@ -55,7 +93,12 @@ require (
github.com/go-playground/validator/v10 v10.30.3 // indirect
github.com/goccy/go-json v0.10.6 // indirect
github.com/goccy/go-yaml v1.19.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.16 // indirect
github.com/googleapis/gax-go/v2 v2.22.0 // indirect
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
Expand Down Expand Up @@ -83,13 +126,15 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.3.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/quic-go v0.60.0 // indirect
github.com/sethvargo/go-retry v0.3.0 // indirect
github.com/shirou/gopsutil/v4 v4.26.3 // indirect
github.com/sirupsen/logrus v1.9.4 // indirect
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
github.com/stretchr/testify v1.11.1 // indirect
github.com/tklauser/go-sysconf v0.3.16 // indirect
github.com/tklauser/numcpus v0.11.0 // indirect
Expand All @@ -98,20 +143,30 @@ require (
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.mongodb.org/mongo-driver/v2 v2.6.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.43.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.68.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 // indirect
go.opentelemetry.io/otel v1.43.0 // indirect
go.opentelemetry.io/otel/metric v1.43.0 // indirect
go.opentelemetry.io/otel/sdk v1.43.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect
go.opentelemetry.io/otel/trace v1.43.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.28.0 // indirect
golang.org/x/crypto v0.53.0 // indirect
golang.org/x/mod v0.36.0 // indirect
golang.org/x/net v0.56.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sync v0.21.0 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/text v0.38.0 // indirect
golang.org/x/tools v0.45.0 // indirect
google.golang.org/appengine/v2 v2.0.6 // indirect
google.golang.org/genproto v0.0.0-20260511170946-3700d4141b60 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260511170946-3700d4141b60 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
google.golang.org/grpc v1.81.1 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading
Loading