Skip to content

Hocine-Bec/solaris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

81 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SolarCRM

A full-stack CRM platform designed for solar energy companies to manage customers, installations, equipment, energy production, and customer support. This project demonstrates enterprise-grade backend architecture and domain-driven design, tailored for the renewable energy industry.

🌟 Project Overview

SolarCRM provides a structured solution for companies in the solar industry by covering the following:

  • Customer Management β†’ onboarding, document storage, and lifecycle tracking (Lead β†’ Prospect β†’ Active β†’ Inactive).
  • Installation Management β†’ project workflow (Survey β†’ Design β†’ Permits β†’ Installation β†’ Inspection β†’ Activation).
  • Technician Assignment β†’ manage and track crews working on installations.
  • Equipment Tracking β†’ inventory, assignment, warranties, and maintenance.
  • Energy Monitoring β†’ capture production data, compare expected vs. actual output, and log system health.
  • Support & Communication β†’ ticketing system with attachments, technician assignments, and resolution tracking.
  • Document Management β†’ unified file handling for customers, installations, and support cases.

πŸš€ Tech Stack

  • Backend: ASP.NET Core (Clean Architecture + CQRS)
  • Database: PostgreSQL with Entity Framework Core
  • Frontend: React (TypeScript + TailwindCSS)
  • Authentication: JWT-based role management (Admin, Technician, Customer)
  • Logging & Testing: Serilog, xUnit, Moq, FluentAssertions

πŸ—οΈ Project Structure

SolarEnergyManagement/
β”œβ”€β”€ Backend/
β”‚   β”œβ”€β”€ Domain/                     # Core business entities
β”‚   β”‚   β”œβ”€β”€ Entities/
β”‚   β”‚   β”‚   β”œβ”€β”€ Customer.cs
β”‚   β”‚   β”‚   β”œβ”€β”€ Installation.cs
β”‚   β”‚   β”‚   β”œβ”€β”€ EnergyProduction.cs
β”‚   β”‚   β”‚   └── Technician.cs
β”‚   β”‚   β”œβ”€β”€ Enums/
β”‚   β”‚   β”‚   β”œβ”€β”€ CustomerStatus.cs
β”‚   β”‚   β”‚   β”œβ”€β”€ InstallationStatus.cs
β”‚   β”‚   β”‚   └── SystemHealth.cs
β”‚   β”‚   └── ValueObjects/
β”‚   β”œβ”€β”€ Application/                # Business logic and use cases
β”‚   β”‚   β”œβ”€β”€ Features/
β”‚   β”‚   β”‚   β”œβ”€β”€ Customers/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Commands/
β”‚   β”‚   β”‚   β”‚   └── Queries/
β”‚   β”‚   β”‚   β”œβ”€β”€ Installations/
β”‚   β”‚   β”‚   └── EnergyMonitoring/
β”‚   β”‚   └── Common/
β”‚   β”‚       β”œβ”€β”€ Interfaces/
β”‚   β”‚       β”œβ”€β”€ Behaviors/
β”‚   β”‚       └── Models/
β”‚   β”œβ”€β”€ Infrastructure/             # Data access and external services
β”‚   β”‚   β”œβ”€β”€ Data/
β”‚   β”‚   β”‚   β”œβ”€β”€ ApplicationDbContext.cs
β”‚   β”‚   β”‚   └── Configurations/
β”‚   β”‚   β”œβ”€β”€ Services/
β”‚   β”‚   β”‚   β”œβ”€β”€ EmailService.cs
β”‚   β”‚   β”‚   └── FileStorageService.cs
β”‚   β”‚   └── Identity/
β”‚   └── WebAPI/                     # API controllers and configuration
β”‚       β”œβ”€β”€ Controllers/
β”‚       β”‚   β”œβ”€β”€ CustomersController.cs
β”‚       β”‚   β”œβ”€β”€ InstallationsController.cs
β”‚       β”‚   └── EnergyController.cs
β”‚       └── Extensions/
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ UnitTests/
β”‚   └── IntegrationTests/
└── frontend/ (Future)
└── solar-dashboard-react/

