Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aazme/the-coworking-space-app
https://github.com/aazme/the-coworking-space-app
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/aazme/the-coworking-space-app
- Owner: Aazme
- Created: 2024-03-18T09:06:46.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-09-18T22:48:09.000Z (4 months ago)
- Last Synced: 2024-11-06T17:52:29.752Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 60.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This Node.js application provides CRUD operations for managing spaces, along with Swagger documentation, logging, and commit message enforcement.
## Table of Contents
- [Space Management API](#space-management-api)
- [Table of Contents](#table-of-contents)
- [Features](#features)
- [Setup](#setup)
- [Clone the Repository](#clone-the-repository)
- [Install Dependencies](#install-dependencies)
- [Set Up Environment Variables](#set-up-environment-variables)
- [Seed the database](#seed-the-database)
- [Start the Server](#start-the-server)
- [Twelve-Factor Apps](#twelve-factor-apps)
- [Packaging the Helm Chart](#packaging-the-helm-chart)
- [TODOs](#todos)- CRUD operations for managing spaces (Create, Read, Update, Delete)
- Swagger documentation for exploring and testing the APIs
- Logging using Winston to log incoming requests, successful operations, and errors
- Seed script to populate the database with initial data
- Husky and Commitizen integration for enforcing conventional commit messages (npm run commit)
- Metrics for monitoring the application's performance
- No Secrets in the code, all managed through .env file
- Helm chart for packaging the application for deployment to Kubernetes
- Includes hooks for running database migrations and seeding the database
- Includes Test suite for testing the application after deployment```bash
git clone https://github.com/Aazme/coworking-space-api
cd coworking-space-api
```
### Install Dependencies```bash
npm install
```
### Set Up Environment VariablesCreate a `.env` file in the project root and define the following variables:
```dotenv
PORT=3000
MONGODB_CONNECTION=
```Replace `` with your MongoDB connection string.
### Seed the database
```bash
npm run seed
```
### Start the Server```bash
npm run dev
```- Access the Swagger documentation at [http://localhost:3000/api-docs](http://localhost:3000/api-docs) to explore and test the APIs.
- Use Husky and Commitizen for creating commit messages following the conventional format.
- Access the metrics at [http://localhost:3000/metrics](http://localhost:3000/metrics) to monitor the application's performance.- The application follows the Twelve-Factor Apps methodology for better scalability, maintainability, and portability.
- Environment variables are used for configuration, ensuring the application is easily deployable across different environments.
- Metrics are exposed as an endpoint, allowing the application to be monitored and managed easily.
- The application is stateless, allowing it to be easily scaled horizontally.
- The application is self-contained, with all dependencies and configuration managed through the package.json and .env files.To package the Helm chart for deployment, follow these steps:
1. **Navigate to the Charts Folder**: Open your terminal and navigate to charts folder.
2. **Package the Helm Chart**: Use the Helm CLI to package the Helm chart. Run the following command:
```bash
helm package .
```
3. **Verify Packaged Chart**: Once the packaging process is complete, you should see a .tgz file created in the current directory. You can verify the packaged chart by listing the files in the directory:
4. **Use the Packaged Chart**: You can now use the packaged chart to deploy the application to a Kubernetes cluster. Run the following command to deploy the application using the packaged chart:
```bash
helm install coworking-space-api-release coworking-space-api-0.1.0.tgz
```
Replace `coworking-space-api-release` with the name you want to give to the release and `coworking-space-api-0.1.0.tgz` with the name of the packaged chart file.The application will be deployed to the Kubernetes cluster using the packaged chart.
5. **Verify the Deployment**: You can verify the deployment by listing the releases in the cluster:
```bash
helm list
```
You should see the release you created listed in the output.6. **Test the helm chart**: You can test the helm chart by running the following command:
```bash
helm test coworking-space-api-release
```
Replace `coworking-space-api-release` with the name of the release you created.7. **Access the Application**: You can access the application by navigating to the URL of the Kubernetes cluster. The application will be running in the cluster, and you can access it using the URL provided by your cloud provider.
## TODOs
- [ ] Add unit tests
- [ ] Automate the deployment process to Kubernetes using CI/CD
- [ ] Add authentication and authorization
- [ ] Implement rate limiting and request validation