This project is a microservice-based Online Auction System designed to facilitate real-time bidding and auction management. The system is structured to ensure modularity and scalability, where each microservice handles a specific functionality such as auction room management, bid processing, user notifications, invoice generation, payments, and user authentication.
- Functionality: Manages the creation and lifecycle of auction rooms, including auction initiation, room settings, and bid updates. It coordinates with the
BiddingServiceto notify other services of auction activities. - Communication: Publishes events through the NATS server to the
BiddingServicewhen users enter a room or place a bid. Also interacts with theNotificationServicefor sending notifications andInvoiceServiceto generate invoices for the highest bidders. - Background Task: Periodically triggers invoice generation tasks at the end of auctions, passing the relevant auction information to the
InvoiceService.
- Functionality: Manages real-time bid processing. This service listens for user activity events from the
RoomServiceto track participants entering auction rooms. It keeps a record of all bids and identifies the highest bidder. - Notifications: It sends real-time bid updates to the
NotificationService, which notifies all participants of the current highest bid and the leading bidder.
- Functionality: Responsible for sending notifications (emails) to users based on auction events. It receives notifications from the
BiddingServiceand sends them to auction participants using the Brevo (Sendinblue) email service.
- Functionality: After an auction concludes, this service generates invoices for the highest bidders. It receives information from the
RoomServiceabout completed auctions and prepares invoices for payment processing.
- Integration: Uses Paystack for payment processing. Once an invoice is generated by the
InvoiceService, thePaymentServicehandles payment confirmation and processing for the winning bidders.
- Implementation: Handles user authentication and identity management. This service allows users to register, log in, and manage their profiles. It ensures that only authenticated users can participate in auctions and bid.
- Microservice Communication: NATS server for event-driven, real-time communication between services.
- Payment Gateway: Paystack for secure payment transactions.
- Emailing Service: Brevo (formerly known as Sendinblue) for sending bid and auction-related notifications.
- ORM: Entity Framework Core (EFCore) for managing interactions with the underlying databases.
- Backend Framework: ASP.NET Core to build and run the microservices.
- Containerization: Docker is used to containerize all the services, enabling easier deployment and scalability across different environments.
This system is divided into multiple microservices, each responsible for a distinct part of the auction process:
- RoomService: Handles auction room management, bid updates, and auction events.
- BiddingService: Responsible for real-time bid handling and identifying the highest bidder.
- NotificationService: Sends real-time notifications to users.
- InvoiceService: Generates invoices for winning bidders after an auction ends.
- PaymentService: Processes payments from winning bidders through Paystack.
- AuthService: Manages user authentication and profile handling.
To run the project locally, follow the steps below:
Ensure you have the following installed on your system:
- Docker and Docker Compose
- Git for cloning the repository
-
Clone the Repository: Begin by cloning the repository from GitHub:
git clone https://github.com/Ambaaq-Ajibike/Online-Auction-System cd Online-Auction-System -
Environment Variables Setup: The system uses environment variables defined in the
docker-compose.ymlfile for database connection strings, Paystack credentials, and Brevo API keys. Make sure you configure them properly:ConnectionStrings__AppConnectionString: Connection strings for each microservice to connect to the SQL Server instance.- Brevo API credentials for email notifications.
- Paystack API keys for payment integration.
-
Start the Services: Use Docker Compose to build and start the services. Run the following command:
docker-compose up --build
This command will:
- Build and start all the services defined in the
docker-compose.ymlfile. - Start a SQL Server instance for database management.
- Build and start all the services defined in the
-
Service Ports: Each service is exposed on specific ports, and you can access them as follows:
- Room Service:
http://localhost:5002 - Bidding Service:
http://localhost:5000 - Notification Service:
http://localhost:5003 - Invoice Service:
http://localhost:5005 - Payment Service:
http://localhost:5001 - Auth Service:
http://localhost:5004 - SQL Server (Database):
http://localhost:1433
- Room Service:
-
Database Initialization: The system uses a SQL Server database to store auction and user data. The database container (
mssql) is automatically configured when you run Docker Compose. To interact with the database, connect to it using SQL Server Management Studio (SSMS) or another SQL client:- Host:
localhost - Port:
1433 - Username:
sa - Password:
ajibike123
- Host:
-
Stopping the Services: To stop all running containers, run the following command:
docker-compose down
This will stop and remove all the services and containers.
If you need to make changes to any of the services, navigate to the corresponding folder under src/ (e.g., src/BiddingService), make the necessary changes, and then rebuild the specific service:
docker-compose up --build <service-name>This will rebuild and restart only the modified service.
When deploying this project in a production environment, consider the following:
- Use Docker Secrets or environment variable management tools to handle sensitive information like API keys and database credentials.
- Implement monitoring and health checks to ensure services are running correctly.
- Consider using orchestration tools like Docker Swarm or Kubernetes for scaling and managing service containers.
- HTTPS: Configure SSL/TLS for secure communication between services and the client.