The Roulette Game project is a comprehensive application comprising a frontend built with Vue 3 and Pinia for state management, and a backend API built using ASP.NET Core and Entity Framework Core. The project allows users to place bets, spin the roulette wheel, and manage their balances.
Before you begin, ensure you have the following installed:
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
Using npm:
npm install
Or using Yarn:
yarn install
-
Environment Variables:
Create a
.envfile in the root directory of the project and add the necessary environment variables:VITE_API_URL_PROD=<your-api-url> -
Run the development server:
Using npm:
npm run dev
Or using Yarn:
yarn dev
The application will be available at
http://localhost:3000.
-
Start the Application:
Open your web browser and navigate to
http://localhost:3000. You should see the login screen. -
Login:
Enter your username and initial balance to start the game.
-
Place Bets:
- Select a number, color, or even/odd option to place your bet.
- Enter the amount you wish to bet.
-
Spin the Roulette:
- Click on the "Continue" button to spin the roulette wheel.
- The result will be displayed and your balance will be updated accordingly.
-
Save Balance:
- Click on the "Save Balance" button to save your current balance to the server.
-
Logout:
- Click on the "Get out" button in the top right corner to log out of the game.
- main.ts: Entry point of the application where Vue instance is created and configured.
- App.vue: Root component that sets up the router view.
- routes/routes.ts: Defines the routes for the application.
- store/store.ts: Pinia store definition for managing state.
- composables/SpinnerRouletteService.ts: Logic for spinning the roulette wheel.
- composables/RouletteFormService.ts: Logic for handling the betting form.
- components/RouletteApp.vue: Main layout of the game screen including the roulette wheel, form, and rules section.
- components/RouletteForm.vue: Component for placing bets.
- components/SpinnerRoulette.vue: Component for displaying and spinning the roulette wheel.
- components/RouletteRulesSection.vue: Component displaying the game rules.
- components/FormLogin.vue: Login form for starting the game.
- .NET SDK
- SQL Server
- Docker (optional, for containerized deployment)
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Restore dependencies:
dotnet restore
The following environment variables are required for configuring the project:
DB_CONNECTION_STRING: Connection string to the SQL Server database.ASPNETCORE_ENVIRONMENT: Execution environment (Development, Staging, Production).
-
Create the database.
-
Apply migrations:
dotnet ef database update
Some examples of how to interact with the API.
POST /api/user/updateBalance: Updates the balance of a user.GET /api/user/{name}: Retrieves the balance of a user.POST /api/roulette/initialize: Initializes a player.POST /api/roulette/bet: Places a bet.
- Controllers/: API controllers.
- Models/: Data models.
- Data/: Database context and migrations.
- Program.cs: Application entry point.
dotnet test-
Build the project:
dotnet publish --configuration Release
-
Configure the production server.
-
Deploy the published files.
-
Fork the repository.
-
Create a new branch:
git checkout -b feature/your-feature-name
-
Make your changes.
-
Commit your changes:
git commit -m 'Add some feature' -
Push to the branch:
git push origin feature/your-feature-name
-
Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Author: Riandry Dev
Email: [email protected]
This README file provides a comprehensive guide to understanding, setting up, using, and contributing to the Roulette Game project. For any further questions or issues, please refer to the source code or contact the maintainer of this project.