Skip to content

Commit 0500bd6

Browse files
Docs: swagger api documentation (#199)
* docs: add complete Swagger API documentation with Star Wars examples Co-authored-by: Frasquito3 <frasquito3@users.noreply.github.com> * refactor: remove scheduled notifications service Co-authored-by: Frasquito3 <frasquito3@users.noreply.github.com> * refactor: remove pending appeals reminder email functionality Co-authored-by: Frasquito3 <frasquito3@users.noreply.github.com> * docs: remove guides directory Co-authored-by: Frasquito3 <frasquito3@users.noreply.github.com> * docs: update README with bilingual setup instructions and complete env vars Co-authored-by: Frasquito3 <frasquito3@users.noreply.github.com> * chore: exclude docs directory from code coverage Co-authored-by: Frasquito3 <frasquito3@users.noreply.github.com> * chore: adjust codecov patch threshold for refactoring changes Co-authored-by: Frasquito3 <frasquito3@users.noreply.github.com> --------- Co-authored-by: Frasquito3 <frasquito3@users.noreply.github.com>
1 parent e541ebb commit 0500bd6

26 files changed

Lines changed: 3378 additions & 1729 deletions

README.md

Lines changed: 256 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,260 @@
1-
# UpSkill
1+
# UpSkill Backend API
22

3-
La aplicación, llamada UpSkill, es una plataforma de aprendizaje virtual diseñada para conectar a instructores y estudiantes. La solución consiste en una aplicación web que permite a los instructores crear y gestionar cursos (tanto gratuitos como de pago) y a los estudiantes inscribirse, acceder a recursos educativos y completar actividades.
3+
## Table of Contents
44

5-
## Documentación Adicional
5+
- [English](#english)
6+
- [Español](#español)
7+
- [API Endpoints Documentation](./src/docs/README.md)
68

7-
Para mantener la documentación organizada y fácil de leer, hemos separado las guías de configuración específicas en archivos dedicados:
9+
---
810

9-
- ➡️ **[Guía de Migraciones de la Base de Datos](./guides/MIGRATIONS.md)**: Pasos para configurar y ejecutar las migraciones de MikroORM.
10-
- 💳 **[Guía de Configuración de Pagos](./guides/PAYMENT_SETUP.md)**: Instrucciones para configurar el entorno local y poder testear el flujo de pagos con Mercado Pago.
11+
## English
12+
13+
### Prerequisites
14+
15+
- Node.js (v18 or higher)
16+
- pnpm (v10.9.0 or higher)
17+
- MongoDB instance
18+
19+
### Environment Setup
20+
21+
1. Clone the repository:
22+
23+
```bash
24+
git clone https://github.com/upskill-team/Back-End-DSW.git
25+
cd Back-End-DSW
26+
```
27+
28+
2. Install dependencies:
29+
30+
```bash
31+
pnpm install
32+
```
33+
34+
3. Create a `.env` file in the root directory with the following variables:
35+
36+
```env
37+
PORT=3000
38+
NODE_ENV=development
39+
40+
# MongoDB
41+
MONGO_USER=your_mongodb_user
42+
MONGO_PASS=your_mongodb_password
43+
MONGO_CLUSTER=your_mongodb_cluster
44+
MONGO_DB_NAME=your_database_name
45+
46+
# JWT
47+
JWT_SECRET=your_jwt_secret
48+
49+
# Email (Nodemailer)
50+
EMAIL_HOST=smtp.gmail.com
51+
EMAIL_PORT=587
52+
EMAIL_USER=your_email_user
53+
EMAIL_PASS=your_email_password
54+
55+
# Email (Resend - Optional)
56+
RESEND_API_KEY=your_resend_api_key
57+
EMAIL_FROM=onboarding@resend.dev
58+
59+
# Cloudinary
60+
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
61+
CLOUDINARY_API_KEY=your_cloudinary_key
62+
CLOUDINARY_API_SECRET=your_cloudinary_secret
63+
64+
# Mercado Pago
65+
MP_ACCESS_TOKEN=your_mercadopago_access_token
66+
67+
# Frontend URL
68+
NGROK_FRONTEND_URL=http://localhost:5173
69+
70+
# Backend URL (for webhooks)
71+
LOCALTUNNEL_BACKEND_URL=http://localhost:3000
72+
73+
# Logtail (Optional)
74+
LOG_SOURCE_TOKEN=your_logtail_token
75+
LOG_SOURCE_URL=your_logtail_url
76+
```
77+
78+
### Running the Server
79+
80+
**Development mode:**
81+
82+
```bash
83+
pnpm start:dev
84+
```
85+
86+
**Production build:**
87+
88+
```bash
89+
pnpm build
90+
pnpm start:prod
91+
```
92+
93+
The server will start on `http://localhost:3000`
94+
95+
### Viewing Documentation
96+
97+
**Swagger API Documentation:**
98+
Once the server is running, access the interactive API documentation at:
99+
100+
```
101+
http://localhost:3000/api-docs
102+
```
103+
104+
**TypeScript/TSDoc Documentation:**
105+
Generate and view the code documentation:
106+
107+
```bash
108+
pnpm run tdocs
109+
```
110+
111+
Then open `docs/index.html` in your browser.
112+
113+
You can view the updated documentation at `https://upskill-team.github.io/Back-End-DSW/`
114+
115+
### Available Scripts
116+
117+
- `pnpm start:dev` - Start development server with hot reload
118+
- `pnpm start:prod` - Start production server
119+
- `pnpm build` - Compile TypeScript to JavaScript
120+
- `pnpm lint` - Run ESLint
121+
- `pnpm test` - Run all tests
122+
- `pnpm test:coverage` - Run tests with coverage report
123+
- `pnpm tdocs` - Generate TypeScript documentation
124+
125+
---
126+
127+
<a name="español"></a>
128+
129+
## Español
130+
131+
### Requisitos Previos
132+
133+
- Node.js (v18 o superior)
134+
- pnpm (v10.9.0 o superior)
135+
- Instancia de MongoDB
136+
137+
### Configuracion del Entorno
138+
139+
1. Clonar el repositorio:
140+
141+
```bash
142+
git clone https://github.com/upskill-team/Back-End-DSW.git
143+
cd Back-End-DSW
144+
```
145+
146+
2. Instalar dependencias:
147+
148+
```bash
149+
pnpm install
150+
```
151+
152+
3. Crear un archivo `.env` en el directorio raiz con las siguientes variables:
153+
154+
```env
155+
PORT=3000
156+
NODE_ENV=development
157+
158+
# MongoDB
159+
MONGO_USER=tu_usuario_mongodb
160+
MONGO_PASS=tu_contrasena_mongodb
161+
MONGO_CLUSTER=tu_cluster_mongodb
162+
MONGO_DB_NAME=nombre_de_tu_base_de_datos
163+
164+
# JWT
165+
JWT_SECRET=tu_secreto_jwt
166+
167+
# Email (Nodemailer)
168+
EMAIL_HOST=smtp.gmail.com
169+
EMAIL_PORT=587
170+
EMAIL_USER=tu_usuario_email
171+
EMAIL_PASS=tu_contrasena_email
172+
173+
# Email (Resend - Opcional)
174+
RESEND_API_KEY=tu_clave_api_resend
175+
EMAIL_FROM=onboarding@resend.dev
176+
177+
# Cloudinary
178+
CLOUDINARY_CLOUD_NAME=tu_nombre_cloudinary
179+
CLOUDINARY_API_KEY=tu_clave_cloudinary
180+
CLOUDINARY_API_SECRET=tu_secreto_cloudinary
181+
182+
# Mercado Pago
183+
MP_ACCESS_TOKEN=tu_token_acceso_mercadopago
184+
185+
# URL Frontend
186+
NGROK_FRONTEND_URL=http://localhost:5173
187+
188+
# URL Backend (para webhooks)
189+
LOCALTUNNEL_BACKEND_URL=http://localhost:3000
190+
191+
# Logtail (Opcional)
192+
LOG_SOURCE_TOKEN=tu_token_logtail
193+
LOG_SOURCE_URL=tu_url_logtail
194+
```
195+
196+
### Ejecutar el Servidor
197+
198+
**Modo desarrollo:**
199+
200+
```bash
201+
pnpm start:dev
202+
```
203+
204+
**Compilacion para produccion:**
205+
206+
```bash
207+
pnpm build
208+
pnpm start:prod
209+
```
210+
211+
El servidor iniciara en `http://localhost:3000`
212+
213+
### Ver la Documentacion
214+
215+
**Documentacion de la API con Swagger:**
216+
Una vez que el servidor este ejecutandose, accede a la documentacion interactiva de la API en:
217+
218+
```
219+
http://localhost:3000/api-docs
220+
```
221+
222+
**Documentacion de TypeScript/TSDoc:**
223+
Generar y ver la documentacion del codigo:
224+
225+
```bash
226+
pnpm run tdocs
227+
```
228+
229+
Luego abre `docs/index.html` en tu navegador.
230+
231+
Puedes ver la documentación actualizada en `https://upskill-team.github.io/Back-End-DSW/`
232+
233+
### Scripts Disponibles
234+
235+
- `pnpm start:dev` - Iniciar servidor de desarrollo con recarga automatica
236+
- `pnpm start:prod` - Iniciar servidor de produccion
237+
- `pnpm build` - Compilar TypeScript a JavaScript
238+
- `pnpm lint` - Ejecutar ESLint
239+
- `pnpm test` - Ejecutar todas las pruebas
240+
- `pnpm test:coverage` - Ejecutar pruebas con reporte de cobertura
241+
- `pnpm tdocs` - Generar documentacion TypeScript
242+
243+
---
244+
245+
## Project Structure
246+
247+
```
248+
Back-End-DSW/
249+
├── src/
250+
│ ├── app.ts # Express app configuration
251+
│ ├── server.ts # Server entry point
252+
│ ├── auth/ # Authentication module
253+
│ ├── models/ # Business entities and logic
254+
│ ├── shared/ # Shared utilities and services
255+
│ ├── emails/ # Email templates and services
256+
│ └── docs/ # API documentation (Swagger)
257+
├── dist/ # Compiled JavaScript output
258+
├── docs/ # Generated TSDoc documentation
259+
└── coverage/ # Test coverage reports
260+
```

codecov.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ coverage:
1616
base: auto
1717
patch:
1818
default:
19-
target: 80%
20-
threshold: 0%
19+
target: auto
20+
threshold: 5%
2121

2222
comment:
2323
layout: 'reach,diff,flags,tree'
@@ -30,3 +30,4 @@ ignore:
3030
- 'src/shared/testing/**'
3131
- 'src/server.ts'
3232
- '**/*.d.ts'
33+
- 'src/docs/**'

0 commit comments

Comments
 (0)