πŸ“¦ Core Entities & Relationships

πŸ‘€ Customer

  • Stores customer details (name, email, phone, address).
  • Tracks status (Lead, Prospect, Active, Inactive).
  • Linked to installations, documents, and support tickets.

πŸ“ Address

  • Reusable entity for customer addresses and installation sites.

⚑ Installation

  • Represents a solar project with workflow stages (Survey β†’ Design β†’ Installation β†’ Activation).
  • Tracks system specs (size, panel count, inverter type).
  • Linked to customer, installation address, status history, equipment, technicians, and documents.

πŸ“Š EnergyProduction

  • Daily production metrics (Actual vs Expected).
  • Linked to installations and optional weather data.
  • Helps calculate performance and detect system health issues.

πŸ”§ Equipment

  • Inventory entity for panels, inverters, batteries, etc.
  • Tracks type, status (InStock, Installed, NeedsRepair), warranty, and costs.
  • Assignable to installations.

πŸ› οΈ Technician Assignment

  • Many-to-many mapping of users (technicians) to installations.
  • Tracks assignment date, role (Surveyor, Installer, Inspector), and completion status.

πŸ“‘ Document

  • Generic storage entity with polymorphic links to Customer, Installation, or SupportTicket.
  • Supports various types: contracts, permits, photos, reports, etc.

🎫 SupportTicket

  • Ticketing system for customer issues.
  • Tracks status (Open β†’ InProgress β†’ Resolved β†’ Closed) and priority (Low β†’ Critical).
  • Linked to customer, installation, assigned user, and documents.

πŸ‘₯ User

  • Represents system users: Admin, Technician, or Customer.
  • Stores authentication details and technician-specific info (specialization, license).
  • Linked to assigned installations and support tickets.

πŸ“š Enumerations

  • CustomerStatus: Lead, Prospect, Active, Inactive
  • InstallationStatus: Survey, Design, Permits, Installation, Inspection, Active, Deactivated
  • EquipmentType: SolarPanel, Inverter, Battery, etc.
  • EquipmentStatus: InStock, Assigned, Installed, NeedsRepair, Retired
  • SystemHealthStatus: Excellent β†’ Offline
  • TicketStatus / TicketPriority
  • DocumentType: Customer, Installation, Ticket, Generic
  • UserRole: Admin, Technician, Customer

Customer Journey

Lead β†’ Prospect β†’ Survey β†’ Design β†’ Permits β†’ Installation β†’ Active

Energy Monitoring Flow

Installation β†’ Energy Production β†’ Performance Analysis β†’ Billing β†’ Reporting

Installation Phases

  1. Survey - Site assessment and requirements gathering
  2. Design - System design and engineering
  3. Permits - Regulatory approvals and documentation
  4. Installation - Physical system installation
  5. Inspection - Safety and compliance verification
  6. Activation - System commissioning and monitoring setup

πŸš€ Getting Started

1. Prerequisites

2. Backend Setup

  1. Clone the Repository

    git clone <project>
    cd solar-crm
  2. Set Up Configuration Create a .env file in the project root and add the following values:

    • Database Connection

      DEFAULTCONNECTION=Host=localhost;Database=SolarEnergyDb;Username=postgres;Password=yourpassword
    • JWT Settings

      JWT_SECRET=your-jwt-secret-key-minimum-32-characters-long
      JWT_ISSUER=your-app-name
      JWT_AUDIENCE=your-app-users
      JWT_EXPIRY_MINUTES=jwt_lifetime
      JWT_REFRESH_TOKEN_LIFETIME_DAYS=refresh-token-lifetime
  3. Run Database Migrations

    dotnet ef database update --project src/Infrastructure --startup-project src/WebAPI
  4. Build and Run the Application

    dotnet restore
    dotnet build
    dotnet run --project src/WebAPI
  5. Access the API

🀝 Contributing

This is a learning project, but contributions and suggestions are welcome!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Built with β˜€οΈ for the clean energy future!

About

A comprehensive web-based CRM platform tailored for solar energy companies to manage customer relationships, streamline installations, and monitor energy performance.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages