Documentation Index
Fetch the complete documentation index at: https://mintlify.com/4rt21/backend-proyecto/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart Guide
This guide will walk you through setting up the FalconAlert API and making your first authenticated request.Prerequisites
Before you begin, ensure you have the following installed:- Node.js v18 or higher
- npm (comes with Node.js)
- MySQL 8.0 or higher
- Git for cloning the repository
- A code editor like VS Code
Installation
Install Dependencies
Install all required npm packages:This will install key dependencies including:
@nestjs/core- NestJS framework@nestjs/jwt- JWT authenticationmysql2- MySQL database driverclass-validator- Request validation- And many more…
Set Up MySQL Database
Create the database and import the schema:This creates the
Ofraud database with all necessary tables for users, reports, categories, upvotes, and notifications.Configure Environment Variables
Create a Add your MySQL configuration:
.env file in the root directory:Replace
<your_user> and <your_password> with your MySQL credentials.Start the Server
Launch the development server:You should see output indicating the server is running:
Making Your First API Call
Let’s walk through a complete authentication flow and make your first authenticated request.1. Register a New User
Create a new user account by sending a POST request to/users/register:
Role IDs:
1= Mobile user2= Web/Admin user
happy_john842.2. Login and Get Tokens
Authenticate with your credentials to receive JWT tokens:3. Make an Authenticated Request
Use your access token to fetch your user profile:4. Create Your First Report
Now let’s create a fraud report:Categories represent different types of fraud:
1= Phishing2= Fake e-commerce3= Investment scams4= Tech support fraud5= General fraud
5. Retrieve All Reports
Fetch a list of all reports (with optional filtering):Common Status Codes
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request succeeded |
| 201 | Created | Resource created successfully |
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Missing or invalid authentication |
| 404 | Not Found | Resource doesn’t exist |
| 409 | Conflict | Resource already exists (e.g., duplicate email) |
Next Steps
Now that you have the API running:Authentication Guide
Learn about JWT tokens, refresh flows, and securing endpoints
API Reference
Explore all available endpoints and their parameters
Swagger Documentation
Visit
http://localhost:3000/docs for interactive API testingWebSocket Events
Set up real-time notifications for reports
Troubleshooting
Database connection failed
Database connection failed
Verify your
.env file has the correct MySQL credentials and that the MySQL service is running:Port 3000 already in use
Port 3000 already in use
Change the port by setting the
PORT environment variable:Invalid token errors
Invalid token errors
Ensure you’re including the Bearer prefix:Check that your access token hasn’t expired (1 hour lifetime).
Email already exists
Email already exists
Each user must have a unique email. Use a different email address or delete the existing user from the database.