Skip to content

Commit e45616a

Browse files
authored
docs: add docs for api and portal (#31)
1 parent 21429f1 commit e45616a

File tree

8 files changed

+337
-80
lines changed

8 files changed

+337
-80
lines changed

apps/api/README.md

Lines changed: 18 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,29 @@
1-
<p align="center">
2-
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
3-
</p>
1+
## Get Started
42

5-
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
6-
[circleci-url]: https://circleci.com/gh/nestjs/nest
3+
1. **Installation:** Clone the repository and follow our simple setup guide.
4+
2. **Create Notifications:** Easily create and customize notifications for different channels. Use your own API or our API to update the notification database.
5+
3. **Sit Back and Relax:** Let our app handle the delivery and status tracking.
76

8-
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
9-
<p align="center">
10-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
11-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
12-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
13-
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
14-
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
15-
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
16-
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
17-
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
18-
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
19-
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
20-
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
21-
</p>
22-
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
23-
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
7+
## Documentation
248

25-
## Description
9+
- [Development Setup](docs/development-setup.md)
10+
- [Production Setup](docs/production-setup.md)
11+
- [Usage Guide](docs/usage-guide.md)
12+
- [Block Diagram](docs/block-diagram.md)
13+
- [Database Design](docs/database-design.md)
14+
- [API Documentation](docs/api-documentation.md)
15+
- [API Test Cases](docs/api-test-cases.md)
2616

27-
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
17+
## Contributing
2818

29-
## Installation
19+
We welcome contributions from the community! If you're interested in contributing to the Transcript Summarizer, please take a moment to review our [Contribution Guidelines](../../CONTRIBUTING.md).
3020

31-
```bash
32-
$ npm install
33-
```
21+
Your contributions help make our app even better. Whether you're a developer, designer, or just enthusiastic about enhancing user experiences, we'd love to have you on board.
3422

35-
## Running the app
23+
Before you get started, please familiarize yourself with our guidelines to ensure a smooth collaboration process.
3624

37-
```bash
38-
# development
39-
$ npm run start
40-
41-
# watch mode
42-
$ npm run start:dev
43-
44-
# production mode
45-
$ npm run start:prod
46-
```
47-
48-
## Test
49-
50-
```bash
51-
# unit tests
52-
$ npm run test
53-
54-
# e2e tests
55-
$ npm run test:e2e
56-
57-
# test coverage
58-
$ npm run test:cov
59-
```
60-
61-
## Support
62-
63-
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
64-
65-
## Stay in touch
66-
67-
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
68-
- Website - [https://nestjs.com](https://nestjs.com/)
69-
- Twitter - [@nestframework](https://twitter.com/nestframework)
25+
[Contribution Guidelines](../../CONTRIBUTING.md)
7026

7127
## License
7228

73-
Nest is [MIT licensed](LICENSE).
29+
This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.

apps/api/docs/api-documentation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO

apps/api/docs/api-test-cases.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO

apps/api/docs/development-setup.md

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
# Development Setup
22

3-
This document outlines the steps required to set up your Transcript Summarization for development. By following these steps, you'll be able to run your application locally with the necessary environment variables and database configuration.
3+
This document outlines the steps required to set up your Transcript Summarizer API for development. By following these steps, you'll be able to run your application locally with the necessary environment variables and database configuration.
44

55
## Prerequisites
66

7-
Before setting up Transcript Summarization for development, ensure you have the following prerequisites with the specified versions:
7+
Before setting up Transcript Summarizer API for development, ensure you have the following prerequisites with the specified versions:
88

99
- **NVM (Node Version Manager):** Use NVM to manage Node.js versions.
10-
- **Node.js:** Node.js v20.x or higher can be installed via `nvm` using `nvm install 20` and used with `nvm use 20`.
10+
- **Node.js** Node.js v20.x or higher. Can be installed via `nvm` using `nvm install 20` and used with `nvm use 20`.
1111
- **Git:** Git v2.x or higher.
1212
- **MariaDB:** MariaDB v10.x or higher.
13+
- **Redis:** Redis v6.x or higher
1314

14-
These prerequisites are essential for deploying and running Transcript Summarization in an environment.
15+
These prerequisites are essential for deploying and running Transcript Summarizer API in an environment.
1516

1617
Please make sure to have these versions installed on your development server before proceeding with the setup.
1718

18-
Make sure the MariaDB server is up and running.
19-
# This command checks if the MariaDB server is active and running.
20-
sudo systemctl status mariadb
19+
Make sure Redis and MariaDB server are up and running.
2120

2221
```bash
22+
sudo systemctl status redis
2323
sudo systemctl status mariadb
2424
```
2525

@@ -28,7 +28,7 @@ sudo systemctl status mariadb
2828
1. Clone the repository to your local machine:
2929

3030
```sh
31-
git clone https://github.com/OsmosysSoftware/osm-transcript-summarizer
31+
git clone https://github.com/OsmosysSoftware/osm-transcript-summarizer.git
3232
cd osm-transcript-summarizer/apps/api
3333
```
3434

@@ -41,18 +41,34 @@ sudo systemctl status mariadb
4141
3. Create a `.env` file in the project root and add the required environment variables:
4242

4343
```env
44+
# Server
45+
SERVER_PORT=3000
4446
4547
# Node env
46-
NODE_ENV=development
48+
NODE_ENV=development # Use "development" for graphql playground to work
49+
50+
# Upload folder location
51+
UPLOAD_FOLDER_PATH= # If not present will use "uploads" folder in the root cwd
4752
4853
# Database configuration
49-
DB_TYPE=mariadb
50-
DB_HOST=localhost # use value as transcriptsummary-mariadb in docker
51-
DB_PORT=3333
52-
DB_USERNAME=root
53-
DB_PASSWORD=your-password
54-
DB_NAME=your-database
55-
54+
DB_TYPE=
55+
DB_HOST=transcript-summarizer-mariadb
56+
DB_PORT=
57+
DB_USERNAME=
58+
DB_PASSWORD=
59+
DB_NAME=
60+
MARIADB_DOCKER_PORT= 3307
61+
62+
# Redis configuration
63+
DB_HOST=transcript-summarizer-redis
64+
REDIS_PORT=6379
65+
REDIS_DOCKER_PORT=6379
66+
67+
OPENAI_API_KEY="sk-your api key"
68+
GPT_MODEL="gpt-4o"
69+
70+
# Docker env
71+
COMPOSE_PROJECT_NAME=transcript-summarizer-api
5672
```
5773

5874
Alternatively, use the `.env.example` file instead.
@@ -75,4 +91,4 @@ sudo systemctl status mariadb
7591
npm run start:dev
7692
```
7793

78-
Transcript Summarization will now be running locally at `http://localhost:3000`.
94+
Transcript Summarizer API will now be running locally at `http://localhost:3000`.

apps/api/docs/production-setup.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Production Setup
2+
3+
This document outlines the steps required to set up Transcript Summarizer API for production. Following these steps will ensure that your application is configured properly for a production environment.
4+
5+
## Prerequisites
6+
7+
Before setting up Transcript Summarizer API for production, ensure you have the following prerequisites with the specified versions:
8+
9+
- **NVM (Node Version Manager):** Use NVM to manage Node.js versions.
10+
- **Node.js** Node.js v20.x or higher.
11+
- **Git:** Git v2.x or higher.
12+
- **MariaDB:** MariaDB v10.x or higher.
13+
- **Redis:** Redis v6.x or higher
14+
- **PM2 (Process Manager):** PM2 v5.x or higher.
15+
16+
These prerequisites are essential for deploying and running Transcript Summarizer API in a environment.
17+
18+
Make sure Redis and MariaDB server are up and running.
19+
20+
## Server Configuration
21+
22+
1. **Environment Variables:** Set the necessary environment variables on your production server. These variables include database configuration, SMTP settings, and any other variables your application requires. Ensure the `.env` file is properly configured with production values.
23+
24+
```env
25+
# Server
26+
SERVER_PORT=3000
27+
28+
# Node env
29+
NODE_ENV=development # Use "development" for graphql playground to work
30+
31+
# Upload folder location
32+
UPLOAD_FOLDER_PATH= # If not present will use "uploads" folder in the root cwd
33+
34+
# Database configuration
35+
DB_TYPE=
36+
DB_HOST=transcript-summarizer-mariadb
37+
DB_PORT=
38+
DB_USERNAME=
39+
DB_PASSWORD=
40+
DB_NAME=
41+
MARIADB_DOCKER_PORT= 3307
42+
43+
# Redis configuration
44+
DB_HOST=transcript-summarizer-redis
45+
REDIS_PORT=6379
46+
REDIS_DOCKER_PORT=6379
47+
48+
OPENAI_API_KEY="sk-your api key"
49+
GPT_MODEL="gpt-4o"
50+
51+
# Docker env
52+
COMPOSE_PROJECT_NAME=transcript-summarizer-api
53+
```
54+
55+
Make sure to replace the above example values with appropriate values as per your setup and configuration. Server Port is `3000`, you can update it if you want to use a different port of your choice.
56+
57+
## Building and Preparing
58+
59+
1. **Build the Application:** Before starting the server, build Transcript Summarizer API by running:
60+
61+
```sh
62+
npm run build
63+
```
64+
65+
This command compiles your TypeScript code into JavaScript and generates the necessary build files.
66+
67+
## Starting the Server
68+
### Using PM2
69+
1. **PM2 Configuration:** Create an ecosystem.config.js (or .ts) file to configure PM2. This file defines settings such as the application name, entry point, and other options. For example:
70+
71+
```js
72+
module.exports = {
73+
apps: [
74+
{
75+
name: 'Transcript-Summarizer-API', // Name of your application
76+
script: 'dist/main.js', // Path to the compiled NestJS entry file
77+
instances: 1, // Use max to Automatically scale instances based on CPU cores
78+
autorestart: true, // Auto-restart if the app crashes
79+
watch: false, // Watch for file changes (disable for production)
80+
max_memory_restart: '1G', // Restart if memory usage exceeds 1GB
81+
env: {
82+
NODE_ENV: 'production', // Set the environment to production
83+
},
84+
},
85+
],
86+
};
87+
```
88+
89+
2. **Start the Application with PM2:** Use PM2 to start your application:
90+
91+
```sh
92+
pm2 start ecosystem.config.js
93+
```
94+
95+
To ensure your application starts on system boot:
96+
97+
```sh
98+
pm2 startup
99+
```
100+
101+
Follow instruction given by the command if any.
102+
103+
Save pm2 config:
104+
105+
```sh
106+
pm2 save
107+
```
108+
### Using Docker
109+
110+
**Step 1: Update Environment Variables**
111+
112+
Before using Docker, ensure you've configured the environment variables in your `.env` file correctly. Update values such as `MARIADB_DOCKER_PORT`, `REDIS_DOCKER_PORT`, `REDIS_HOST`, and `DB_HOST` as required for your Docker setup.
113+
114+
**Step 2: Build your docker container**
115+
116+
```bash
117+
docker-compose build
118+
```
119+
120+
**Step 3: Start the Docker Containers**
121+
122+
To start your application within Docker containers, run the following command:
123+
124+
```bash
125+
docker-compose up -d
126+
```
127+
128+
**Step 4: Database Migrations (First-Time Setup)**
129+
130+
For the first-time setup, you need to run database migrations to create the required database tables. Execute the following command:
131+
132+
```bash
133+
docker exec -it transcript-summarizer-api npm run typeorm:run-migrations
134+
```
135+
136+
**Step 5: Update Environment Variables**
137+
138+
If you need to update any environment variable values:
139+
140+
1. Update the values in your `.env` file.
141+
142+
2. Stop the running containers:
143+
144+
```bash
145+
docker-compose down
146+
```
147+
148+
3. Rebuild the Docker containers with the updated environment variables:
149+
150+
```bash
151+
docker-compose build
152+
```
153+
154+
4. Start the Docker containers again:
155+
156+
```bash
157+
docker-compose up -d
158+
```
159+
160+
With these steps, your application should be up and running in Docker with the updated environment variables.
161+
162+
For details on using the application and making API calls, refer to our [Usage Guide](usage-guide.md).

apps/api/docs/usage-guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO

0 commit comments

Comments
 (0)