https://github.com/afzl210/exploding-kittens
https://github.com/afzl210/exploding-kittens
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/afzl210/exploding-kittens
- Owner: AFZL210
- Created: 2024-09-13T19:17:20.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-11T10:29:34.000Z (almost 2 years ago)
- Last Synced: 2024-12-27T20:29:51.430Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://exploding-kittens-lk2h.onrender.com/
- Size: 4.71 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Exploading Kittens
A luck based card game.
### DEMO VIDEO
[](https://youtu.be/iBNB24ZarnM)
## Installation
### Clone the Project
```bash
git clone https://github.com/AFZL210/exploding-kittens.git
```
### Setting Up Client/Frontend
1. Navigate to the `exploding-kittens/client` folder:
```bash
cd exploding-kittens/client
```
2. Install the dependencies:
```bash
npm install
```
3. Start the development server:
```bash
npm run dev
```
### Setting Up Backend
**NOTE**: Make sure you have Go and Redis installed, and Redis is running either locally or on a remote server.
1. Navigate to the `exploding-kittens/server` folder:
```bash
cd exploding-kittens/server
```
2. Install Go modules:
```bash
go mod tidy
```
3. Update Redis configuration in `main.go`:
- If Redis is running **locally**, update the configuration as follows:
```go
redisClient := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
})
```
- If Redis is running on a **remote server**, configure it like this:
```go
redisClient = redis.NewClient(&redis.Options{
Addr: "host:port",
Username: "Username",
Password: "Password",
TLSConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
})
```
4. Run the server:
```bash
go run main.go
```
No go to ```http://localhost:5173/``` to play the game!
## API Reference
#### Register user
```http
GET /api/register
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `username` | `string` | **Required**. username |
| `password` | `string` | **Required**. password for username |
#### Login user
```http
GET /api/login
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `username` | `string` | **Required**. username |
| `password` | `string` | **Required**. password for username |
### Get User's Cards
```http
GET /api/getcards?username={$Username}
```
### Shuffle/Reset usersgame
```http
GET /api/shuffle?username={$Username}
```
#### Play Move/Draw a card
```http
GET /api/play?username={$Username}
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `index` | `string` | **Required**. index of card to be drawn |
### Get Leaderboard
```http
GET /api/leaderboard
```
### Get User's Rank
```http
GET /api/user-rank?username={$Username}
```
## Features
- User game create an account and play game as per given rules
- Show leaderboard to users
- Used Redux for state management
- User can login/register with username and password
- Used JWT for auth
## Bonus Features
- Automatically save the game for a user at every stage so the user can continue from where he left off last time.
- Real-time update of points on the leaderboard for all the users if they are playing simultaneously.