Bottle is a structured .NET Web API project built using ASP.NET Core 9, designed for user authentication, product management, and order processing. This project follows a clean architecture with a well-defined structure for Controllers, Services, Repositories, and Models to ensure maintainability and scalability.
- User Management: Register, login, logout, and delete users.
- Product Management: Add, update, and check product availability.
- Order Management: Create, cancel, and update orders with a structured workflow.
- Authentication: Uses JWT tokens for securing endpoints.
- Database Support: Uses MySQL for persistent data storage.
- Unit Testing: Includes xUnit tests for core functionalities.
Bottle/
│-- Bottle.Api/ # Main API project
│ ├── Controllers/ # API Controllers
│ ├── Models/ # Entity Models
│ ├── Services/ # Business logic layer
│ ├── Repositories/ # Data access layer
│ ├── Middleware/ # Custom middlewares
│ ├── appsettings.json # Application configuration
│ ├── Program.cs # Application entry point
│
│-- Bottle.Tests/ # Unit test project
│ ├── Tests/ # Test cases for various modules
│ ├── DatabaseTests.cs # Database connection tests
│
│-- env.example # Example environment file (should be copied as .env)
│-- README.md # Project documentation
│-- .gitignore # Git ignore file
│-- Bottle.sln # Solution file
Ensure you have the following installed on your machine:
- .NET 9 SDK
- MySQL (for database management)
- TablePlus or DBeaver (for database GUI management, optional)
- Postman (for testing API endpoints, optional)
git [email protected]:obengkofijames/Bottle.git
cd Bottle
A sample .env.example
file is provided in the root directory. Copy it and rename it as .env
:
cp env.example .env
Then, open .env
and configure the necessary values, such as:
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=yourpassword
DB_NAME=bottle_db
JWT_SECRET=your-secret-key
Navigate to the API project directory and apply migrations:
cd Bottle.Api
dotnet ef database update
dotnet run --project Bottle.Api
dotnet test
- API runs at
http://localhost:5000
(by default) - Use Postman or cURL to interact with API endpoints.
- Example request for user login:
curl -X POST "http://localhost:5000/api/auth/login" -H "Content-Type: application/json" -d '{"email": "[email protected]", "password": "password123"}'
- Fork the repository.
- Create a feature branch (
git checkout -b feature-name
). - Commit your changes (
git commit -m 'Added new feature'
). - Push to the branch (
git push origin feature-name
). - Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.