Skip to content

drakejin/fiber-aws-serverless

Repository files navigation

fiber-aws-serverless

this is fiber aws serverless example source code. it uses a serverless framework, It's more simple serverless framework than AWS SAM or CDK for beginners.

Sorry AWS, Cheer up. I bought your stocks.

structure

core libraries

project

📦fiber-aws-serverless 
 ┣ 📂cmd
 ┣ 📂const
 ┣ 📂config
 ┣ 📂db
 ┣ 📂docs
 ┃ ┣ 📜todo.http        # like swagger. It's descript for application
 ┃ ┗ 📜aws_diagrams.py  # It can generate aws architecture diagrams
 ┣ 📂model
 ┣ 📂internal       # about business logics
 ┃ ┣ 📂container    # this module is dependency conainer for sharing between application package and service package
 ┃ ┣ 📂app          # this module manage about grpc, http and websocket applications.
 ┃ ┗ 📂service      # about business logics for each domains
 ┣ 📂lambda
 ┃ ┗ 📜main.go      # for serverless main.go
 ┣ 📜main.go        # for dockerize or cli
 ┣ 📜.enc           # It's important, It must have secrets.
 ┣ 📜serverless.yml # it's deploy tool for aws serverless lambda for http
  • dependency inject direction

main => cmd(module) => container(module) => app(module) => service(todo and etc.)

I recommend you first see ./main.go, ./lambda/main..go. It's quite dif

aws architecture

aws architecture

Getting Start

requirements

npm install -g serverless serverless-dotenv-plugin

useful commands

# start server at local
go run main.go http start

# initialize DB
go run main.go gorm init

# deploy
make deploy

# generate docs
make docs

# tail cloudwatchlogs realtime
aws logs tail /aws/lambda/fiber-aws-serverless-alpha-api --follow

API test

see demo docs/todo.http

https://y6dgbjxz50.execute-api.ap-northeast-2.amazonaws.com/alpha/health

References

About

golang + fiber + aws lambda + serverless + http

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published