Quick Start Guide
This guide will help you set up and run the SGRH system on your local development environment.Prerequisites
Before you begin, ensure you have the following installed:.NET SDK 8
MySQL Server
Install MySQL Server 8.0 or higher
The current code references SQL Server in
Program.cs, but the README specifies MySQL. You may need to adjust the connection configuration.Visual Studio 2022 or VS Code
Install one of the following:
- Visual Studio 2022 (Community, Professional, or Enterprise)
- Visual Studio Code with C# extension
Git (Optional)
Install Git for version control
Installation
1. Clone or Download the Repository
2. Restore Dependencies
Restore NuGet packages for all projects:3. Configure the Database
Update Connection String
Edit theappsettings.json file in the SGRH.Api project:
SGRH.Api/appsettings.json
Configure for MySQL
If using MySQL (as per README), updateProgram.cs:
SGRH.Api/Program.cs
4. Create the Database
Apply Entity Framework migrations to create the database schema:If you encounter errors, ensure your database server is running and the connection string is correct.
Running the Application
Running the API
Running with Visual Studio
Exploring the API
Current API Status
The API controllers are currently under development. The project has a complete domain layer with rich business logic, but the HTTP endpoints are not yet implemented.
Available Endpoint
The only currently implemented endpoint is for database connectivity testing:What’s Implemented
While the API endpoints aren’t built yet, the following layers are complete:Domain Models
All business entities with full logic
- Cliente, Reserva, Habitacion
- State machines and business rules
- Domain policies and validation
Persistence
Complete EF Core configuration
- Entity configurations
- Database context
- Migration support
CQRS Structure
Application layer organized
- Command/Query folders
- DTO structures
- Ready for implementation
Clean Architecture
Proper layer separation
- Domain independence
- Dependency inversion
- Testable design
Exploring with Swagger
The Swagger UI is available and shows the current API surface:/api/test-db/ping endpoint.
Running the Web Client
The Blazor web client consumes the API:Running the Desktop Client
Select Target Framework
Choose your target platform from the dropdown:
- Windows Machine
- Android Emulator
- iOS Simulator (macOS only)
Configuration
Environment-Specific Settings
SGRH supports multiple environments:appsettings.json- Base configurationappsettings.Development.json- Development overridesappsettings.Production.json- Production settings
AWS Configuration
If you want to use AWS services (S3, SES):Configure AWS Credentials
Set up AWS credentials using one of these methods:Option 1: AWS CLIOption 2: Environment Variables
AWS integration is optional. The system can run without it, but file storage and email features will not be available.
JWT Authentication
Configure JWT settings inappsettings.json:
Troubleshooting
Database Connection Issues
Problem: Cannot connect to database Solutions:-
Verify MySQL/SQL Server is running:
-
Test connection string:
- Check firewall settings allowing database port access
Migration Errors
Problem:dotnet ef database update fails
Solutions:
-
Install EF Core tools globally:
-
Ensure you’re in the correct directory:
-
Rebuild the solution:
Port Already in Use
Problem: Port 5000 or 7001 is already in use Solution: ModifylaunchSettings.json:
SGRH.Api/Properties/launchSettings.json
Swagger Not Loading
Problem: Swagger UI shows 404 error Solution: Ensure you’re running in Development mode:Next Steps
Architecture Deep Dive
Understand the layered architecture and design patterns
API Reference
Explore detailed API endpoint documentation
Domain Models
Learn about the core domain entities and business logic
Configuration
Configure database, authentication, and AWS services
Development Workflow
Recommended Development Setup
- API First: Always start the API before client applications
- Hot Reload: Use
dotnet watch runfor automatic recompilation - Swagger: Use Swagger UI for API testing during development
- Logging: Check console output for detailed logs
Making Changes
Database Migrations
When you modify entities:Support
If you encounter issues not covered in this guide:- Check the project README for updates
- Review the source code comments
- Consult the Architecture documentation
- Verify all prerequisites are correctly installed
This system is designed for educational and development purposes. Additional configuration may be required for production deployment.