REST API for the DriveFlow Customer Relationship Management System
DriveFlow-CRM-API is a robust .NET 8.0 web API project designed to provide backend services for the DriveFlow Customer Relationship Management system. It leverages Entity Framework Core for data access and is built with a clean, maintainable architecture.
- RESTful API endpoints for managing customer data
- Secure authentication and authorization
- Database migrations and seeding
- Comprehensive error handling
- Swagger/OpenAPI documentation
- Heroku deployment support
- JawsDB MySQL integration
- .NET SDK 8.0.407
- Git
- IDE options:
- JawsDB MySQL account (for database hosting)
git clone https://github.com/DriveFlow-CRM/DriveFlow-CRM-API.git
cd DriveFlow-CRM-APIwinget install Microsoft.DotNet.SDK.8 --version 8.0.407Or download and run the installer from the .NET download page.
# Using Homebrew
brew install --cask dotnet-sdk
# Or download the installer from the .NET download page# Add Microsoft package repository
wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
# Install .NET SDK
sudo apt-get update
sudo apt-get install -y dotnet-sdk-8.0Run this command in your terminal or command prompt:
dotnet tool install --global dotnet-efFor production and deployment, use environment variables to store sensitive configuration:
# Production environment variables
export ASPNETCORE_ENVIRONMENT=Production
export JAWSDB_URL=mysql://<username>:<password>@<host>:<port>/<database>
export JWT_KEY=your_super_secret_key_at_least_32_chars_long
export INVOICE_SERVICE_URL=<your-secure-invoice-service-url>For local development, you can use .NET's User Secrets instead of storing sensitive data in files:
# Initialize user secrets (run once)
dotnet user-secrets init --project DriveFlow-CRM-API
# Set your secrets
dotnet user-secrets set "InvoiceService:Url" "<your-secure-invoice-service-url>" --project DriveFlow-CRM-API
dotnet user-secrets set "Jwt:Key" "<your-jwt-key>" --project DriveFlow-CRM-APIThis keeps sensitive values out of your source code and repositories.
dotnet restoredotnet ef database updatedotnet runThe API will be available at http://localhost:5000.
Comprehensive API documentation is available in the API_DOCS.yaml file, which follows the OpenAPI 3.0 specification.
To view the documentation in a user-friendly format:
- Visit Swagger Editor
- Import the API_DOCS.yaml file
Or access the Swagger UI by running the application and navigating to:
http://localhost:5000/swagger
The application uses JawsDB MySQL as its database provider. The schema is managed through Entity Framework Core migrations.
├── Controllers/ # API Controllers
├── Models/ # Data models and DTOs
├── Services/ # Business logic
├── Middleware/ # Custom middleware
├── Data/ # Data access layer
├── Migrations/ # EF Core migrations
├── docs/ # Documentation
└── Properties/ # Project properties
The application is configured for deployment to Heroku with JawsDB MySQL add-on.
When deploying with CI/CD pipelines, set these sensitive environment variables in your pipeline configuration:
env:
INVOICE_SERVICE_URL: ${{ secrets.INVOICE_SERVICE_URL }}
JWT_KEY: ${{ secrets.JWT_KEY }}# Set config vars
heroku config:set INVOICE_SERVICE_URL=<your-secure-invoice-service-url> --app your-app-name
heroku config:set JWT_KEY=<your-jwt-key> --app your-app-nameNever commit real service URLs, API keys, or credentials to your repository.
main: Production-ready codedevelop: Integration branch for feature developmentfeature/*: Feature branchesbugfix/*: Bug fix branches
- Create a branch from
develop - Make your changes
- Submit a pull request to
develop - Ensure tests pass
- Obtain code review approval
- Merge into
develop
- Entity Framework Core: Version 8.0.0
- Pomelo.EntityFrameworkCore.MySql: Version 8.0.0
- DotNetEnv: Version 3.1.1
- Swashbuckle.AspNetCore: Version 6.6.2
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or support, please open an issue on GitHub or contact the project maintainers.