Create Serverless API

Create Serverless APIs with no infra configuration.

It is an aws serverless-based backend api template created for beginners.

You can service api without knowing the cloud infrastructure.

And Create Serverless API works on macOS, Windows, and Linux.

Create Serverless API was inspired by the create-react-app.

πŸš€Quick Overview

πŸ“Œ Before we proceed with the work below, you must set aws credential

```
npx create-serverless-api my-api
cd my-api
npm bootstrap
npm deploy
```

And Check the api endpoint output to the terminal.

You will have a fully operational api service.

For detail, please refer to the explanation below.

✨Feature

  • Automatic aws infrastructure completion through documents in the OpenAPI specification.
  • Install only essential packages for each API.

Detail Feature

πŸ‘ The detail feature roughly say that this package is very cool.

  • Infrastructure distribution through IaC makes it easy to modify.
  • Using FaaS, monitoring is easy and stability can be obtained by horizontal expansion.
  • Supports monitoring and logging with aws X-ray and aws CloudWatch.
  • Babel settings are set for using typescript.
  • Can execute local test similar to the aws lambda.

Environment in Lambda Container

βœ… You can customize this.

  • Node 14.x

Detail Usage

  • ⚠ Caution
    Following this usage, your api will be serviced as a cloud service.
    You spend money according to the amount of api calls.
    so make sure to check out AWS Pricing Policy.
  1. Login to aws console

  2. Make iam user through aws IAM users.

    • Need Access key credential type.
    • Recommend AdministratorAccess policy through the attachment policies directy button for easy work.
    • Save the access key ID and secret access key that came out like that.
  3. Configurate your aws credentials file

    βœ… Windows default path: C/Users/{userName}/.aws/credentials
    βœ… Linux or macOS default path: ~/.aws/credentials

    [development]
    aws_access_key_id={your_aws_access_key_id}
    aws_secret_access_key={your_aws_secret_access_key}
    
    [production]
    aws_access_key_id={your_aws_access_key_id}
    aws_secret_access_key={your_aws_secret_access_key}
    

    πŸ“Œ If you want to change the name, please change it with the script of package.json

  4. Creating an API

    npx create-serverless-api my-api
    

npx create-serverless-api my-api

  1. Go the project directory.

    cd my-api
    

npx create-serverless-api my-api

  1. Bootstrap for aws deployment.

    // Development
    npm run bootstrap
    
    // Production
    npm run bootstrap-prod
    
  2. Deploy to aws

    βœ… The api is served on the address output to the terminal, so make sure to save it.

    // Development
    npm run deploy
    
    // Production
    npm run deploy-prod
    
  • Local execute

    npm run offline
    
  • Destroy the api

    // Development
    npm run destroy
    
    // Production
    npm run destroy-prod
    

πŸ‘ Contributing

Pull requests and 🌟 stars are always welcome.

For major changes, please open an issue first to discuss what you would like to change.

πŸ“© Contact

[email protected]

Others

πŸ‘ We recommend third-party services that suit the characteristics of serverless services.

  • We recommand Dash Bird service for watch lambda infomations.
  • We recommand Planet Scale service for database server.

GitHub

View Github