-
Notifications
You must be signed in to change notification settings - Fork 0
Using normal structure
License
Ranjith-developer-dev/Serverless-POC-RestAPI
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
# DrillSub Node-Serverless Project Structure This directory structure represents the structure of the DrillSub Node-Serverless project./ │ ├── serverless.yml # Serverless Framework configuration file │ ├── package.json # Node.js project manifest ├── package-lock.json # Lockfile for npm dependencies ├── tsconfig.json # TypeScript configuration │ ├── .env # Environment variables for local development ├── .env.development # Environment variables for development stage ├── .env.test # Environment variables for testing stage │ ├── src/ # Source directory for all your code │ ├── handlers/ # Lambda function handlers │ │ ├── userHandler.ts # Handler for user-related operations │ │ └── serviceHandler.ts # Handler for service-related operations │ │ │ ├── services/ # Business logic services │ │ ├── userService.ts # User service with business logic │ │ └── authService.ts # Authentication service │ │ │ ├── utils/ # Utility functions │ │ └── index.ts # Utility functions and shared helpers │ │ │ ├── lib/ # Additional libraries │ │ └── database.ts # Database configuration and setup │ │ │ ├── middlewares/ # Custom middlewares for Lambda functions │ │ └── errorHandler.ts # Error handling middleware │ │ │ └── config/ # Configuration files │ └── index.ts # Centralized configuration management │ ├── node_modules/ # Installed npm packages │ ├── .gitignore # Ignored files for Git ├── README.md # Project README file ├── .prettierrc # Prettier configuration ├── .prettierignore # Prettier ignore file │ └── scripts/ # Utility scripts └── deploy.sh # Deployment script (optional, can use `serverless deploy` command instead) # DrillSub Node-Serverless Project This repository contains the DrillSub Node-Serverless project, built with the Serverless Framework on AWS. It leverages AWS services such as Lambda, DynamoDB, and Cognito to provide a robust backend solution. ## Features - **AWS Lambda**: Serverless compute service to run the backend logic. - **Amazon DynamoDB**: NoSQL database service for scalable and fast data storage. - **Amazon Cognito**: Service for handling user authentication and authorization. - **Prettier**: Code formatting tool integrated to ensure consistent code style. ## Getting Started ### Prerequisites - Node.js (v20.x) - NPM (v10.x) - Serverless Framework - AWS CLI configured with appropriate permissions - Java Runtime Environment (JRE) for running DynamoDB locally ### Installation 1. Clone the repository: ```bash git clone [email protected]:bitcot/drillsub-node-serverless.git cd drillsub-node-serverless ``` 2. Install NPM dependencies: ```bash npm install ``` 3. Install DynamoDB Local (if not already installed): ```bash sls dynamodb install ``` 4. Configure environment variables by copying the .env.development template: ```bash cp .env.development .env ``` ### Running the project 1. To start the local development server with Serverless Offline and DynamoDB Local: ```bash npm run offline ``` 2. To deploy the project to AWS: ```bash npm run deploy ``` ### Secrets for the project 1. Secrets are stored in AWS Secrets Manager. 2. To get the secrets in the project: ```bash npm run predepoly ``` ### Code Formatting with Prettier This project uses Prettier to ensure consistent code formatting. The configuration can be found in the .prettierrc file. 1. Checking format: ```bash npm run prettier-check ``` 2. Formatting: ```bash npm run prettier-write ``` ### By storing secrets in AWS parameters store we can access that on serverless.yml file 1. To store secrets in AWS parameters store: ```bash aws ssm put-parameter --name "/drill/google/client_id" --value "your-google-client-id" --type "SecureString" aws ssm put-parameter --name "/drill/google/client_secret" --value "your-google-client-secret" --type "SecureString" ``` 2. To get secrets from AWS parameters store: ```bash client_id: ${ssm:/drill/google/client_id} client_secret: ${ssm:/drill/google/client_secret} ``` ### VSCode Integration For developers using VSCode, it is recommended to install the Prettier - Code formatter extension and enable "Format on Save" in the editor settings.
About
Using normal structure
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published