This project is a serverless application designed to manage customer data.
This endpoint enables clients to retrieve a list of customers.
- Method: GET
- Endpoint:
/api/customers
- Query Parameters:
name
: string (optional)email
: string (optional)telephone
: string (optional)
- Headers:
x-api-key
: YOUR_API_KEY
This endpoint allows clients to retrieve a list of customers near specified x, y geopoints.
- Method: GET
- Endpoint:
/api/customers/nearby
- Headers:
x-api-key
: YOUR_API_KEY
This endpoint enables clients to create a new customer.
- Method: POST
- Endpoint:
/api/customers
- Body:
name
: string (required)email
: string (required)telephone
: string (required)coordinate_y
: number (required)coordinate_x
: number (required)
- Headers:
x-api-key
: YOUR_API_KEY
-
Install Dependencies:
- Run
npm install
to install project dependencies.
- Run
-
Run Docker Compose:
- Execute
docker compose up db -d
to start the Postgres database.
- Execute
-
Set Environment Variables:
- Ensure that your
env.yml
file is properly configured.
- Ensure that your
-
Run Locally:
- Execute
sls offline
to run the project locally.
- Execute
-
Access Endpoints:
- Use the provided endpoints (e.g.,
/api/customers
) with the appropriate HTTP methods.
- Use the provided endpoints (e.g.,
Note: Make sure you have Serverless Framework installed (npm install -g serverless
) and configured with your cloud provider credentials.

.
├── README.md
├── database
│ └── migrations
│ └── create_customers_table.sql
├── docker-compose.yml
├── env.yml
├── functions
│ └── api
│ ├── create-customer
│ │ ├── index.js
│ │ └── params-validator.js
│ ├── list-customers
│ │ └── index.js
│ └── nearby-customers
│ └── index.js
├── infra
│ ├── api-gateway
│ │ ├── auth-response.yml
│ │ └── cors.yml
│ └── lambda
│ ├── create-customer.yml
│ ├── list-customers.yml
│ └── nearby-customers.yml
├── lib
│ ├── calculate-distance.js
│ ├── database-client.js
│ └── responses.js
├── package-lock.json
├── package.json
├── repositories
│ └── customers-repository.js
├── scripts
│ └── start-local.sh
└── serverless.yml