Sistema Venta is a full-stack point of sale system built with .NET 7.0 and Angular 14. This guide will help you set up both the backend API and frontend application.
Prerequisites
Before you begin, ensure you have the following installed:.NET 7.0 SDK
Download from dotnet.microsoft.com
Node.js 16+
Download from nodejs.org
SQL Server
SQL Server 2019+ or SQL Server Express
Angular CLI
Install globally:
npm install -g @angular/cliInstallation
Set Up the Database
Create a new SQL Server database for the application. You’ll need to execute the database schema script to create the required tables:The database includes the following main entities:
- Rol: User roles and permissions
- Usuario: System users with authentication
- Categoria: Product categories
- Producto: Product catalog with stock management
- Venta: Sales transactions
- DetalleVenta: Line items for each sale
- Menu: Dynamic menu based on user roles
Configure the Backend API
Navigate to the API project and update the connection string:Edit
appsettings.json and set your SQL Server connection string:appsettings.json
Restore Backend Dependencies
Restore NuGet packages for all projects in the solution:The solution includes 7 projects:
- SistemaVenta.API: REST API controllers and configuration
- SistemaVenta.BLL: Business Logic Layer with services
- SistemaVenta.DAL: Data Access Layer with repositories
- SistemaVenta.DTO: Data Transfer Objects
- SistemaVenta.Model: Entity Framework models
- SistemaVenta.IOC: Dependency injection configuration
- SistemaVenta.Utility: Shared utilities and AutoMapper profiles
Run the Backend API
Start the .NET API server:The API will start on You should see output similar to:
https://localhost:7XXX (the exact port will be displayed in the console).Swagger documentation is automatically enabled in development mode. Access it at
https://localhost:7XXX/swaggerConfigure the Frontend
In a new terminal, navigate to the Angular application:Install the required npm packages:This will install all dependencies including:
- Angular 14.2 with Material Design
- Chart.js for dashboard visualizations
- Moment.js for date handling
- SweetAlert2 for user-friendly alerts
- XLSX for Excel export functionality
Update API Endpoint
Configure the frontend to connect to your backend API. Edit the environment configuration file to point to your API URL:
src/environments/environment.ts
Verify the Installation
To verify that everything is working correctly:Test the Login
If you have seeded the database with initial data, try logging in with a test user account.
Check the API
Visit
https://localhost:7XXX/swagger to view the API documentation and test endpoints.Key API endpoints available:POST /api/Usuario/Login- User authenticationGET /api/Producto/Lista- Get product listPOST /api/Venta/Registrar- Register a new saleGET /api/DashBoard- Get dashboard statistics
Development Workflow
Once your environment is set up, here’s a typical development workflow:Common Issues
Database connection fails
Database connection fails
Error:
SqlException: A network-related or instance-specific error occurredSolution:- Verify SQL Server is running
- Check the connection string in
appsettings.json - Ensure the database exists
- If using Windows Authentication, add
Integrated Security=trueto the connection string
CORS errors in the frontend
CORS errors in the frontend
Error:
Access to XMLHttpRequest has been blocked by CORS policySolution: The API already includes CORS configuration in Program.cs:14-21. Ensure the Angular app URL matches the allowed origins. The current configuration allows all origins in development.Angular module errors
Angular module errors
Error:
Module not found or Cannot find moduleSolution:Port already in use
Port already in use
Error:
Address already in useSolution:Next Steps
Architecture Overview
Learn about the layered architecture and project structure
API Reference
Explore the complete API documentation
Frontend Setup
Understand the Angular application structure
Database Schema
Review the complete database schema and relationships
Need help? Visit the GitHub repository or open an issue.