npm i
aws_access_key_id
and aws_secret_access_key
env variables.brew install awscli
in the terminal to install AWS CLIbrew install go
aws configure
to
Authorize SST via AWS CLI
through Lambda to your local environment.env
file in the root directory with the necessary environment
variables found in .env.example.functions/gateway/helpers/cloudflare_locations_template
to => functions/gateway/helpers/cloudflare_locations.go
creating a new file with the .go
extensionconst cfLocations = `<replace me>`
in the cloudflare_locations.go
file and replace the <replace me>
(keep the wrapping backtick characters) with the JSON from speed.cloudflare.com/locations... this file is used to intercept incoming request headers and look at the Request['Headers']['Cf-Ray']
string, which terminates with a 3 letter code like EWR
which correlates with an iata
airport code. This is the Cloudflare datacenter serving the request
APEX_URL
from your local deployment to the allow lists for both Redirect and Post Logout URls in Zitadel under Redirect Settings in the admin UI following the existing URL path schema for bothnpm run dev
to run the Go Lambda Gateway V2 server locally,
proxied through Lambda to your local, and using SST deployed AWS resources
for DB, etc..zshrc
/ .bashrc
export GOPATH=$HOME/go
go install github.com/a-h/templ/cmd/templ@latest
templ generate
npm run dev
should finish with an AWS endpoint, hitting that endpoint should
show a list of events in that particular stage's dynamoDb table
For auth to work, you must add your AWS local deployment's URL to Zitadel's callback URLs our app-specific redirect settings
Redirect URIs
and suffix it like
https://{instance-id}.execute-api.us-east-1.amazonaws.com/auth/callback
Post- Logout URIs
, your deployment URL looks
like this https://{instance-id}.execute-api.us-east-1.amazonaws.com
curl <AWS URL from npm run dev>/api/event
- list table
Events
curl -X POST -H 'Content-Type: application/json' --data-raw $'{"events":[{"eventOwners":["123"],"name":"Espanola Lowriders Good Friday Rally & Bar Crawl","description":"Join us in the low rider capital of the world while we hit up all TWO of our local bars\u0021 You haven\'t seen a real lowrider if you haven\'t visited Espanola\u0021","startTime":"2025-02-15T18:30:00Z","address":"Espanola, NM","lat": 36.015303,"long":-106.066063}]}' <AWS URL from npm run dev>/api/event
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dynamodb/index.html
If you see an error like
(!) templ version check failed: generator v0.2.513 is older than templ version v0.2.648 found in go.mod file, consider upgrading templ CLI
,
you need to update the templ
go binary
go install github.com/a-h/templ/cmd/templ@latest
For an overview of our current env vars with an explanation of each, look at .env.example
When updating env vars, the changes need to be made in 4 places:
stacks/ApiStack.ts
.github/actions/set_aws_creds_env_vars/action.yml
(inputs
section).github/actions/set_aws_creds_env_vars/action.yml
(run
section where vars
are echo
d).env.example
to clarify in version control what our currently-used env vars
areFor *.meetnear.me
and *.devnear.me
there is some custom configuration
required at the API Gateway level, DNS nameserver level, and Route53
configuration level
*.me
TLD can't be registered
through Amazon, so it's handled through Namecheap.com.
Create
.devnear.me
ACM Certificate
if this is a new domain, you might need to click
Create a new ACM CertificateCreate Records in Route53
to verify domain
ownership for the certAPI Gateway
>
Custom Domains
in the AWS consoleCreate
devnear.me
(your newly created Custom Domain Name) >
Configure API MappingsAPI
value to the Cloudformation resource you want to map to
devnear.me
A
records are set
correctly. If they are, the Value
for the A
record will be (slightly
confusingly) d-<alpha-numeric>.execute-api.us-east-1.amazonaws.com
. This
should be different from the ApiEndpoint
seen in Github Actions output
for the deployment, which typically looks like
ApiEndpoint: https://<alpha-numeric>.execute-api.us-east-1.amazonaws.com
.
The alpha-numeric characters will not match, and the correct A
record
should be prefixed with d-
$ docker compose build
$ docker compose up