Skip to main content

Prerequisites

Before you begin, ensure you have the following installed on your development machine:

Required Software

.NET 10.0 SDK

Download and install the latest .NET 10.0 SDK from the official Microsoft website

SQL Server

SQL Server 2019 or later (Express Edition is sufficient for development)

IDE

Visual Studio 2022 (recommended) or Visual Studio Code with C# extension

Git

Git for version control

Verify Installation

Verify that .NET 10.0 is installed correctly:
dotnet --version
You should see version 10.0.x or later.

Getting Started

1

Clone the Repository

Clone the DonaSF backend repository to your local machine:
git clone <repository-url>
cd DonaSF-Back
2

Configure Database Connection

Create a Conf.txt file in the ServiciosConsolaCentralizada directory with your SQL Server connection details:
SERVER_NAME\INSTANCE:DATABASE_NAME:USERNAME:PASSWORD
Example:
localhost\SQLEXPRESS:WSDonaciones:sa:YourPassword123
The format is: Server:Database:User:Password separated by colons
3

Create the Database

Run the database creation script to set up the required tables and stored procedures:For Package Management Database:
sqlcmd -S SERVER_NAME\INSTANCE -U USERNAME -P PASSWORD -i ServiciosConsolaCentralizada/Database/Script/BDPaqueteria.sql
For Donations Database:
sqlcmd -S SERVER_NAME\INSTANCE -U USERNAME -P PASSWORD -i ServiciosConsolaCentralizada/Database/ScriptDonaciones/Donaciones.sql
Alternatively, you can open these SQL files in SQL Server Management Studio (SSMS) and execute them manually.
The scripts will create databases named WSPaqueteria and WSDonaciones with all necessary tables, stored procedures, and initial data
4

Restore NuGet Packages

Navigate to the solution directory and restore all dependencies:
dotnet restore PaqueteriaWS.sln
This will install the following key packages:
  • Microsoft.AspNetCore.Authentication.JwtBearer (10.0.0)
  • Microsoft.Data.SqlClient (6.1.3)
  • Newtonsoft.Json (13.0.4)
  • Swashbuckle.AspNetCore (10.0.1)
  • Twilio (7.13.7)
5

Build the Solution

Build the entire solution to ensure all projects compile correctly:
dotnet build PaqueteriaWS.sln
The solution contains four projects:
  • ServiciosConsolaCentralizada: Main API project
  • BussinesRuls: Business logic layer
  • DataManagment: Data access layer
  • Objects: Shared objects and constants
6

Configure Application Settings

Update the appsettings.json file in the ServiciosConsolaCentralizada directory with your configuration:
{
  "Jwt": {
    "Key": "your-secure-key-min-32-characters-long",
    "Expires": 3600
  },
  "CorreosElectronicos": {
    "Correo1": "[email protected]",
    "Correo2": "[email protected]",
    "Correo3": "[email protected]"
  }
}
See the Configuration Guide for detailed information about each setting.
7

Run the Application

Start the development server:
cd ServiciosConsolaCentralizada
dotnet run
In development mode, the API will:
  • Detect your local IP address
  • Start on http://YOUR_IP:5005
  • Automatically open Swagger UI in your default browser
You should see the Swagger documentation interface at http://YOUR_IP:5005/swagger

Project Structure

Understanding the solution architecture:
DonaSF-Back/
├── ServiciosConsolaCentralizada/    # Main API project
│   ├── Controllers/                  # API endpoints
│   ├── Database/                     # SQL scripts
│   │   ├── Script/                  # Database creation scripts
│   │   ├── ScriptDonaciones/        # Donation-specific scripts
│   │   └── Stored Procedures/       # Stored procedures
│   ├── Program.cs                    # Application entry point
│   ├── appsettings.json             # Configuration
│   └── Conf.txt                     # Database connection file
├── BussinesRuls/                    # Business logic
├── DataManagment/                   # Data access layer
├── Objects/                         # Domain objects
└── PaqueteriaWS.sln                # Solution file

Running with Visual Studio

If you’re using Visual Studio 2022:
  1. Open PaqueteriaWS.sln
  2. Set ServiciosConsolaCentralizada as the startup project (right-click → Set as Startup Project)
  3. Ensure Conf.txt exists with your database connection
  4. Press F5 to run with debugging or Ctrl+F5 to run without debugging

Troubleshooting

If you see connection errors:
  • Verify Conf.txt format is correct: Server:Database:User:Password
  • Ensure SQL Server is running and accessible
  • Check that the database name matches the one in Conf.txt
  • Verify SQL Server authentication is enabled (if using SQL Server auth)
  • Confirm the TrustServerCertificate setting is properly configured
If port 5005 is already in use:
  • Modify the port in Program.cs (line 42)
  • Or kill the process using the port:
# On Windows
netstat -ano | findstr :5005
taskkill /PID <process_id> /F

# On Linux/Mac
lsof -ti:5005 | xargs kill -9
If authentication fails:
  • Ensure the JWT Key in appsettings.json is at least 32 characters
  • Verify the token hasn’t expired (default is 3600 seconds = 1 hour)
  • Check that the Authorization header includes “Bearer ” prefix
If you encounter missing package errors:
dotnet clean
dotnet restore --force
dotnet build

Next Steps

Configuration

Learn about configuring JWT, database, and email settings

API Reference

Explore available endpoints and authentication

Deployment

Deploy your API to production

Architecture

Understand the system architecture

Build docs developers (and LLMs) love