This project implements a simplify mode of Clean Architecture
The project code base is mainly located within the src
folder. This folder is divided in:
bounded-context
- containing code base and configuration for your lambda functionsshared
- containing shared code base between your lambdas
.
├── tests # Unit tests
├── src
│ ├── bounded-context # Lambda configuration and source code folder
│ │ ├── presentation
│ │ │ ├── handler.ts
│ │ │ ├── index.ts
│ │ │ └── schema.ts
│ │ ├── application # Application business logic (Use cases).
│ │ │ └── UseCase.ts
│ │ ├── domain # Enterprise business logic.
│ │ │ ├── Entity
│ │ │ ├── Failures
│ │ │ └── ValueObjects
│ │ └── infrastructure # Interface to communicate with other contexts. (Local and remote resources), repositories.
│ │
│ └── shared # Lambda shared code
│ └── apiGateway.ts # API Gateway specific helpers
│ └── handlerResolver.ts # Sharable library for resolving lambda handlers
│ └── lambda.ts # Lambda middleware
│
├── package.json
├── serverless.ts # Serverless service file
├── tsconfig.json # Typescript compiler configuration
├── tsconfig.paths.json # Typescript paths
└── webpack.config.js # Webpack configuration
Before you can work with this project, you must install and configure the following products on your development machine:
- AWS CLI on Mac computers, it's easier to install it using Homebrew:
brew install awscli
- Git and/or the GitHub app (for Mac or Windows)
- Node.js - Current version v14
- Serverless
- Docker
- Yarn
It is recommendable to install node via NVM
- Log in into Aws Console
- Expand Aws Account --> Command line or programmatic access
- Find and copy AWS Access Key ID and AWS Secret Access Key
Now you have the information required to create a credential file:
# Run
> aws configure
# Required Data
> AWS Access Key ID [None]: XXXXXXXXXXXXXXXXXXXXX
> AWS Secret Access Key [None]: XXXXXXXXXXXXXXXXXXXXX
> Default region name [None]: us-east-1
> Default output format [None]: json
Now validate that changes have been saved
cat ~/.aws/credentials
> export AWS_PROFILE=your-aws-profile
Clone this repository:
- Log in to your GitHub account GitHub and follow the instruction below:
# Clone
> git clone https://github.com/G33N/serverless-clean-architecture-template.git
# Go to the sources directory:
> cd serverless-clean-architecture-template
Next, install the JavaScript modules needed to build and test the app:
# Install project dependencies (package.json)
> yarn
How to run your local environment.
yarn aws-sso-login
yarn sso-login
To test it, issue the following command
yarn invoke:hello